Skip to content

Commit

Permalink
parse titles that have become detached downstream from their clause p…
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Jul 11, 2024
1 parent fc1f879 commit 76157db
Show file tree
Hide file tree
Showing 5 changed files with 1,946 additions and 1,870 deletions.
1 change: 1 addition & 0 deletions isodoc.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Gem::Specification.new do |spec|
spec.add_dependency "twitter_cldr", ">= 6.6.0"
spec.add_dependency "uuidtools"

spec.add_development_dependency "bigdecimal"
spec.add_development_dependency "debug"
spec.add_development_dependency "equivalent-xml", "~> 0.6"
spec.add_development_dependency "guard", "~> 2.14"
Expand Down
8 changes: 8 additions & 0 deletions lib/isodoc/function/section_titles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ def inline_header_title(out, node, title)
end
end

def freestanding_title(node, out)
parents = node.ancestors("clause, annex, terms, references, " \
"definitions, acknowledgements, introduction, " \
"foreword")
clause_parse_title(parents.empty? ? node : parents.first,
out, node, out)
end

# used for subclauses
def clause_parse_title(node, div, title, out, header_class = {})
return if title.nil?
Expand Down
1 change: 1 addition & 0 deletions lib/isodoc/function/to_word_html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ def parse(node, out)
when "option" then option_parse(node, out)
when "textarea" then textarea_parse(node, out)
when "toc" then toc_parse(node, out)
when "title" then freestanding_title(node, out) # not inside clause
when "variant-title" then variant_title(node, out)
when "span" then span_parse(node, out)
when "location" then location_parse(node, out)
Expand Down
Loading

0 comments on commit 76157db

Please sign in to comment.