Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix loop numbering #145

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
wip
  • Loading branch information
erdos committed Dec 25, 2022
commit ddbda23e0fb67065940a361c163a3c5c3f3929af
5 changes: 4 additions & 1 deletion src/stencil/model/numbering.clj
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@
;; returns new id for the numbering copied from old-id
(defn copy-numbering! [old-id]
(let [old-elem (find-first (fn [e] (-> e :attrs ooxml/attr-numId (= old-id))) (:content (:parsed @*numbering*)))
new-id #_(name (gensym "xx")) (str (int (* 1000 (Math/random))))
max-num-id (apply max (keep (comp ->int ooxml/attr-numId :attrs)
(:content (:parsed @*numbering*))))
new-id (str (inc max-num-id))
; new-id #_(name (gensym "xx")) (str (int (* 1000 (Math/random))))
new-elem (assoc-in old-elem [:attrs ooxml/attr-numId] new-id)]
(assert old-elem)
(swap! *numbering* update :parsed update :content concat [new-elem])
Expand Down