diff --git a/.run/Debug.run.xml b/.run/Debug.run.xml new file mode 100644 index 0000000..2e6f8e6 --- /dev/null +++ b/.run/Debug.run.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/bbcode/core.ts b/bbcode/core.ts index 921edc7..8d134a0 100644 --- a/bbcode/core.ts +++ b/bbcode/core.ts @@ -27,8 +27,11 @@ export function analyzeUrlTag(parser: BBCodeParser, param: string, content: stri if(param.length > 0) { url = param.trim(); if(content.length === 0) textContent = param; - } else if(content.length > 0) url = content; - else { + } else if(content.length > 0) { + const m = content.match(/^\[url=?](.+)\[\/url]$/i); + + url = m ? m[1] : content; + } else { parser.warning('url tag contains no url.'); textContent = ''; success = false; diff --git a/bbcode/parser.ts b/bbcode/parser.ts index 8b9322f..aeb2320 100644 --- a/bbcode/parser.ts +++ b/bbcode/parser.ts @@ -128,6 +128,10 @@ export class BBCodeParser { currentTag = this._currentTag = {tag: self.tag, line: this._line, column: this._column}; } let tagStart = -1, paramStart = -1, mark = start; + + // @ts-ignore + let depth = 0; + for(let i = start; i < input.length; ++i) { const c = input[i]; ++this._column; @@ -136,64 +140,83 @@ export class BBCodeParser { this._column = 1; } if(c === '[') { - tagStart = i; - paramStart = -1; - } else if(c === '=' && paramStart === -1) - paramStart = i; - else if(c === ']') { - const paramIndex = paramStart === -1 ? i : paramStart; - let tagKey = input.substring(tagStart + 1, paramIndex).trim().toLowerCase(); - if(tagKey.length === 0) { - tagStart = -1; - continue; + depth++; + + if (depth === 1) { + tagStart = i; + paramStart = -1; + } else { + console.log('Hit depth tagOpen', depth); } - const param = paramStart > tagStart ? input.substring(paramStart + 1, i).trim() : ''; - const close = tagKey[0] === '/'; - if(close) tagKey = tagKey.substr(1).trim(); - if(this._tags[tagKey] === undefined) { - tagStart = -1; - continue; + } else if(c === '=' && paramStart === -1) { + if (depth <= 1) { + paramStart = i; + } else { + console.log('Hit depth paramStart', depth); } - if(!close) { - const tag = this._tags[tagKey]!; - const allowed = isAllowed(tagKey); - if(parent !== undefined) { - parent.appendChild(document.createTextNode(input.substring(mark, allowed ? tagStart : i + 1))); - mark = i + 1; - } - if(!allowed || parent === undefined) { - i = this.parse(input, i + 1, tag, parent, isAllowed); - mark = i + 1; + } else if(c === ']') { + depth--; + + if (depth !== 0) { + console.log('Hit depth tagClose', depth); + } + + if (depth === 0) { + const paramIndex = paramStart === -1 ? i : paramStart; + let tagKey = input.substring(tagStart + 1, paramIndex).trim().toLowerCase(); + if(tagKey.length === 0) { + tagStart = -1; continue; } - let element: HTMLElement | undefined; - if(tag instanceof BBCodeTextTag) { - i = this.parse(input, i + 1, tag, undefined, isAllowed); - element = tag.createElement(this, parent, param, input.substring(mark, input.lastIndexOf('[', i))); - if(element === undefined) parent.appendChild(document.createTextNode(input.substring(tagStart, i + 1))); - } else { - element = tag.createElement(this, parent, param, ''); - if(element === undefined) parent.appendChild(document.createTextNode(input.substring(tagStart, i + 1))); - if(!tag.noClosingTag) - i = this.parse(input, i + 1, tag, element !== undefined ? element : parent, isAllowed); - if(element === undefined) - parent.appendChild(document.createTextNode(input.substring(input.lastIndexOf('[', i), i + 1))); + const param = paramStart > tagStart ? input.substring(paramStart + 1, i).trim() : ''; + const close = tagKey[0] === '/'; + if(close) tagKey = tagKey.substr(1).trim(); + if(this._tags[tagKey] === undefined) { + tagStart = -1; + continue; } - mark = i + 1; - this._currentTag = currentTag; - if(element === undefined) continue; - (element).bbcodeTag = tagKey; - if(param.length > 0) (element).bbcodeParam = param; - } else if(self !== undefined) { //tslint:disable-line:curly - if(self.tag === tagKey) { - if(parent !== undefined) - parent.appendChild(document.createTextNode(input.substring(mark, selfAllowed ? tagStart : i + 1))); - return i; - } - if(!selfAllowed) return mark - 1; - if(isAllowed(tagKey)) - this.warning(`Unexpected closing ${tagKey} tag. Needed ${self.tag} tag instead.`); - } else if(isAllowed(tagKey)) this.warning(`Found closing ${tagKey} tag that was never opened.`); + if(!close) { + const tag = this._tags[tagKey]!; + const allowed = isAllowed(tagKey); + if(parent !== undefined) { + parent.appendChild(document.createTextNode(input.substring(mark, allowed ? tagStart : i + 1))); + mark = i + 1; + } + if(!allowed || parent === undefined) { + i = this.parse(input, i + 1, tag, parent, isAllowed); + + mark = i + 1; + continue; + } + let element: HTMLElement | undefined; + if(tag instanceof BBCodeTextTag) { + i = this.parse(input, i + 1, tag, undefined, isAllowed); + element = tag.createElement(this, parent, param, input.substring(mark, input.lastIndexOf('[', i))); + if(element === undefined) parent.appendChild(document.createTextNode(input.substring(tagStart, i + 1))); + } else { + element = tag.createElement(this, parent, param, ''); + if(element === undefined) parent.appendChild(document.createTextNode(input.substring(tagStart, i + 1))); + if(!tag.noClosingTag) + i = this.parse(input, i + 1, tag, element !== undefined ? element : parent, isAllowed); + if(element === undefined) + parent.appendChild(document.createTextNode(input.substring(input.lastIndexOf('[', i), i + 1))); + } + mark = i + 1; + this._currentTag = currentTag; + if(element === undefined) continue; + (element).bbcodeTag = tagKey; + if(param.length > 0) (element).bbcodeParam = param; + } else if(self !== undefined) { //tslint:disable-line:curly + if(self.tag === tagKey) { + if(parent !== undefined) + parent.appendChild(document.createTextNode(input.substring(mark, selfAllowed ? tagStart : i + 1))); + return i; + } + if(!selfAllowed) return mark - 1; + if(isAllowed(tagKey)) + this.warning(`Unexpected closing ${tagKey} tag. Needed ${self.tag} tag instead.`); + } else if(isAllowed(tagKey)) this.warning(`Found closing ${tagKey} tag that was never opened.`); + } } } if(mark < input.length && parent !== undefined) { diff --git a/docs/_layouts/rising.html b/docs/_layouts/rising.html index ce7d5d4..cab0e14 100644 --- a/docs/_layouts/rising.html +++ b/docs/_layouts/rising.html @@ -8,47 +8,74 @@ + + {% seo %} @@ -57,17 +84,24 @@
- {% if site.github.is_project_page %} - View on GitHub - {% endif %} + View on GitHub

{{ site.title | default: site.github.repository_name }}

{{ site.description | default: site.github.project_tagline }}

{% if site.show_downloads %}
- Download for Windows - Download for MacOS +

Downloads

+ + + +
{% endif %}
diff --git a/docs/index.md b/docs/index.md index 3f37d0b..0ea6f3e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,14 +2,6 @@ layout: rising --- -# Download Now! - -F-Chat Rising v1 - -[Windows](https://github.com/mrstallion/flist-rising/releases/download/v3.0.13-rising-v1/F-Chat.Rising.Setup.exe) (72 MB) - -[MacOS](https://github.com/mrstallion/flist-rising/releases/download/v3.0.13-rising-v1/F-Chat.Rising.dmg) (68 MB) - # Features diff --git a/docs/summary.psd b/docs/summary.psd index 808691c..89a0734 100644 Binary files a/docs/summary.psd and b/docs/summary.psd differ diff --git a/electron/index.html b/electron/index.html index b5d7a50..ced0b62 100644 --- a/electron/index.html +++ b/electron/index.html @@ -2,7 +2,7 @@ - + F-Chat diff --git a/electron/package.json b/electron/package.json index 97448b1..b43fbda 100644 --- a/electron/package.json +++ b/electron/package.json @@ -11,6 +11,8 @@ "build:dist": "node ../webpack production", "watch": "node ../webpack watch", "start": "../node_modules/.bin/electron app", + "startDebugMain": "../node_modules/.bin/electron --serve --inspect-brk=9229 app", + "startDebugRender": "../node_modules/.bin/electron --remote-debugging-port=9229 app", "pack": "node ./pack" } } diff --git a/electron/webpack.config.js b/electron/webpack.config.js index 8bba5aa..190880b 100644 --- a/electron/webpack.config.js +++ b/electron/webpack.config.js @@ -130,7 +130,10 @@ module.exports = function(mode) { mainConfig.devtool = rendererConfig.devtool = 'source-map'; rendererConfig.plugins.push(new OptimizeCssAssetsPlugin()); } else { - mainConfig.devtool = rendererConfig.devtool = 'none'; + // mainConfig.devtool = rendererConfig.devtool = 'none'; + + mainConfig.devtool = 'inline-source-map'; + rendererConfig.devtool = 'inline-source-map'; } return [mainConfig, rendererConfig]; }; diff --git a/electron/window.html b/electron/window.html index f4ac2d2..ea63fdc 100644 --- a/electron/window.html +++ b/electron/window.html @@ -2,7 +2,7 @@ - + F-Chat @@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/webpack.js b/webpack.js index 65a7498..f6e63cf 100644 --- a/webpack.js +++ b/webpack.js @@ -24,6 +24,8 @@ function compilerCallback(err, stats) { if(mode !== 'watch' && stats.hasErrors()) process.exitCode = 2; } +console.log(config); + const compiler = webpack(config); if(mode === 'watch') compiler.watch({}, compilerCallback); -else compiler.run(compilerCallback); \ No newline at end of file +else compiler.run(compilerCallback);