-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from metanorma/refactor/move_common_convert_co…
…de_to_single_place Move comon code from isodoc/*_convert.rb to isodoc/base_convert.rb
- Loading branch information
Showing
5 changed files
with
60 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
require "isodoc" | ||
require_relative "metadata" | ||
|
||
module IsoDoc | ||
module Csand | ||
module BaseConvert | ||
def metadata_init(lang, script, labels) | ||
@meta = Metadata.new(lang, script, labels) | ||
end | ||
|
||
def annex_name(annex, name, div) | ||
div.h1 **{ class: "Annex" } do |t| | ||
t << "#{get_anchors[annex['id']][:label]} " | ||
t.br | ||
t.b do |b| | ||
name&.children&.each { |c2| parse(c2, b) } | ||
end | ||
end | ||
end | ||
|
||
def term_defs_boilerplate(div, source, term, preface) | ||
if source.empty? && term.nil? | ||
div << @no_terms_boilerplate | ||
else | ||
div << term_defs_boilerplate_cont(source, term) | ||
end | ||
end | ||
|
||
def i18n_init(lang, script) | ||
super | ||
@annex_lbl = "Appendix" | ||
end | ||
|
||
def cleanup(docxml) | ||
super | ||
term_cleanup(docxml) | ||
end | ||
|
||
def term_cleanup(docxml) | ||
docxml.xpath("//p[@class = 'Terms']").each do |d| | ||
h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]") | ||
h2.add_child(" ") | ||
h2.add_child(d.remove) | ||
end | ||
docxml | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters