Skip to content

Commit

Permalink
Merge branch 'master' into strict-languages-extend-checks
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Dec 22, 2020
2 parents ed5b754 + 7f23ef3 commit a6a87a5
Show file tree
Hide file tree
Showing 63 changed files with 1,572 additions and 849 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/danger.yml
@@ -1,8 +1,7 @@
name: Danger

on:
pull_request:
branches: [ master ]
on:
pull_request_target:

jobs:
run:
Expand All @@ -13,6 +12,11 @@ jobs:
- uses: actions/checkout@v1
with:
fetch-depth: 0
# create a new branch called pr from the remote PR branch
- run: git remote add pr_repo $PR_URL && git fetch pr_repo $PR_REF && git branch pr pr_repo/$PR_REF
env:
PR_URL: ${{github.event.pull_request.head.repo.clone_url}}
PR_REF: ${{github.event.pull_request.head.ref}}
- run: npm ci
- name: Danger
run: npx danger ci
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -29,4 +29,4 @@ Thank you so much for contributing!!

## Translations

* [![中文说明](http://awesomes.oss-cn-beijing.aliyuncs.com/readme.png)](https://www.awesomes.cn/repo/PrismJS/prism)
* [简体中文](https://www.awesomes.cn/repo/PrismJS/prism) (temporarily unavailable; see copy [here](https://deepmind.t-salon.cc/article/113))
10 changes: 4 additions & 6 deletions assets/style.css
Expand Up @@ -75,11 +75,13 @@ p {
}

section h1,
h2 {
h2,
h3 {
margin: 1em 0 .3em;
}

h2 {
h2,
h3 {
font-weight: normal;
}

Expand Down Expand Up @@ -141,10 +143,6 @@ footer:before {
background-repeat: repeat-x;
background-image: linear-gradient(45deg, transparent 34%, white 34%, white 66%, transparent 66%),
linear-gradient(135deg, transparent 34%, white 34%, white 66%, transparent 66%);
}

header {

}

header .intro,
Expand Down
2 changes: 1 addition & 1 deletion assets/templates/header-main.html
Expand Up @@ -4,7 +4,7 @@ <h1><a href="index.html"><img src="assets/logo.svg" alt="Prism" /></a></h1>

<p>
Prism is a lightweight, extensible syntax highlighter, built with modern web standards in mind.
It’s used in thousands of websites, including some of those you visit daily.
It’s used in millions of websites, including some of those you visit daily.
</p>

<!--<a href="https://twitter.com/share" class="twitter-share-button" data-via="prismjs" data-size="large" data-related="LeaVerou">Tweet</a>
Expand Down
2 changes: 1 addition & 1 deletion components.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions components.json
Expand Up @@ -290,6 +290,10 @@
"require": "clike",
"owner": "Golmote"
},
"dataweave": {
"title": "DataWeave",
"owner": "machaval"
},
"dax": {
"title": "DAX",
"owner": "peterbud"
Expand Down Expand Up @@ -703,6 +707,7 @@
"markdown": {
"title": "Markdown",
"require": "markup",
"optional": "yaml",
"alias": "md",
"owner": "Golmote"
},
Expand Down
50 changes: 30 additions & 20 deletions components/prism-core.js
Expand Up @@ -823,6 +823,25 @@ Token.stringify = function stringify(o, language) {
return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
};

/**
* @param {RegExp} pattern
* @param {number} pos
* @param {string} text
* @param {boolean} lookbehind
* @returns {RegExpExecArray | null}
*/
function matchPattern(pattern, pos, text, lookbehind) {
pattern.lastIndex = pos;
var match = pattern.exec(text);
if (match && lookbehind && match[1]) {
// change the match to remove the text matched by the Prism lookbehind group
var lookbehindLength = match[1].length;
match.index += lookbehindLength;
match[0] = match[0].slice(lookbehindLength);
}
return match;
}

/**
* @param {string} text
* @param {LinkedList<string | Token>} tokenList
Expand Down Expand Up @@ -855,7 +874,6 @@ function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
inside = patternObj.inside,
lookbehind = !!patternObj.lookbehind,
greedy = !!patternObj.greedy,
lookbehindLength = 0,
alias = patternObj.alias;

if (greedy && !patternObj.pattern.global) {
Expand Down Expand Up @@ -889,15 +907,15 @@ function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
}

var removeCount = 1; // this is the to parameter of removeBetween
var match;

if (greedy && currentNode != tokenList.tail.prev) {
pattern.lastIndex = pos;
var match = pattern.exec(text);
if (greedy) {
match = matchPattern(pattern, pos, text, lookbehind);
if (!match) {
break;
}

var from = match.index + (lookbehind && match[1] ? match[1].length : 0);
var from = match.index;
var to = match.index + match[0].length;
var p = pos;

Expand Down Expand Up @@ -931,24 +949,16 @@ function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
str = text.slice(pos, p);
match.index -= pos;
} else {
pattern.lastIndex = 0;

var match = pattern.exec(str);
}

if (!match) {
continue;
}

if (lookbehind) {
lookbehindLength = match[1] ? match[1].length : 0;
match = matchPattern(pattern, 0, str, lookbehind);
if (!match) {
continue;
}
}

var from = match.index + lookbehindLength,
matchStr = match[0].slice(lookbehindLength),
to = from + matchStr.length,
var from = match.index,
matchStr = match[0],
before = str.slice(0, from),
after = str.slice(to);
after = str.slice(from + matchStr.length);

var reach = pos + str.length;
if (rematch && reach > rematch.reach) {
Expand Down
2 changes: 1 addition & 1 deletion components/prism-core.min.js

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

0 comments on commit a6a87a5

Please sign in to comment.