diff --git a/lib/isodoc/base_style/reset.scss b/lib/isodoc/base_style/reset.scss
index 99162520..a4161c0a 100644
--- a/lib/isodoc/base_style/reset.scss
+++ b/lib/isodoc/base_style/reset.scss
@@ -163,6 +163,9 @@ a.FootnoteRef, span.FootnoteRef {
text-decoration: line-through;
}
+ruby { ruby-position: over; -webkit-ruby-position: before;}
+ruby ruby { ruby-position: under; -webkit-ruby-position: after; }
+
/* code highlighting with line numbers */
table.rouge-line-table td.rouge-gutter {
diff --git a/lib/isodoc/function/inline.rb b/lib/isodoc/function/inline.rb
index 45d223db..1202a2fc 100644
--- a/lib/isodoc/function/inline.rb
+++ b/lib/isodoc/function/inline.rb
@@ -155,6 +155,24 @@ def error_parse(node, out)
p.b(role: "strong") { |e| e << text }
end
end
+
+ def ruby_parse(node, out)
+ out.ruby do |e|
+ node.children.each { |n| parse(n, e) }
+ end
+ end
+
+ def rt_parse(node, out)
+ out.rt do |e|
+ node.children.each { |n| parse(n, e) }
+ end
+ end
+
+ def rb_parse(node, out)
+ out.rb do |e|
+ node.children.each { |n| parse(n, e) }
+ end
+ end
end
end
end
diff --git a/lib/isodoc/function/to_word_html.rb b/lib/isodoc/function/to_word_html.rb
index 0249dbe0..92f3603d 100644
--- a/lib/isodoc/function/to_word_html.rb
+++ b/lib/isodoc/function/to_word_html.rb
@@ -253,6 +253,9 @@ def parse(node, out)
when "span" then span_parse(node, out)
when "location" then location_parse(node, out)
when "columnbreak" then columnbreak_parse(node, out)
+ when "ruby" then ruby_parse(node, out)
+ when "rt" then rt_parse(node, out)
+ when "rb" then rb_parse(node, out)
else error_parse(node, out)
end
end
diff --git a/lib/isodoc/metadata.rb b/lib/isodoc/metadata.rb
index 889bc374..ca201323 100644
--- a/lib/isodoc/metadata.rb
+++ b/lib/isodoc/metadata.rb
@@ -106,12 +106,12 @@ def draftinfo(draft, revdate)
end
def version(isoxml, _out)
- set(:edition, isoxml&.at(ns("//bibdata/edition#{NOLANG}"))&.text)
+ set(:edition, isoxml.at(ns("//bibdata/edition#{NOLANG}"))&.text)
set(:edition_display,
- isoxml&.at(ns("//bibdata/edition#{currlang}"))&.text)
- set(:docyear, isoxml&.at(ns("//bibdata/copyright/from"))&.text)
- set(:draft, isoxml&.at(ns("//bibdata/version/draft"))&.text)
- revdate = isoxml&.at(ns("//bibdata/version/revision-date"))&.text
+ isoxml.at(ns("//bibdata/edition#{currlang}"))&.text)
+ set(:docyear, isoxml.at(ns("//bibdata/copyright/from"))&.text)
+ set(:draft, isoxml.at(ns("//bibdata/version/draft"))&.text)
+ revdate = isoxml.at(ns("//bibdata/version/revision-date"))&.text
set(:revdate, revdate)
set(:revdate_monthyear, monthyr(revdate))
set(:draftinfo,
@@ -119,7 +119,7 @@ def version(isoxml, _out)
end
def title(isoxml, _out)
- main = isoxml&.at(ns("//bibdata/title[@language='#{@lang}']"))&.text
+ main = isoxml.at(ns("//bibdata/title[@language='#{@lang}']"))&.text
set(:doctitle, main)
end
diff --git a/lib/isodoc/presentation_function/inline.rb b/lib/isodoc/presentation_function/inline.rb
index 86f078d5..c7f95098 100644
--- a/lib/isodoc/presentation_function/inline.rb
+++ b/lib/isodoc/presentation_function/inline.rb
@@ -137,6 +137,22 @@ def extract_custom_charsets(docxml)
end
end
+ def ruby(docxml)
+ (docxml.xpath(ns("//ruby")) - docxml.xpath(ns("//ruby//ruby")))
+ .each do |r|
+ ruby1(r)
+ end
+ end
+
+ def ruby1(elem)
+ v = elem.at(ns("./pronunciation | ./annotation")).remove
+ elem.xpath(ns("./ruby")).each do |r|
+ ruby1(r)
+ end
+ t = elem.children.to_xml
+ elem.replace("
+
+