Skip to content

Commit 98feb15

Browse files
committed
docs: correctly handle {litdd} in linkgit values
These are expanded to `&#x2d;&#x2d;`, and we do not want those to show up in the `href`, but replace them by `--`. This is relevant e.g. in `git-help.txt`, where we refer to `linkgit:git-web{litdd}browse[1]`. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent ba26e0b commit 98feb15

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

script/update-docs.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def index_l10n_doc(filter_tags, doc_list, get_content)
125125
html = asciidoc.render
126126
html.gsub!(/linkgit:(\S+?)\[(\d+)\]/) do |line|
127127
x = /^linkgit:(\S+?)\[(\d+)\]/.match(line)
128-
"<a href='/docs/#{x[1]}/#{lang}'>#{x[1]}[#{x[2]}]</a>"
128+
"<a href='/docs/#{x[1].gsub(/&#x2d;/, '-')}/#{lang}'>#{x[1]}[#{x[2]}]</a>"
129129
end
130130
# HTML anchor on hdlist1 (i.e. command options)
131131
html.gsub!(/<dt class="hdlist1">(.*?)<\/dt>/) do |_m|
@@ -348,7 +348,8 @@ def index_doc(filter_tags, doc_list, get_content)
348348
html = asciidoc.render
349349
html.gsub!(/linkgit:(\S+?)\[(\d+)\]/) do |line|
350350
x = /^linkgit:(\S+?)\[(\d+)\]/.match(line)
351-
"<a href='{{< relurl \"docs/#{x[1]}\" >}}'>#{x[1]}[#{x[2]}]</a>"
351+
relurl = "docs/#{x[1].gsub(/&#x2d;/, '-')}"
352+
"<a href='{{< relurl \"#{relurl}\" >}}'>#{x[1]}[#{x[2]}]</a>"
352353
end
353354
# HTML anchor on hdlist1 (i.e. command options)
354355
html.gsub!(/<dt class="hdlist1">(.*?)<\/dt>/) do |_m|

0 commit comments

Comments
 (0)