fix duplicate labels

This commit is contained in:
2025-10-13 00:57:43 +08:00
parent e604b13160
commit 7994b59938
2 changed files with 7 additions and 5 deletions

View File

@@ -135,7 +135,9 @@ local function collect_node(doc, l)
}
for _, t in ipairs(targets) do
if nodes[t] then
table.insert(blocks, nodes[t]:clone())
local cl = nodes[t]:clone()
cl.identifier = ""
table.insert(blocks, cl)
-- show("insert [" .. nodes[t].identifier .. ']\n')
else
io.stderr:write("Cannot find AST node with label " .. t .. "\n")

View File

@@ -4,10 +4,10 @@
<p>thm2 - inthm2 (need thm1)</p>
</div>
<div id="inc" data-include="thm2, thm1 , fakelabel">
<div id="thm2" class="Theorem">
<div class="Theorem">
<p>test thm2</p>
<div id="inthm2" data-include="thm1">
<div id="thm1" class="Theorem">
<div class="Theorem">
<p>test thm1</p>
<div id="inthm1" class="Definition">
<p>something</p>
@@ -15,7 +15,7 @@
</div>
</div>
</div>
<div id="thm1" class="Theorem">
<div class="Theorem">
<p>test thm1</p>
<div id="inthm1" class="Definition">
<p>something</p>
@@ -31,7 +31,7 @@
<div id="thm2" class="Theorem">
<p>test thm2</p>
<div id="inthm2" data-include="thm1">
<div id="thm1" class="Theorem">
<div class="Theorem">
<p>test thm1</p>
<div id="inthm1" class="Definition">
<p>something</p>