Fixes discussion links

This commit is contained in:
Nemo 2017-09-15 12:09:39 +05:30
parent 040b54a9a3
commit 18fc548d73
1 changed files with 17 additions and 16 deletions

View File

@ -34,25 +34,26 @@ end
# Now we have all the files
html = ""
for i in 1..(links.length)
page = Nokogiri::HTML(open("html/#{i}.html")).css('.entry-content')
start = ending = false
page.children.each do |e|
if e.name == 'h3'
e.name = 'h1'
start = true
end
page = Nokogiri::HTML(open("html/#{i}.html")).css('.entry-content')
start = ending = false
page.children.each do |e|
if e.name == 'h3'
e.name = 'h1'
start = true
end
if e.attribute('class') and e['class'].include? 'frontmatter' and start
ending = true
end
if e.attribute('class') and e['class'].include? 'frontmatter' and start
ending = true
end
if !start or ending
e.remove
end
end
html += page.inner_html
if !start or ending
e.remove
end
end
html += page.inner_html
url = links[i-1]
html += "<p>Visit <a href='#{url}'>tor.com</a> for discussion.</p>"
html += "<p>Visit <a href='#{url}'>tor.com</a> for discussion.</p>"
end
html += "<p>~fin\~<br>Next 3 chapters out on #{next_date.to_s}</p>"