Loading md_to_docx_converter/md_to_html_2.lua +12 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,10 @@ function Substitute(el, word) local startIndex, endIndex, number = textWithoutWord:gsub("‑", "-"):find(pattern) --check if number is in the same Str elem if not number then startIndex, endIndex, number = textWithoutWord:gsub("‑", "-"):find(annexPattern) --check if number is in the same Str elem if number and elem.text:sub(1, 1):match("%a") and elem.text:sub(2,2):match("%a") then --this is not a clause number, it is something else number = nil end end if not precedentChar:match("~") then if number then --create link Loading @@ -90,6 +94,10 @@ function Substitute(el, word) number = succ.text:gsub("‑", "-"):match(pattern) if not number then number = succ.text:gsub("‑", "-"):match(annexPattern) if number and succ.text:sub(1, 1):match("%a") and succ.text:sub(2,2):match("%a") then --this is not a clause number, it is something else number = nil end end if succ.t == "Str" and number then --we continue searching local succ_succ = el.content Loading Loading @@ -181,6 +189,10 @@ function MultipleClauses(el) if number == nil then --check if it is an annex clause number startIndex, endIndex, number = elem.text:find(annexPattern) if number and elem.text:sub(1, 1):match("%a") and elem.text:sub(2,2):match("%a") then --this is not a clause number, it is something else number = nil end end if elem.text:match("^,$") or elem.text:match("and") then Loading Loading
md_to_docx_converter/md_to_html_2.lua +12 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,10 @@ function Substitute(el, word) local startIndex, endIndex, number = textWithoutWord:gsub("‑", "-"):find(pattern) --check if number is in the same Str elem if not number then startIndex, endIndex, number = textWithoutWord:gsub("‑", "-"):find(annexPattern) --check if number is in the same Str elem if number and elem.text:sub(1, 1):match("%a") and elem.text:sub(2,2):match("%a") then --this is not a clause number, it is something else number = nil end end if not precedentChar:match("~") then if number then --create link Loading @@ -90,6 +94,10 @@ function Substitute(el, word) number = succ.text:gsub("‑", "-"):match(pattern) if not number then number = succ.text:gsub("‑", "-"):match(annexPattern) if number and succ.text:sub(1, 1):match("%a") and succ.text:sub(2,2):match("%a") then --this is not a clause number, it is something else number = nil end end if succ.t == "Str" and number then --we continue searching local succ_succ = el.content Loading Loading @@ -181,6 +189,10 @@ function MultipleClauses(el) if number == nil then --check if it is an annex clause number startIndex, endIndex, number = elem.text:find(annexPattern) if number and elem.text:sub(1, 1):match("%a") and elem.text:sub(2,2):match("%a") then --this is not a clause number, it is something else number = nil end end if elem.text:match("^,$") or elem.text:match("and") then Loading