Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
ParsedText.js
001 /**
002 * @type {boolean} Whether to decode HTML entities when decoding text
003 */
004 var decodeHtmlEntities = config.decodeHtmlEntities;
005
006 /**
007 * @type {boolean} Whether text contains escape characters
008 */
009 var hasEscapedChars = false;
010
011 /**
012 * @type {boolean} Whether text contains link references
013 */
014 var hasReferences = false;
015
016 /**
017 * @dict
018 */
019 var linkReferences = {};
020
021 if (text.indexOf('\\') >= 0)
022 {
023 hasEscapedChars = true;
024
025 // Encode escaped literals that have a special meaning otherwise, so that we don't have
026 // to take them into account in regexps
027 text = text.replace(
028 /\\[!"'()*<>[\\\]^_`~]/g,
029 function (str)
030 {
031 return {
032 '\\!': "\x1B0", '\\"' : "\x1B1", "\\'": "\x1B2", '\\(': "\x1B3",
033 '\\)': "\x1B4", '\\*' : "\x1B5", '\\<': "\x1B6", '\\>': "\x1B7",
034 '\\[': "\x1B8", '\\\\': "\x1B9", '\\]': "\x1BA", '\\^': "\x1BB",
035 '\\_': "\x1BC", '\\`' : "\x1BD", '\\~': "\x1BE"
036 }[str];
037 }
038 );
039 }
040
041 // We append a couple of lines and a non-whitespace character at the end of the text in
042 // order to trigger the closure of all open blocks such as quotes and lists
043 text += "\n\n\x17";
044
045 /**
046 * Decode a chunk of encoded text to be used as an attribute value
047 *
048 * Decodes escaped literals and removes slashes and 0x1A characters
049 *
050 * @param {string} str Encoded text
051 * @return {string} Decoded text
052 */
053 function decode(str)
054 {
055 if (HINT.LITEDOWN_DECODE_HTML_ENTITIES && decodeHtmlEntities && str.indexOf('&') > -1)
056 {
057 str = html_entity_decode(str);
058 }
059 str = str.replace(/\x1A/g, '');
060
061 if (hasEscapedChars)
062 {
063 str = str.replace(
064 /\x1B./g,
065 function (seq)
066 {
067 return {
068 "\x1B0": '!', "\x1B1": '"', "\x1B2": "'", "\x1B3": '(',
069 "\x1B4": ')', "\x1B5": '*', "\x1B6": '<', "\x1B7": '>',
070 "\x1B8": '[', "\x1B9": '\\', "\x1BA": ']', "\x1BB": '^',
071 "\x1BC": '_', "\x1BD": '`', "\x1BE": '~'
072 }[seq];
073 }
074 );
075 }
076
077 return str;
078 }
079
080 /**
081 * Test whether given position is preceded by whitespace
082 *
083 * @param {number} pos
084 * @return {boolean}
085 */
086 function isAfterWhitespace(pos)
087 {
088 return (pos > 0 && isWhitespace(text.charAt(pos - 1)));
089 }
090
091 /**
092 * Test whether given character is alphanumeric
093 *
094 * @param {string} chr
095 * @return {boolean}
096 */
097 function isAlnum(chr)
098 {
099 return (' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.indexOf(chr) > 0);
100 }
101
102 /**
103 * Test whether given position is followed by whitespace
104 *
105 * @param {number} pos
106 * @return {boolean}
107 */
108 function isBeforeWhitespace(pos)
109 {
110 return isWhitespace(text[pos + 1]);
111 }
112
113 /**
114 * Test whether a length of text is surrounded by alphanumeric characters
115 *
116 * @param {number} pos Start of the text
117 * @param {number} len Length of the text
118 * @return {boolean}
119 */
120 function isSurroundedByAlnum(pos, len)
121 {
122 return (pos > 0 && isAlnum(text[pos - 1]) && isAlnum(text[pos + len]));
123 }
124
125 /**
126 * Test whether given character is an ASCII whitespace character
127 *
128 * NOTE: newlines are normalized to LF before parsing so we don't have to check for CR
129 *
130 * @param {string} chr
131 * @return {boolean}
132 */
133 function isWhitespace(chr)
134 {
135 return (" \n\t".indexOf(chr) > -1);
136 }
137
138 /**
139 * Mark the boundary of a block in the original text
140 *
141 * @param {number} pos
142 */
143 function markBoundary(pos)
144 {
145 text = text.substring(0, pos) + "\x17" + text.substring(pos + 1);
146 }
147
148 /**
149 * Overwrite part of the text with substitution characters ^Z (0x1A)
150 *
151 * @param {number} pos Start of the range
152 * @param {number} len Length of text to overwrite
153 */
154 function overwrite(pos, len)
155 {
156 if (len > 0)
157 {
158 text = text.substring(0, pos) + new Array(1 + len).join("\x1A") + text.substring(pos + len);
159 }
160 }