mirror of
https://github.com/Jovian-Experiments/Jovian-NixOS.git
synced 2025-10-06 00:22:54 +02:00
26 lines
586 B
Ruby
26 lines
586 B
Ruby
class SitePage
|
|
alias_method(:orig_contents, :contents)
|
|
|
|
def contents()
|
|
html = orig_contents()
|
|
html = Nokogiri::HTML(html)
|
|
|
|
# Manipulate links
|
|
if source_filename == "index.md" || source_filename == "contributing.md"
|
|
html.css("a").each do |anchor|
|
|
anchor["href"] =
|
|
case anchor["href"]
|
|
when "CONTRIBUTING.html"
|
|
"contributing.html"
|
|
when %r{^docs/}
|
|
anchor["href"] = anchor["href"].sub(%r{docs/}, "")
|
|
else
|
|
anchor["href"]
|
|
end
|
|
end
|
|
end
|
|
|
|
html.to_s()
|
|
end
|
|
end
|