-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
158 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,6 @@ Typograf.addRule({ | |
|
||
return buffer.join(separator); | ||
}, | ||
disabled: true | ||
disabled: true, | ||
htmlAttrs: false | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Typograf.addRule({ | ||
name: 'common/html/processingAttrs', | ||
queue: 'hide-safe-tags-own', // After "hide-safe-tags-own", before "hide-safe-tags-html". | ||
handler: function(text, settings) { | ||
var that = this, | ||
tp = null, | ||
reAttrs = new RegExp('(^|\\s)(' + settings.attrs.join('|') + ')=("[^"]*?"|\'[^\']*?\')', 'gi'); | ||
|
||
return text.replace(/(<[-\w]+\s)([^>]+?)>/g, function(match, tagName, attrs) { | ||
var resultAttrs = attrs.replace(reAttrs, function(submatch, space, attrName, attrValue) { | ||
tp = tp || that._cloneInstance(function(rule) { | ||
return rule.htmlAttrs !== false; | ||
}); | ||
|
||
var lquote = attrValue[0], | ||
rquote = attrValue[attrValue.length - 1], | ||
value = attrValue.slice(1, -1); | ||
|
||
return space + attrName + '=' + lquote + tp.execute(value) + rquote; | ||
}); | ||
|
||
return tagName + resultAttrs + '>'; | ||
}); | ||
}, | ||
settings: { | ||
attrs: ['title', 'placeholder'] | ||
}, | ||
disabled: true, | ||
htmlAttrs: false | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"en-US": "Processing HTML attributes", | ||
"ru": "Типографирование HTML-атрибутов" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
tests.push(['common/punctuation/delDoublePunctuation', [ | ||
['У меня была только синяя краска;; но,, несмотря на это,, я затеял нарисовать охоту.', 'У меня была только синяя краска; но, несмотря на это, я затеял нарисовать охоту.'], | ||
['Никогда не отказывайся от малого в работе:: из малого строится великое.', 'Никогда не отказывайся от малого в работе: из малого строится великое.'] | ||
[ | ||
'У меня была только синяя краска;; но,, несмотря на это,, я затеял нарисовать охоту.', | ||
'У меня была только синяя краска; но, несмотря на это, я затеял нарисовать охоту.' | ||
], | ||
[ | ||
'Никогда не отказывайся от малого в работе:: из малого строится великое.', | ||
'Никогда не отказывайся от малого в работе: из малого строится великое.' | ||
] | ||
]]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,26 @@ | ||
tests.push(['ru/punctuation/exclamation', [ | ||
['!!', '!'], | ||
['Ура!! ', 'Ура! '], | ||
['!!!!', '!!!'], | ||
['Ура!!!! ', 'Ура!!! '] | ||
[ | ||
'!!', | ||
'!' | ||
], | ||
[ | ||
'Ура!! ', | ||
'Ура! ' | ||
], | ||
[ | ||
'Ура!!\nУра!!', | ||
'Ура!\nУра!' | ||
], | ||
[ | ||
'!!!!', | ||
'!!!' | ||
], | ||
[ | ||
'Ура!!!! ', | ||
'Ура!!! ' | ||
], | ||
[ | ||
'Ура!!!!\nУра!!!!', | ||
'Ура!!!\nУра!!!' | ||
] | ||
]]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters