Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-htmldiff

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-htmldiff - npm Package Compare versions

Comparing version 0.9.0 to 0.9.1

2

htmldiff-cli.js

@@ -21,3 +21,3 @@ #!/usr/bin/env node

function printUsage() {
var usage = cli + " v0.9.0\n\nUsage: " + cli + " beforeFile afterFile diffedFile [Options]\n\nbeforeFile:\n An HTML input file in its original form.\n\nafterFile:\n An HTML input file, based on beforeFile but with changes.\n\ndiffedFile:\n Name of the diffed HTML output file. All differences between beforeFile\n and afterFile will be surrounded with <ins> and <del> tags. If diffedFile\n is - (minus) the result will be written with console.log() to stdout.\n\nOptions:\n\n-c className (optional):\n className will be added as a class attribute on every <ins> and <del> tag.\n\n-p dataPrefix (optional):\n The data prefix to use for data attributes. The operation index data\n attribute will be named \"data-${dataPrefix-}operation-index\". If not\n used, the default attribute name \"data-operation-index\" will be added\n on every <ins> and <del> tag. The value of this attribute is an auto\n incremented counter.\n\n-t atomicTags (optional):\n List of tag names. The list has to be in the form \"tag1|tag2|...\"\n e. g. \"head|script|style\". An atomic tag is one whose child nodes should\n not be compared - the entire tag should be treated as one token. This is\n useful for tags where it does not make sense to insert <ins> and <del>\n tags. If not used, this default list will be used:\n \"iframe|object|math|svg|script|video|head|style\".";
var usage = cli + " v0.9.0\n\nUsage: " + cli + " beforeFile afterFile diffedFile [Options]\n\nbeforeFile:\n An HTML input file in its original form.\n\nafterFile:\n An HTML input file, based on beforeFile but with changes.\n\ndiffedFile:\n Name of the diffed HTML output file. All differences between beforeFile\n and afterFile will be surrounded with <ins> and <del> tags. If diffedFile\n is - (minus) the result will be written with console.log() to stdout.\n\nOptions:\n\n-c className (optional):\n className will be added as a class attribute on every <ins> and <del> tag.\n\n-p dataPrefix (optional):\n The data prefix to use for data attributes. The operation index data\n attribute will be named \"data-${dataPrefix-}operation-index\". If not\n used, the default attribute name \"data-operation-index\" will be added\n on every <ins> and <del> tag. The value of this attribute is an auto\n incremented counter.\n\n-t atomicTags (optional):\n Comma separated list of tag names. The list has to be in the form\n \"tag1,tag2,...\" e. g. \"head,script,style\". An atomic tag is one whose\n child nodes should not be compared - the entire tag should be treated\n as one token. This is useful for tags where it does not make sense to\n insert <ins> and <del> tags. If not used, the default list will be used:\n \"iframe,object,math,svg,script,video,head,style\".";
console.log(usage);

@@ -24,0 +24,0 @@ }

@@ -10,7 +10,8 @@ /**

* operation index data attribute will be named `data-${dataPrefix-}operation-index`.
* @param {string} atomicTags (Optional) List of tag names. The list has to be in the form
* `tag1|tag2|...` e. g. `head|script|style`. An atomic tag is one whose child nodes
* should not be compared - the entire tag should be treated as one token. This is
* useful for tags where it does not make sense to insert <ins> and <del> tags.
* If not used, the default list `iframe|object|math|svg|script|video|head|style` will be used.
* @param {string} atomicTags (Optional) Comma separated list of tag names. The list has to
* be in the form `tag1,tag2,...` e. g. `head,script,style`. An atomic tag is one whose
* child nodes should not be compared - the entire tag should be treated as one token.
* This is useful for tags where it does not make sense to insert `<ins>` and `<del>`
* tags. If not used, the default list `iframe,object,math,svg,script,video,head,style`
* will be used.
*

@@ -17,0 +18,0 @@ * @return {string} The combined HTML content with differences wrapped in `<ins>` and `<del>` tags.

@@ -73,3 +73,3 @@ /**

// Added head and style (for style tags inside the body)
var defaultAtomicTagsRegExp = new RegExp('^<(iframe|object|math|svg|script|video|head|style)');
var defaultAtomicTagsRegExp = new RegExp('^<(iframe,object,math,svg,script,video,head,style)');

@@ -947,5 +947,5 @@ /**

* operation index data attribute will be named `data-${dataPrefix-}operation-index`.
* @param {string} atomicTags (Optional) List of atomic tag names. The list has to be in the
* form 'tag1|tag2|tag3|...' e. g. 'head|script|style|...'. If not used, the default list
* 'iframe|object|math|svg|script|video|head|style' will be used.
* @param {string} atomicTags (Optional) Comma separated list of atomic tag names. The
* list has to be in the form `tag1,tag2,...` e. g. `head,script,style`. If not used,
* the default list `iframe,object,math,svg,script,video,head,style` will be used.
*

@@ -958,3 +958,5 @@ * @return {string} The combined HTML content with differences wrapped in <ins> and <del> tags.

// Enable user provided atomic tag list.
atomicTags ? (atomicTagsRegExp = new RegExp('^<(' + atomicTags + ')')) : (atomicTagsRegExp = defaultAtomicTagsRegExp);
atomicTags ?
(atomicTagsRegExp = new RegExp('^<(' + atomicTags.replace(/\s*/g, "").trim() + ')'))
: (atomicTagsRegExp = defaultAtomicTagsRegExp);

@@ -961,0 +963,0 @@ before = htmlToTokens(before);

@@ -6,3 +6,3 @@ {

"copyright": "©2018, idesis GmbH; ©2012 The Network Inc. and contributors",
"version": "0.9.0",
"version": "0.9.1",
"identifier": "de.idesis.node-htmldiff",

@@ -9,0 +9,0 @@ "keywords": [

@@ -62,8 +62,9 @@ # htmldiff.js

the default attribute name `data-operation-index` will be added on every inserted
`<ins>` and `<del>` tag. The value of this attribute is an auto incremented counter.
- `atomicTags` (string) A list of tag names. The list has to be in the form `tag1|tag2|...`
e. g. `head|script|style`. An atomic tag is one whose child nodes should not be
compared - the entire tag should be treated as one token. This is useful for tags where
it does not make sense to insert `<ins>` and `<del>` tags. If not used, this default
list will be used: `iframe|object|math|svg|script|video|head|style`.
`<ins>` and `<del>` tag. The value of this attribute is an auto incremented counter.
- `atomicTags` (string) Comma separated list of tag names. The list has to be in the form
`tag1,tag2,...` e. g. `head,script,style`. An atomic tag is one whose child nodes should
not be compared - the entire tag should be treated as one token. This is useful for tags
where it does not make sense to insert `<ins>` and `<del>` tags. If not used, the default
list will be used:
`iframe,object,math,svg,script,video,head,style`.

@@ -102,3 +103,3 @@

```bash
htmldiff beforeFile afterFile diffedFile [Options]
htmldiff beforeFile afterFile diffedFile [-c className] [-p dataPrefix] [-t atomicTags]
```

@@ -119,19 +120,6 @@

- `-c` `className` (optional): className will be added as a class attribute
on every `<ins>` and `<del>` tag.
`-c className`, `-p dataPrefix` and `-t atomicTags` are all optional. For a
description please see API documentation above.
- `-p` `dataPrefix` (optional): The data prefix to use for data attributes.
The operation index data attribute will be named
`data-${dataPrefix-}operation-index`. If not used, the default attribute
name `data-operation-index` will be added on every `<ins>` and `<del>` tag.
The value of this attribute is an auto incremented counter.
- `-t` `atomicTags` (optional): List of tag names. The list has to be in the
form `tag1|tag2|...` e. g. `head|script|style`. An atomic tag is one whose
child nodes should not be compared - the entire tag should be treated as
one token. This is useful for tags where it does not make sense to insert
`<ins>` and `<del>` tags. If not used, this default list will be used:
`iframe|object|math|svg|script|video|head|style`.
## Development

@@ -138,0 +126,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc