Skip to content

Commit 5fb8bc1

Browse files
Merge branch 'master' into web-idl
2 parents b40e710 + 3b2238f commit 5fb8bc1

337 files changed

Lines changed: 16828 additions & 2990 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

assets/download.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,9 @@
181181

182182
if ((!all[id].noCSS && !/\.js$/.test(filepath)) || /\.css$/.test(filepath)) {
183183
var cssFile = filepath.replace(/(\.css)?$/, '.css');
184+
var minCSSFile = cssFile.replace(/(?:\.css)$/, '.min.css');
184185

185-
info.files.minified.paths.push(cssFile);
186+
info.files.minified.paths.push(minCSSFile);
186187
info.files.dev.paths.push(cssFile);
187188
}
188189

assets/examples.js

Lines changed: 12 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -179,62 +179,22 @@
179179
language.examplesPromise.then(function (contents) {
180180
examples[id].innerHTML = buildContentsHeader(id) + contents;
181181

182-
loadLanguage(id).then(function () {
183-
Prism.highlightAllUnder(examples[id]);
182+
/** @type {HTMLElement} */
183+
var container = examples[id];
184+
container.innerHTML = buildContentsHeader(id) + contents;
185+
186+
// the current language might be an extension of a language
187+
// so to be safe, we explicitly add a dependency to the current language
188+
$$('pre', container).forEach(/** @param {HTMLElement} pre */function (pre) {
189+
var dependencies = (pre.getAttribute('data-dependencies') || '').trim();
190+
dependencies = dependencies ? dependencies + ',' + id : id;
191+
pre.setAttribute('data-dependencies', dependencies);
184192
});
193+
194+
Prism.highlightAllUnder(container);
185195
});
186196
} else {
187197
examples[id].innerHTML = '';
188198
}
189199
}
190-
191-
/**
192-
* Loads a language, including all dependencies
193-
*
194-
* @param {string} lang the language to load
195-
* @returns {Promise} the promise which resolves as soon as everything is loaded
196-
*/
197-
function loadLanguage(lang) {
198-
// at first we need to fetch all dependencies for the main language
199-
// Note: we need to do this, even if the main language already is loaded (just to be sure..)
200-
//
201-
// We load an array of all dependencies and call recursively this function on each entry
202-
//
203-
// dependencies is now an (possibly empty) array of loading-promises
204-
var dependencies = getDependenciesOfLanguage(lang).map(loadLanguage);
205-
206-
// We create a promise, which will resolve, as soon as all dependencies are loaded.
207-
// They need to be fully loaded because the main language may extend them.
208-
return Promise.all(dependencies)
209-
.then(function () {
210-
211-
// If the main language itself isn't already loaded, load it now
212-
// and return the newly created promise (we chain the promises).
213-
// If the language is already loaded, just do nothing - the next .then()
214-
// will immediately be called
215-
if (!Prism.languages[lang]) {
216-
return new Promise(function (resolve) {
217-
$u.script('components/prism-' + lang + '.js', resolve);
218-
});
219-
}
220-
});
221-
}
222-
223-
224-
/**
225-
* Returns all dependencies (as identifiers) of a specific language
226-
*
227-
* @param {string} lang
228-
* @returns {string[]} the list of dependencies. Empty if the language has none.
229-
*/
230-
function getDependenciesOfLanguage(lang) {
231-
if (!components.languages[lang] || !components.languages[lang].require) {
232-
return [];
233-
}
234-
235-
return ($u.type(components.languages[lang].require) === 'array')
236-
? components.languages[lang].require
237-
: [components.languages[lang].require];
238-
}
239-
240200
}());

components.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
"arduino": {
133133
"title": "Arduino",
134134
"require": "cpp",
135+
"alias": "ino",
135136
"owner": "dkern"
136137
},
137138
"arff": {
@@ -152,6 +153,10 @@
152153
"title": "6502 Assembly",
153154
"owner": "kzurawel"
154155
},
156+
"asmatmel": {
157+
"title": "Atmel AVR Assembly",
158+
"owner": "cerkit"
159+
},
155160
"autohotkey": {
156161
"title": "AutoHotkey",
157162
"owner": "aviaryan"

components/prism-actionscript.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Prism.languages.actionscript = Prism.languages.extend('javascript', {
44
});
55
Prism.languages.actionscript['class-name'].alias = 'function';
66

7+
// doesn't work with AS because AS is too complex
8+
delete Prism.languages.actionscript['parameter'];
9+
delete Prism.languages.actionscript['literal-property'];
10+
711
if (Prism.languages.markup) {
812
Prism.languages.insertBefore('actionscript', 'string', {
913
'xml': {

components/prism-actionscript.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/prism-arduino.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/prism-arduino.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/prism-asmatmel.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Prism.languages.asmatmel = {
2+
'comment': {
3+
pattern: /;.*/,
4+
greedy: true
5+
},
6+
'string': {
7+
pattern: /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/,
8+
greedy: true
9+
},
10+
11+
'constant': /\b(?:PORT[A-Z]|DDR[A-Z]|(?:DD|P)[A-Z](?:\d|[0-2]\d|3[0-1]))\b/,
12+
13+
'directive': {
14+
pattern: /\.\w+(?= )/,
15+
alias: 'property'
16+
},
17+
'r-register': {
18+
pattern: /\br(?:\d|[1-2]\d|3[0-1])\b/,
19+
alias: 'variable'
20+
},
21+
'op-code': {
22+
pattern: /\b(?:ADC|ADD|ADIW|AND|ANDI|ASR|BCLR|BLD|BRBC|BRBS|BRCC|BRCS|BREAK|BREQ|BRGE|BRHC|BRHS|BRID|BRIE|BRLO|BRLT|BRMI|BRNE|BRPL|BRSH|BRTC|BRTS|BRVC|BRVS|BSET|BST|CALL|CBI|CBR|CLC|CLH|CLI|CLN|CLR|CLS|CLT|CLV|CLZ|COM|CP|CPC|CPI|CPSE|DEC|DES|EICALL|EIJMP|ELPM|EOR|FMUL|FMULS|FMULSU|ICALL|IJMP|IN|INC|JMP|LAC|LAS|LAT|LD|LD[A-Za-z0-9]|LPM|LSL|LSR|MOV|MOVW|MUL|MULS|MULSU|NEG|NOP|OR|ORI|OUT|POP|PUSH|RCALL|RET|RETI|RJMP|ROL|ROR|SBC|SBCI|SBI|SBIC|SBIS|SBIW|SBR|SBRC|SBRS|SEC|SEH|SEI|SEN|SER|SES|SET|SEV|SEZ|SLEEP|SPM|ST|ST[A-Z0-9]|SUB|SUBI|SWAP|TST|WDR|XCH|adc|add|adiw|and|andi|asr|bclr|bld|brbc|brbs|brcc|brcs|break|breq|brge|brhc|brhs|brid|brie|brlo|brlt|brmi|brne|brpl|brsh|brtc|brts|brvc|brvs|bset|bst|call|cbi|cbr|clc|clh|cli|cln|clr|cls|clt|clv|clz|com|cp|cpc|cpi|cpse|dec|des|eicall|eijmp|elpm|eor|fmul|fmuls|fmulsu|icall|ijmp|in|inc|jmp|lac|las|lat|ld|ld[a-z0-9]|lpm|lsl|lsr|mov|movw|mul|muls|mulsu|neg|nop|or|ori|out|pop|push|rcall|ret|reti|rjmp|rol|ror|sbc|sbci|sbi|sbic|sbis|sbiw|sbr|sbrc|sbrs|sec|seh|sei|sen|ser|ses|set|sev|sez|sleep|spm|st|st[a-zA-Z0-9]|sub|subi|swap|tst|wdr|xch)\b/,
23+
alias: 'keyword'
24+
},
25+
'hex-number': {
26+
pattern: /#?\$[\da-f]{2,4}\b/i,
27+
alias: 'number'
28+
},
29+
'binary-number': {
30+
pattern: /#?%[01]+\b/,
31+
alias: 'number'
32+
},
33+
'decimal-number': {
34+
pattern: /#?\b\d+\b/,
35+
alias: 'number'
36+
},
37+
'register': {
38+
pattern: /\b[acznvshtixy]\b/i,
39+
alias: 'variable'
40+
},
41+
'operator': />>=?|<<=?|&&?|\|\|?|[-+*/%&|^!=<>?]=?/,
42+
'punctuation': /[(),:]/
43+
};

0 commit comments

Comments
 (0)