npm

Does your artifact manager get in the way? Join us on Oct. 8 at 10am PT, to discuss how npm can help.Sign up »

@haxcms/migrate-regex

0.0.3 • Public • Published

@haxcms/migrate-regex

Install

$ npm install -g @haxcms/migrate-regex
$ migrate-regex COMMAND
running command...
$ migrate-regex (-v|--version|version)
@haxcms/migrate-regex/0.0.3 darwin-x64 node-v10.12.0
$ migrate-regex --help [COMMAND]
USAGE
  $ migrate-regex COMMAND
...
$ npm install -g @haxcms/migrate-regex
$ migrate-regex COMMAND
running command...
$ migrate-regex (-v|--version|version)
@haxcms/migrate-regex/0.0.0 darwin-x64 node-v10.12.0
$ migrate-regex --help [COMMAND]
USAGE
  $ migrate-regex COMMAND
...

Usage

Define patterns and replacements

In your HAXcms site, create a file called migrate.json. By default migrate-regex will assume this file is a sibling of site.json.

Define your patterns in the regex property. Example:

{
  "regex": [
    {
      "pattern": "<",
      "replacement": "<"
    },
    {
      "pattern": "&gt;",
      "replacement": ">"
    },
    {
      "pattern": "&quot;",
      "replacement": "\""
    },
    {
      "pattern": "(\\$\\$(?:(?!\\$\\$)[\\s\\S])*?)(<\/?em>)([\\s\\S]*?\\$\\$)",
      "replacement": "$1_$3"
    },
    {
      "pattern": "(\\$\\$)([^\\$\\$]*)(\\$\\$)",
      "replacement": "<lrn-math>$2</lrn-math>"
    }
  ]
}

Run regex migration

$ migrate-regex run -j site.json

Keywords

install

npm i @haxcms/migrate-regex

Downloadsweekly downloads

0

version

0.0.3

license

Apache 2.0

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability