Skip to content

Commit

Permalink
Merge remote-tracking branch 'PrismJS/gh-pages' into gh-pages
Browse files Browse the repository at this point in the history
* PrismJS/gh-pages:
  Autoloader plugin: don't try to load "none" component. Fix PrismJS#1000
  Optimized block regexps to prevent struggling on large files. Fixes
PrismJS#1001
  Revert PrismJS#998 + run normalize-whitespace and remove-initial-line-feed
plugins in the before-sanity-check hook. Fix PrismJS#1018 (see issue for
discussion)
  Run gulp

# Conflicts:
#	plugins/autoloader/prism-autoloader.min.js
  • Loading branch information
thesave committed Sep 2, 2016
2 parents bfd007d + f89b0b9 commit f4b1bc2
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 16 deletions.
8 changes: 4 additions & 4 deletions components/prism-asciidoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
};
Prism.languages.asciidoc = {
'comment-block': {
pattern: /^(\/{4,})(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?\1/m,
pattern: /^(\/{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1/m,
alias: 'comment'
},
'table': {
Expand All @@ -46,23 +46,23 @@
},

'passthrough-block': {
pattern: /^(\+{4,})(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?\1$/m,
pattern: /^(\+{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,
inside: {
'punctuation': /^\++|\++$/
// See rest below
}
},
// Literal blocks and listing blocks
'literal-block': {
pattern: /^(-{4,}|\.{4,})(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?\1$/m,
pattern: /^(-{4,}|\.{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,
inside: {
'punctuation': /^(?:-+|\.+)|(?:-+|\.+)$/
// See rest below
}
},
// Sidebar blocks, quote blocks, example blocks and open blocks
'other-block': {
pattern: /^(--|\*{4,}|_{4,}|={4,})(?:\r?\n|\r)(?:.*(?:\r?\n|\r))*?\1$/m,
pattern: /^(--|\*{4,}|_{4,}|={4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,
inside: {
'punctuation': /^(?:-+|\*+|_+|=+)|(?:-+|\*+|_+|=+)$/
// See rest below
Expand Down
2 changes: 1 addition & 1 deletion components/prism-asciidoc.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions components/prism-handlebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,22 @@

env.tokenStack = [];

env.backupCode = env.code;
env.code = env.code.replace(handlebars_pattern, function(match) {
env.tokenStack.push(match);

return '___HANDLEBARS' + env.tokenStack.length + '___';
});
});

// Restore env.code for other plugins (e.g. line-numbers)
Prism.hooks.add('before-insert', function(env) {
if (env.language === 'handlebars') {
env.code = env.backupCode;
delete env.backupCode;
}
});

// Re-insert the tokens after highlighting
// and highlight them with defined grammar
Prism.hooks.add('after-highlight', function(env) {
Expand Down
2 changes: 1 addition & 1 deletion components/prism-handlebars.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/prism-markup.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions components/prism-php.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,22 @@ if (Prism.languages.markup) {

env.tokenStack = [];

env.backupCode = env.code;
env.code = env.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/ig, function(match) {
env.tokenStack.push(match);

return '{{{PHP' + env.tokenStack.length + '}}}';
});
});

// Restore env.code for other plugins (e.g. line-numbers)
Prism.hooks.add('before-insert', function(env) {
if (env.language === 'php') {
env.code = env.backupCode;
delete env.backupCode;
}
});

// Re-insert the tokens after highlighting
Prism.hooks.add('after-highlight', function(env) {
if (env.language !== 'php') {
Expand Down
Loading

0 comments on commit f4b1bc2

Please sign in to comment.