You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Makes **html-differ** ignore whitespaces (spaces, tabs, new lines etc.) during the comparison (default: `true`).
156
157
@@ -182,7 +183,7 @@ The following two code samples will be considered to be equivalent:
182
183
183
184
```
184
185
185
-
#####ignoreComments: Boolean#####
186
+
#####ignoreComments: Boolean
186
187
187
188
Makes **html-differ** ignore HTML comments during the comparison (default: `true`).
188
189
@@ -231,7 +232,7 @@ Text
231
232
</html>
232
233
```
233
234
234
-
#####ignoreEndTags: Boolean#####
235
+
#####ignoreEndTags: Boolean
235
236
236
237
Makes **html-differ** ignore end tags during the comparison (default: `false`).
237
238
@@ -246,7 +247,7 @@ The following two code samples will be considered to be equivalent:
246
247
<span>Text</spane>
247
248
```
248
249
249
-
#####ignoreDuplicateAttributes: Boolean#####
250
+
#####ignoreDuplicateAttributes: Boolean
250
251
251
252
Makes **html-differ** ignore tags' duplicate attributes during the comparison.<br>
252
253
From the list of the same tag's attributes, the attribute which goes the first will be taken for comparison, others will be ignored (default: `false`).
@@ -262,12 +263,12 @@ For example, the following two code samples will be considered to be equivalent:
262
263
<spanid="blah">Text</span>
263
264
```
264
265
265
-
####Presets####
266
+
####Presets
266
267
267
268
*[bem](https://github.com/bem/html-differ/blob/master/presets/bem.json) - sets predefined options for [BEM](http://bem.info/).
268
269
269
270
270
-
#####Usage#####
271
+
#####Usage
271
272
272
273
Passing of a preset via the constructor:
273
274
@@ -283,36 +284,39 @@ var HtmlDiffer = require('html-differ').HtmlDiffer,
**@returns***{Array of objects}* - [array with diffs](https://github.com/kpdecker/jsdiff#change-objects) between HTML
292
294
293
-
#####htmlDiffer.isEqual#####
295
+
##### htmlDiffer.isEqual
296
+
294
297
**@param***{String}* - the 1-st HTML code<br>
295
298
**@param***{String}* - the 2-nd HTML code<br>
296
299
**@returns***{Boolean}*
297
300
298
301
299
-
###Logger###
302
+
###Logger
300
303
301
304
```js
302
305
var logger =require('html-differ/lib/logger');
303
306
```
304
307
305
-
####Methods####
308
+
#### Methods
309
+
310
+
##### logger.getDiffText
306
311
307
-
#####logger.getDiffText#####
308
312
**@param***{Array of objects}* - the result of the work of the method [htmlDiffer.diffHtml](https://github.com/bem/html-differ/tree/master#htmldifferdiffhtml)<br>
309
313
**@param***{Object}* - options:<br>
310
314
311
315
***charsAroundDiff: Number** - the number of characters around the diff result between two HTML (default: `40`).
312
316
313
317
**@returns***{String}*
314
318
315
-
#####logger.logDiffText#####
319
+
#####logger.logDiffText
316
320
**@param***{Array of objects}* - the result of the work of the method [htmlDiffer.diffHtml](https://github.com/bem/html-differ/tree/master#htmldifferdiffhtml)<br>
317
321
**@param***{Object}* - options:<br>
318
322
@@ -323,7 +327,7 @@ var logger = require('html-differ/lib/logger');
*`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.
428
432
429
433
*`}}` – closing identifier of the _mask_.
434
+
435
+
### Screening
436
+
437
+
The rules of screening of symbols are similar to the rules which are used in regular expressions in JavaScript written in a literal notation.
438
+
439
+
For example, the following two code samples will be considered to be equivalent:
440
+
441
+
```html
442
+
<divid="{{\d\.\d}}">
443
+
```
444
+
445
+
```html
446
+
<divid="1.1">
447
+
```
448
+
449
+
If you want to use `{{` or `}}` inside a mask, you should screen both curly braces, i.e. `\{\}` or `\}\}`.
450
+
451
+
For example, the following two code samples will be considered to be equivalent:
Copy file name to clipboardExpand all lines: README.ru.md
+51-20Lines changed: 51 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@
29
29
*[Конфигурационный файл](#Конфигурационный-файл)
30
30
*[Маски](#Маски)
31
31
*[Синтаксис](#Синтаксис)
32
+
*[Экранирование](#Экранирование)
32
33
33
34
<!-- TOC END -->
34
35
@@ -103,9 +104,9 @@ var HtmlDiffer = require('html-differ').HtmlDiffer,
103
104
104
105
где `options` – это объект.
105
106
106
-
####Опции####
107
+
####Опции
107
108
108
-
#####ignoreAttributes: [Array]#####
109
+
#####ignoreAttributes: [Array]
109
110
110
111
Устанавливает, значения каких атрибутов следует игнорировать при сравнении (по умолчанию: `[]`).
111
112
@@ -122,7 +123,7 @@ var HtmlDiffer = require('html-differ').HtmlDiffer,
122
123
<inputid="sfsdfksdf">
123
124
```
124
125
125
-
#####compareAttributesAsJSON: [Array]#####
126
+
#####compareAttributesAsJSON: [Array]
126
127
127
128
Устанавливает, значения каких атрибутов следует сравнивать как JSON-объекты, а не как строки (по умолчанию: `[]`).<br>
128
129
В тех случаях, когда в качестве значения атрибута выступает некорректный JSON или это значение нельзя обернуть в функцию, то оно будет сравниваться как `undefined`.
@@ -150,7 +151,7 @@ var HtmlDiffer = require('html-differ').HtmlDiffer,
150
151
Первый элемент массива мог быть записан в короткой форме в качестве строки:<br>
**@returns***{Array of objects}* - [массив с отличиями](https://github.com/kpdecker/jsdiff#change-objects) между HTML
291
293
292
-
#####htmlDiffer.isEqual#####
294
+
##### htmlDiffer.isEqual
295
+
293
296
**@param***{String}* - 1-й HTML<br>
294
297
**@param***{String}* - 2-й HTML<br>
295
298
**@returns***{Boolean}*
296
299
297
-
###Logger###
300
+
###Logger
298
301
299
302
```js
300
303
var logger =require('html-differ/lib/logger');
301
304
```
302
305
303
-
####Методы####
306
+
#### Методы
307
+
308
+
##### logger.getDiffText
304
309
305
-
#####logger.getDiffText#####
306
310
**@param***{Array of objects}* - результат работы метода [htmlDiffer.diffHtml](https://github.com/bem/html-differ/blob/master/README.ru.md#htmldifferdiffhtml)<br>
307
311
**@param***{Object}* - опции:<br>
308
312
309
313
***charsAroundDiff: Number** - количество символов перед отличием между HTML и после него (по умолчанию: `40`)
310
314
311
315
**@returns***{String}*
312
316
313
-
#####logger.logDiffText#####
317
+
##### logger.logDiffText
318
+
314
319
**@param***{Array of objects}* - результат работы метода [htmlDiffer.diffHtml](https://github.com/bem/html-differ/blob/master/README.ru.md#htmldifferdiffhtml)<br>
315
320
**@param***{Object}* - опции:<br>
316
321
@@ -320,7 +325,7 @@ var logger = require('html-differ/lib/logger');
*`RegExp` – регулярное выражение для сопоставления с соответствующим значением в сравниваемом HTML. Имеет такой же синтаксис как и регулярные выражения в JavaScript, записанные в _literal notation_.
425
430
426
431
*`}}` – закрывающий идентификатор _маски_.
432
+
433
+
### Экранирование
434
+
435
+
Правила экранирования символов такие же как и при использовании регулярных выражений в JavaScript, записанных в _literal notation_.
436
+
437
+
Например, следующие два HTML будут считаться эквивалентными:
438
+
439
+
```html
440
+
<divid="{{\d\.\d}}">
441
+
```
442
+
443
+
```html
444
+
<divid="1.1">
445
+
```
446
+
447
+
Если вы хотите хотите использовать `{{` или `}}` внутри маски, вам необходимо экранировать обе фигурные скобки, то есть `\{\}` или `\}\}`
448
+
449
+
Например, следующие два HTML будут считаться эквивалентными:
0 commit comments