Skip to content

Commit

Permalink
structure check also for paragraphs
Browse files Browse the repository at this point in the history
  • Loading branch information
mschlenker committed Nov 24, 2023
1 parent 0aa28eb commit 6fe80a1
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions docserve/docserve.rb
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,10 @@ def check_links(doc)
$cachedlinks[href][:ok] = false
$cachedlinks[href][:errorline] = "Request timeout"
broken_links[href] = $cachedlinks[href][:errorline]
rescue Errno::EHOSTUNREACH
$cachedlinks[href][:ok] = false
$cachedlinks[href][:errorline] = "No route to host"
broken_links[href] = $cachedlinks[href][:errorline]
end
end
}
Expand Down Expand Up @@ -677,6 +681,8 @@ def check_structure(build=true)
docstruc.push Node.new("imageblock", e['src'], e)
elsif e.name == "span" && e['class'] == 'image-inline'
docstruc.push Node.new("imageinline", e['src'], e)
elsif e.name == "div" && e['class'] == 'paragraph'
docstruc.push Node.new("paragraph", nil, e)
elsif e.name == "table"
rows = 0
e.xpath(".//tr").each { |r|
Expand Down Expand Up @@ -1041,17 +1047,6 @@ def to_html(otherstructure=nil)
hdoc = Nokogiri::HTML.parse html
head = hdoc.at_css "head"
cnode = hdoc.css("div[id='preamble']")[0]
# $stderr.puts cnode # .children[0] # .first_element_child
#@errors.each { |e|
# # head.first_element_child.before("<!-- #{e} -->\n")
# head.prepend_child "<!-- #{e} -->\n"
# #cnode.children[1].before("<div id='adocerrors'>" + @errors.join("<br />") + "</div>")
#}
#@xmlerrs.each { |e|
# head.prepend_child "<!-- #{e} -->\n"
# cnode.first_element_child.before("<div id='xmlerrors'>" + e.join("<br />") + "</div>")
#}
# cnode.prepend_child("<div id='xmlerrors'>" + @xmlerrs.join("<br />") + "</div>")
head.add_child("<style>\n" + File.read(__dir__ + "/docserve.css") + "\n</style>\n")
$injectcss.each { |c|
head.add_child("<style>\n" + File.read(c) + "\n</style>\n") if File.file? c
Expand Down

0 comments on commit 6fe80a1

Please sign in to comment.