blob: 19f723b14976c643f14a3326871e4ec7deea359f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/usr/bin/env ruby
# frozen_string_literal: true
require "asciidoctor"
require "pp"
file_path = File.expand_path("./spec/data/git-diff.txt")
content = File.read(file_path)
content.gsub!(/::(.*)\.txt/, "::\\1")
doc = Asciidoctor::Document.new(content)
html = doc.render
html.gsub!(/linkgit:(.*)\[(\d+)\]/) do |line|
x = /^linkgit:(.*)\[(\d+)\]/.match(line)
line = "<a href='/docs/#{x[1]}'>#{x[1]}[#{x[2]}]</a>"
end
File.open("./git-diff.html", "w+") do |f|
f.write html
end
|