[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
1 /** 2 * @param {string} tagName Name of the tag used by this pass 3 * @param {string} syntaxChar Relevant character used by this syntax 4 * @param {!RegExp} shortRegexp Regexp used for the short form syntax 5 * @param {!RegExp} longRegexp Regexp used for the long form syntax 6 */ 7 function parseAbstractScript(tagName, syntaxChar, shortRegexp, longRegexp) 8 { 9 var pos = text.indexOf(syntaxChar); 10 if (pos === -1) 11 { 12 return; 13 } 14 15 parseShortForm(pos); 16 parseLongForm(pos); 17 18 /** 19 * Parse the long form x^(x) 20 * 21 * This syntax is supported by RDiscount 22 * 23 * @param {number} pos Position of the first relevant character 24 */ 25 function parseLongForm(pos) 26 { 27 pos = text.indexOf(syntaxChar + '(', pos); 28 if (pos === -1) 29 { 30 return; 31 } 32 33 var m, regexp = longRegexp; 34 regexp.lastIndex = pos; 35 while (m = regexp.exec(text)) 36 { 37 var match = m[0], 38 matchPos = m.index, 39 matchLen = match.length; 40 41 addTagPair(tagName, matchPos, 2, matchPos + matchLen - 1, 1); 42 overwrite(matchPos, matchLen); 43 } 44 if (match) 45 { 46 parseLongForm(pos); 47 } 48 } 49 50 /** 51 * Parse the short form x^x and x^x^ 52 * 53 * This syntax is supported by most implementations that support superscript 54 * 55 * @param {number} pos Position of the first relevant character 56 */ 57 function parseShortForm(pos) 58 { 59 var m, regexp = shortRegexp; 60 regexp.lastIndex = pos; 61 while (m = regexp.exec(text)) 62 { 63 var match = m[0], 64 matchPos = m.index, 65 matchLen = match.length, 66 startPos = matchPos, 67 endLen = (match.charAt(matchLen - 1) === syntaxChar) ? 1 : 0, 68 endPos = matchPos + matchLen - endLen; 69 70 addTagPair(tagName, startPos, 1, endPos, endLen); 71 } 72 } 73 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |