require_relative "base_convert" require_relative "init" require "isodoc" module IsoDoc module Iso class HtmlConvert < IsoDoc::HtmlConvert def initialize(options) @libdir = File.dirname(__FILE__) super end def googlefonts <<~HEAD.freeze HEAD end def default_fonts(options) { bodyfont: (if options[:script] == "Hans" '"Source Han Sans",serif' else options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif' end), headerfont: (if options[:script] == "Hans" '"Source Han Sans",sans-serif' else options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif' end), monospacefont: (if options[:alt] '"Space Mono",monospace' else '"Courier New",monospace' end), normalfontsize: "1.0em", smallerfontsize: "0.9em", footnotefontsize: "0.9em", monospacefontsize: "0.8em", } end def default_file_locations(options) { htmlstylesheet: (if options[:alt] html_doc_path("style-human.scss") else html_doc_path("style-iso.scss") end), htmlcoverpage: html_doc_path("html_iso_titlepage.html"), htmlintropage: html_doc_path("html_iso_intro.html"), } end def footnote_reference_format(link) link.content += ")" end def html_toc_entry(level, header) content = header.at("./following-sibling::p" \ "[@class = 'variant-title-toc']") || header if level == "h1" && header.parent.name != "main" && header.parent.at(".//h2#{toc_exclude_class}") <<~HDR