Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1507)

Unified Diff: lib/src/prism/components/prism-rest.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/prism/components/prism-r.min.js ('k') | lib/src/prism/components/prism-rest.min.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/prism/components/prism-rest.js
diff --git a/lib/src/prism/components/prism-rest.js b/lib/src/prism/components/prism-rest.js
index 6693dc9090995019178e9cd389154d3869d8efe9..f9390ecadea463f2c6a4b36f180456a60e9980a2 100644
--- a/lib/src/prism/components/prism-rest.js
+++ b/lib/src/prism/components/prism-rest.js
@@ -19,7 +19,7 @@ Prism.languages.rest = {
// Directive-like patterns
'substitution-def': {
- pattern: /(^\s*\.\. )\|(?:[^|\s]|[^|\s][^|]*[^|\s])\| [^:]+::/m,
+ pattern: /(^\s*\.\. )\|(?:[^|\s](?:[^|]*[^|\s])?)\| [^:]+::/m,
lookbehind: true,
inside: {
'substitution': {
@@ -30,7 +30,7 @@ Prism.languages.rest = {
}
},
'directive': {
- pattern: /( )[^:]+::/,
+ pattern: /( +)[^:]+::/,
lookbehind: true,
alias: 'function',
inside: {
@@ -49,7 +49,7 @@ Prism.languages.rest = {
}
},
{
- pattern: /(^\s*\.\. )_(?:`[^`]+`|(?:\\:|[^:])+):/m,
+ pattern: /(^\s*\.\. )_(?:`[^`]+`|(?:[^:\\]|\\.)+):/m,
lookbehind: true,
alias: 'string',
inside: {
@@ -66,14 +66,15 @@ Prism.languages.rest = {
}
},
'comment': {
- pattern: /(^\s*\.\.\s).*(?:(?:\r?\n|\r).*)*?(?=(?:\r?\n|\r){2}|$)/m,
+ // The two alternatives try to prevent highlighting of blank comments
+ pattern: /(^\s*\.\.)(?:(?: .+)?(?:(?:\r?\n|\r).+)+| .+)(?=(?:\r?\n|\r){2}|$)/m,
lookbehind: true
},
'title': [
// Overlined and underlined
{
- pattern: /^([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]{2,})(?:\r?\n|\r).+(?:\r?\n|\r)\1$/m,
+ pattern: /^(([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\2+)(?:\r?\n|\r).+(?:\r?\n|\r)\1$/m,
inside: {
'punctuation': /^[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]+|[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]+$/,
'important': /.+/
@@ -82,7 +83,7 @@ Prism.languages.rest = {
// Underlined only
{
- pattern: /(^|(?:\r?\n|\r){2}).+(?:\r?\n|\r)[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]{2,}(?=\r?\n|\r|$)/,
+ pattern: /(^|(?:\r?\n|\r){2}).+(?:\r?\n|\r)([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\2+(?=\r?\n|\r|$)/,
lookbehind: true,
inside: {
'punctuation': /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]+$/,
@@ -91,22 +92,17 @@ Prism.languages.rest = {
}
],
'hr': {
- pattern: /((?:\r?\n|\r){2})[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]{4,}(?=(?:\r?\n|\r){2})/,
- lookbehind: true,
- alias: 'punctuation'
- },
- 'list-bullet': {
- pattern: /(^\s*)(?:[*+\-•‣⁃]|\(?(?:\d+|[a-z]|[ivxdclm]+)\)|(?:\d+|[a-z]|[ivxdclm]+)\.)(?= )/im,
+ pattern: /((?:\r?\n|\r){2})([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\2{3,}(?=(?:\r?\n|\r){2})/,
lookbehind: true,
alias: 'punctuation'
},
'field': {
- pattern: /(^\s*):[^:]+:(?= )/m,
+ pattern: /(^\s*):[^:\r\n]+:(?= )/m,
lookbehind: true,
alias: 'attr-name'
},
'command-line-option': {
- pattern: /(^\s*)(?:[+-][a-z\d]|(?:\-\-|\/)[a-z\d-]+)(?:[ =](?:[a-z][a-z\d_-]*|<[^<>]+>))?(?:, (?:[+-][a-z\d]|(?:\-\-|\/)[a-z\d-]+)(?:[ =](?:[a-z][a-z\d_-]*|<[^<>]+>))?)*(?=(?:\r?\n|\r)? {2,}[\S])/im,
+ pattern: /(^\s*)(?:[+-][a-z\d]|(?:\-\-|\/)[a-z\d-]+)(?:[ =](?:[a-z][a-z\d_-]*|<[^<>]+>))?(?:, (?:[+-][a-z\d]|(?:\-\-|\/)[a-z\d-]+)(?:[ =](?:[a-z][a-z\d_-]*|<[^<>]+>))?)*(?=(?:\r?\n|\r)? {2,}\S)/im,
lookbehind: true,
alias: 'symbol'
},
@@ -123,11 +119,16 @@ Prism.languages.rest = {
pattern: /::(?:\r?\n|\r){2}([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]).*(?:(?:\r?\n|\r)\1.*)*/,
inside: {
'literal-block-punctuation': {
- pattern: /^(?:::|[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])/m,
+ pattern: /^(?:::|([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\1*)/m,
alias: 'punctuation'
}
}
},
+ 'list-bullet': {
+ pattern: /(^\s*)(?:[*+\-•‣⁃]|\(?(?:\d+|[a-z]|[ivxdclm]+)\)|(?:\d+|[a-z]|[ivxdclm]+)\.)(?= )/im,
+ lookbehind: true,
+ alias: 'punctuation'
+ },
'doctest-block': {
pattern: /(^\s*)>>> .+(?:(?:\r?\n|\r).+)*/m,
lookbehind: true,
@@ -185,10 +186,10 @@ Prism.languages.rest = {
}
},
{
- pattern: /(?:\b[a-z\d](?:[_.:+]?[a-z\d]+)?_?_|`[^`]+`_?_|_`[^`]+`)(?=[\s\-.,:;!?\\\/'")\]}]|$)/i,
+ pattern: /(?:\b[a-z\d](?:[_.:+]?[a-z\d]+)*_?_|`[^`]+`_?_|_`[^`]+`)(?=[\s\-.,:;!?\\\/'")\]}]|$)/i,
alias: 'string',
inside: {
- 'punctuation': /^_?`|`?_?_$/
+ 'punctuation': /^_?`|`$|`?_?_$/
}
}
],
« no previous file with comments | « lib/src/prism/components/prism-r.min.js ('k') | lib/src/prism/components/prism-rest.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698