Skip to content

Commit

Permalink
🐛 Protyle table parsing issue siyuan-note/siyuan#13004
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Nov 3, 2024
1 parent bfc8800 commit a8a9e2f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion javascript/lute.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion javascript/lute.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion parse/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (context *Context) parseTable(paragraph *ast.Node) (retParagraph, retTable
if context.ParseOption.ProtyleWYSIWYG {
lines := lex.Split(paragraph.Tokens, lex.ItemNewline)
delimRowIndex := context.findTableDelimRow(lines)
if -1 == delimRowIndex {
if 1 > delimRowIndex {
return
}

Expand Down
1 change: 1 addition & 0 deletions test/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

var debugTests = []parseTest{

{"76", ":\n0", "<p>:<br />\n0</p>\n"},
{"75", "[foo](bar.com(baz) \"bar.com(baz)\")", "<p><a href=\"bar.com(baz)\" title=\"bar.com(baz)\">foo</a></p>\n"},
{"74", "https://foo.com:443/bar/baz", "<p><a href=\"https://foo.com:443/bar/baz\">https://foo.com:443/bar/baz</a></p>\n"},
{"73", "| $foo\\\\\\|bar$ |\n| - |", "<table>\n<thead>\n<tr>\n<th><span class=\"language-math\">foo\\\\|bar</span></th>\n</tr>\n</thead>\n</table>\n"},
Expand Down
1 change: 1 addition & 0 deletions test/spin_block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

var spinBlockDOMTests = []*parseTest{

{"231", "<div data-node-id=\"20241103085149-shu8xzh\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20241103085157\"><div contenteditable=\"true\" spellcheck=\"false\">:\n1<wbr></div><div class=\"protyle-attr\" contenteditable=\"false\">​</div></div>", "<div data-node-id=\"20241103085149-shu8xzh\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20241103085157\"><div contenteditable=\"true\" spellcheck=\"false\">:\n1<wbr></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"230", "<div data-node-id=\"20240929215806-kilt4j6\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240929215857\"><div contenteditable=\"true\" spellcheck=\"false\">​<span data-type=\"tag\">​Android</span>​<wbr><span data-type=\"tag\">​Linux</span>​</div><div class=\"protyle-attr\" contenteditable=\"false\">​</div></div>", "<div data-node-id=\"20240929215806-kilt4j6\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240929215857\"><div contenteditable=\"true\" spellcheck=\"false\">\u200b<span data-type=\"tag\">\u200bAndroid<wbr>Linux</span>\u200b</div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"229", "<div data-node-id=\"20240911224355-fpf8ug5\" data-node-index=\"2\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240912103926\"><div contenteditable=\"true\" spellcheck=\"false\"><span data-type=\"strong em\">foo</span><span data-type=\"em\">\n\tbar</span></div><div class=\"protyle-attr\" contenteditable=\"false\">​</div></div>", "<div data-node-id=\"20240911224355-fpf8ug5\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20240912103926\"><div contenteditable=\"true\" spellcheck=\"false\"><span data-type=\"strong em\">foo</span>\n\t<span data-type=\"em\">bar</span></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
{"228", "<div data-node-id=\"20240812173920-h0oe4mx\" data-node-index=\"0\" data-type=\"NodeCodeBlock\" class=\"code-block\" linenumber=\"true\" style=\"line-height: 22px;\" updated=\"20240815112455\"><div class=\"protyle-action\"><span class=\"protyle-action--first protyle-action__language\" contenteditable=\"false\"></span><span class=\"fn__flex-1\"></span><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--first protyle-action__copy\" aria-label=\"复制\"><svg><use xlink:href=\"#iconCopy\"></use></svg></span><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--last protyle-action__menu\" aria-label=\"更多\"><svg><use xlink:href=\"#iconMore\"></use></svg></span></div><div class=\"hljs protyle-linenumber\" spellcheck=\"false\" data-render=\"true\" style=\"white-space: pre-wrap; word-break: break-word; font-variant-ligatures: normal;\"><div class=\"protyle-linenumber__rows\"><span style=\"height:22px;\"></span></div><div style=\"flex: 1\">foo\n</div></div><div class=\"protyle-attr\" contenteditable=\"false\">&ZeroWidthSpace;</div></div>", "<div data-node-id=\"20240812173920-h0oe4mx\" data-node-index=\"1\" data-type=\"NodeCodeBlock\" class=\"code-block\" style=\"line-height: 22px;\" updated=\"20240815112455\" linenumber=\"true\"><div class=\"protyle-action\"><span class=\"protyle-action--first protyle-action__language\" contenteditable=\"false\"></span><span class=\"fn__flex-1\"></span><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--first protyle-action__copy\"><svg><use xlink:href=\"#iconCopy\"></use></svg></span><span class=\"b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--last protyle-action__menu\"><svg><use xlink:href=\"#iconMore\"></use></svg></span></div><div class=\"hljs\"><div></div><div contenteditable=\"true\" style=\"flex: 1\" spellcheck=\"false\">foo\n</div></div><div class=\"protyle-attr\" contenteditable=\"false\">\u200b</div></div>"},
Expand Down

0 comments on commit a8a9e2f

Please sign in to comment.