[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
1 function parse() 2 { 3 var pos = text.indexOf(' > 0) 9 { 10 parseInlineImages(); 11 } 12 if (hasReferences) 13 { 14 parseReferenceImages(); 15 } 16 } 17 18 /** 19 * Add an image tag for given text span 20 * 21 * @param {number} startPos Start tag position 22 * @param {number} endPos End tag position 23 * @param {number} endLen End tag length 24 * @param {string} linkInfo URL optionally followed by space and a title 25 * @param {string} alt Value for the alt attribute 26 */ 27 function addImageTag(startPos, endPos, endLen, linkInfo, alt) 28 { 29 var tag = addTagPair('IMG', startPos, 2, endPos, endLen); 30 setLinkAttributes(tag, linkInfo, 'src'); 31 tag.setAttribute('alt', decode(alt)); 32 33 // Overwrite the markup 34 overwrite(startPos, endPos + endLen - startPos); 35 } 36 37 /** 38 * Parse inline images markup 39 */ 40 function parseInlineImages() 41 { 42 var m, regexp = /!\[(?:[^\x17[\]]|\[[^\x17[\]]*\])*\]\(( *(?:[^\x17\s()]|\([^\x17\s()]*\))*(?=[ )]) *(?:"[^\x17]*?"|'[^\x17]*?'|\([^\x17)]*\))? *)\)/g; 43 while (m = regexp.exec(text)) 44 { 45 var linkInfo = m[1], 46 startPos = m.index, 47 endLen = 3 + linkInfo.length, 48 endPos = startPos + m[0].length - endLen, 49 alt = m[0].substring(2, m[0].length - endLen); 50 51 addImageTag(startPos, endPos, endLen, linkInfo, alt); 52 } 53 } 54 55 /** 56 * Parse reference images markup 57 */ 58 function parseReferenceImages() 59 { 60 var m, regexp = /!\[((?:[^\x17[\]]|\[[^\x17[\]]*\])*)\](?: ?\[([^\x17[\]]+)\])?/g; 61 while (m = regexp.exec(text)) 62 { 63 var startPos = m.index, 64 endPos = startPos + 2 + m[1].length, 65 endLen = 1, 66 alt = m[1], 67 id = alt; 68 69 if (m[2] > '' && linkReferences[m[2]]) 70 { 71 endLen = m[0].length - alt.length - 2; 72 id = m[2]; 73 } 74 else if (!linkReferences[id]) 75 { 76 continue; 77 } 78 79 addImageTag(startPos, endPos, endLen, linkReferences[id], alt); 80 } 81 }
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 |