Skip to content

Commit

Permalink
Fix Word ToC: #325
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Dec 22, 2023
1 parent a35698f commit 137f794
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 141 deletions.
7 changes: 7 additions & 0 deletions lib/isodoc/ieee/word_cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ def style_cleanup(docxml)
p["class"] = stylesmap[:MsoNormal]
end
end

def insert_toc(intro, docxml, level)
toc = assemble_toc(docxml, level)
source = docxml.at("//div[@class = 'WordSectionContents']") and
source << toc
intro
end
end
end
end
13 changes: 13 additions & 0 deletions lib/isodoc/ieee/word_wp_cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,19 @@ def abstract_cleanup1(source, _dest)
end
end
end

def insert_toc(intro, docxml, level)
toc = assemble_toc(docxml, level)
if intro&.include?("WORDTOC")
#s = docxml.at("//div[@class = 'WordSectionContents']")
#s.at("./p[@class='Unnumberedheading']")&.remove
intro.sub("WORDTOC", toc)
else
source = docxml.at("//div[@class = 'TOC']") and
source.children = toc
intro
end
end
end
end
end
1 change: 0 additions & 1 deletion spec/assets/wordintro.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/* an empty word intro page */

WORDTOC
102 changes: 51 additions & 51 deletions spec/vcr_cassettes/ieee-multi.yml

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions spec/vcr_cassettes/iso123.yml

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions spec/vcr_cassettes/multistandard.yml

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions spec/vcr_cassettes/multistandard0.yml

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions spec/vcr_cassettes/multistandard1.yml

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions spec/vcr_cassettes/multistandard2.yml

Large diffs are not rendered by default.

0 comments on commit 137f794

Please sign in to comment.