diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index faf978a..954fef9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,6 +29,15 @@ jobs: - name: Generate documentation run: npm run generate-docs + - name: nojekyll + run: touch docs/.nojekyll + + - name: CNAME + run: echo "$CNAME" > docs/CNAME + if: env.CNAME != '' + env: + CNAME: ${{ vars.CNAME }} + - name: Push documentation uses: s0/git-publish-subdir-action@develop env: diff --git a/package-lock.json b/package-lock.json index a26a21f..fe7e654 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@thoughtsunificator/bbcode-parser", - "version": "1.0.7", + "version": "1.0.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@thoughtsunificator/bbcode-parser", - "version": "1.0.7", + "version": "1.0.8", "license": "MIT", "devDependencies": { "docdash": "^1.2.0", diff --git a/package.json b/package.json index 9172497..6d0cf9b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@thoughtsunificator/bbcode-parser", - "version": "1.0.7", + "version": "1.0.8", "main": "index.js", "scripts": { "test": "mocha test/**", diff --git a/src/bbdocument/treewalker.js b/src/bbdocument/treewalker.js index 7902034..04cf171 100644 --- a/src/bbdocument/treewalker.js +++ b/src/bbdocument/treewalker.js @@ -39,7 +39,9 @@ class TreeWalker { if(previousNode !== this._rootNode) { this._path.push(previousNode) } - } else if(this.currentNode.nextSibling !== null && !this._path.includes(this.currentNode.nextSibling)) { + } else if(this.currentNode.nextSibling !== null && + (this._rootBookmark === this.currentNode.parentNode || this._path.includes(this.currentNode.parentNode)) && + !this._path.includes(this.currentNode.nextSibling)) { this._path.push(this.currentNode.nextSibling) this._currentNode = this.currentNode.nextSibling } else { diff --git a/test/bbdocument/treewalker.test.js b/test/bbdocument/treewalker.test.js index 84084dd..3d11066 100644 --- a/test/bbdocument/treewalker.test.js +++ b/test/bbdocument/treewalker.test.js @@ -51,7 +51,6 @@ describe("treewalker", () => { assert.strictEqual(nodeList[13].textContent, "9") assert.strictEqual(nodeList[14].textContent, "Test") - }) it("nextNode_", () => { @@ -96,6 +95,20 @@ describe("treewalker", () => { }) + it("nextNode____", () => { + + const bbDocument = Parser.parse("[quote]1[quote][/quote][quote][/quote][/quote]") + + let treeWalker = new TreeWalker(bbDocument.documentElement.childNodes[0].childNodes[1]) + let nodeList = [] + while(treeWalker.nextNode()) { + nodeList.push(treeWalker.currentNode) + } + assert.strictEqual(nodeList.length, 0) + + + }) + it("nextNodeList", () => { const bbDocument = Parser.parse("[list][*]1[list][*]test[/list][*]2[*]3[*]4[/list]")