Skip to content

Commit dce7aa4

Browse files
committed
Update README
1 parent 8cd9d76 commit dce7aa4

2 files changed

Lines changed: 61 additions & 1 deletion

File tree

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,3 +369,33 @@ Study the following `config.json` file:
369369
"ignoreDuplicateAttributes": false
370370
}
371371
```
372+
373+
## Masks
374+
375+
**html-differ** supports handling of _masks_ in HTML.
376+
377+
For example, the following two code samples will be considered to be equivalent:
378+
379+
```html
380+
<div id="{{[a-z]*\s\d+}}">
381+
```
382+
383+
```html
384+
<div id="text 12345">
385+
```
386+
387+
### Syntax
388+
389+
_Masks_ in **html-differ** have the following syntax:
390+
391+
```js
392+
{{RegExp}}
393+
```
394+
395+
where:
396+
397+
* `{{` – opening identifier of the _mask_.
398+
399+
* `RegExp` – regular expression for matching with the corresponding value in another HTML. The syntax is similar to regular expressions in JavaScript written in a literal notation.
400+
401+
* `}}` – closing identifier of the _mask_.

README.ru.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ var HtmlDiffer = require('html-differ').HtmlDiffer,
7171
htmlDiffer = new HtmlDiffer(options);
7272
```
7373

74-
Где `options` – это объект:
74+
где `options` – это объект:
7575

7676
* **ignoreAttributes: [ Array ]**
7777

@@ -366,3 +366,33 @@ $ html-differ --bem путь/к/html1 путь/к/html2
366366
"ignoreDuplicateAttributes": false
367367
}
368368
```
369+
370+
## Маски
371+
372+
**html-differ** поддерживает использование _масок_ в HTML.
373+
374+
Например, следующие два HTML будут считаться эквивалентными:
375+
376+
```html
377+
<div id="{{[a-z]*\s\d+}}">
378+
```
379+
380+
```html
381+
<div id="text 12345">
382+
```
383+
384+
### Синтаксис
385+
386+
Для записи _масок_ в **html-differ** используется следующий синтаксис:
387+
388+
```js
389+
{{RegExp}}
390+
```
391+
392+
где:
393+
394+
* `{{` – открывающий идентификатор _маски_.
395+
396+
* `RegExp` – регулярное выражение для сопоставления с соответствующим значением в сравниваемом HTML. Имеет такой же синтаксис как и регулярные выражения в JavaScript, записанные в _literal notation_.
397+
398+
* `}}` – закрывающий идентификатор _маски_.

0 commit comments

Comments
 (0)