lib/isodoc/function/to_word_html.rb in isodoc-1.6.1 vs lib/isodoc/function/to_word_html.rb in isodoc-1.6.2
- old
+ new
@@ -16,23 +16,23 @@
@note
end
def init_file(filename, debug)
filepath = Pathname.new(filename)
- filename = filepath.sub_ext('').sub(/\.presentation$/, "").to_s
+ filename = filepath.sub_ext("").sub(/\.presentation$/, "").to_s
dir = init_dir(filename, debug)
@filename = filename
- @localdir = filepath.parent.to_s + '/'
+ @localdir = filepath.parent.to_s + "/"
@sourcedir = @localdir
- @sourcefilename and @sourcedir = Pathname.new(@sourcefilename).parent.to_s + '/'
+ @sourcefilename and @sourcedir = Pathname.new(@sourcefilename).parent.to_s + "/"
[filename, dir]
end
def init_dir(filename, debug)
dir = "#{filename}_files"
unless debug
- Dir.mkdir(dir, 0777) unless File.exists?(dir)
+ Dir.mkdir(dir, 0o777) unless File.exists?(dir)
FileUtils.rm_rf "#{dir}/*"
end
dir
end
@@ -49,13 +49,11 @@
# is inserted before this CSS.
def define_head(head, filename, _dir)
if @standardstylesheet
head.style do |style|
@standardstylesheet.open
- stylesheet = @standardstylesheet.read.gsub(
- "FILENAME", File.basename(filename).sub(/\.presentation$/, "")
- )
+ stylesheet = @standardstylesheet.read
style.comment "\n#{stylesheet}\n"
end
end
end
@@ -76,11 +74,11 @@
div1.p { |p| p << " " } # placeholder
end
section_break(body)
end
- def make_body2(body, docxml)
+ def make_body2(body, _docxml)
body.div **{ class: "prefatory-section" } do |div2|
div2.p { |p| p << " " } # placeholder
end
section_break(body)
end
@@ -115,20 +113,10 @@
@meta.keywords isoxml, out
@meta.note isoxml, out
@meta.get
end
- def middle_title(_isoxml, out)
- out.p(**{ class: "zzSTDTitle1" }) { |p| p << @meta.get[:doctitle] }
- end
-
- def middle_admonitions(isoxml, out)
- isoxml.xpath(ns("//sections/note | //sections/admonition")).each do |x|
- parse(x, out)
- end
- end
-
def middle(isoxml, out)
middle_title(isoxml, out)
middle_admonitions(isoxml, out)
i = scope isoxml, out, 0
i = norm_ref isoxml, out, i
@@ -145,20 +133,18 @@
boilerplate.children.each do |n|
if n.name == "title"
s.h1 do |h|
n.children.each { |nn| parse(nn, h) }
end
- else
- parse(n, s)
+ else parse(n, s)
end
end
end
end
def parse(node, out)
- if node.text?
- text_parse(node, out)
+ if node.text? then text_parse(node, out)
else
case node.name
when "em" then em_parse(node, out)
when "strong" then strong_parse(node, out)
when "sup" then sup_parse(node, out)
@@ -234,11 +220,16 @@
when "amend" then amend_parse(node, out)
when "tab" then clausedelimspace(out) # in Presentation XML only
when "svg" then svg_parse(node, out) # in Presentation XML only
when "add" then add_parse(node, out)
when "del" then del_parse(node, out)
- else
- error_parse(node, out)
+ when "form" then form_parse(node, out)
+ when "input" then input_parse(node, out)
+ when "select" then select_parse(node, out)
+ when "label" then label_parse(node, out)
+ when "option" then option_parse(node, out)
+ when "textarea" then textarea_parse(node, out)
+ else error_parse(node, out)
end
end
end
end
end