Skip to content

Commit

Permalink
add trailing slash before anchors
Browse files Browse the repository at this point in the history
With Hugo and GitHub Pages there is a redirect for all folders to have a
trailing slash that breaks anchors. Modify the links that contain anchors to
include this slash and avoid the redirect.

Signed-off-by: Matthias Aßhauer <[email protected]>
  • Loading branch information
rimrul committed Oct 20, 2023
1 parent 1732d23 commit 5e9c595
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h3 id="ref_the_ref">HEAD</h3>
</div>
<div class="paragraph">
<p>Lakin bəzi nadir hallarda HEAD faylında git obyektinin SHA-1 dəyəri ola bilər.
Deponuzu <a href="https://git-scm.com/docs/git-checkout#_detached_head">"detached HEAD"</a> vəziyyətinə qoyan bir etiket, commit və ya uzaq bir branch-ı çıxardıqda bu baş verir.</p>
Deponuzu <a href="https://git-scm.com/docs/git-checkout/#_detached_head">"detached HEAD"</a> vəziyyətinə qoyan bir etiket, commit və ya uzaq bir branch-ı çıxardıqda bu baş verir.</p>
</div>
<div class="paragraph">
<p>Fayla baxsanız, normal olaraq belə bir şey görəcəksiniz:</p>
Expand Down
2 changes: 1 addition & 1 deletion content/book/be/v2/Git-Internals-Git-References.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h3 id="ref_the_ref">The HEAD</h3>
</div>
<div class="paragraph">
<p>However in some rare cases the HEAD file may contain the SHA-1 value of a git object.
This happens when you checkout a tag, commit, or remote branch, which puts your repository in <a href="https://git-scm.com/docs/git-checkout#_detached_head">"detached HEAD"</a> state.</p>
This happens when you checkout a tag, commit, or remote branch, which puts your repository in <a href="https://git-scm.com/docs/git-checkout/#_detached_head">"detached HEAD"</a> state.</p>
</div>
<div class="paragraph">
<p>If you look at the file, you’ll normally see something like this:</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h3 id="ref_the_ref">HEAD</h3>
</div>
<div class="paragraph">
<p>В някои редки случаи обаче, HEAD файлът все пак може да съдържа SHA-1 стойност на git обект.
Това се случва при извличане на таг, къмит или отдалечен клон, при което хранилището ви попада в <a href="https://git-scm.com/docs/git-checkout#_detached_head" target="_blank" rel="noopener">"detached HEAD"</a> състояние.</p>
Това се случва при извличане на таг, къмит или отдалечен клон, при което хранилището ви попада в <a href="https://git-scm.com/docs/git-checkout/#_detached_head" target="_blank" rel="noopener">"detached HEAD"</a> състояние.</p>
</div>
<div class="paragraph">
<p>Ако погледнете файла, обикновено виждате нещо такова:</p>
Expand Down
2 changes: 1 addition & 1 deletion content/book/de/v2/Git-Interna-Git-Referenzen.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h3 id="ref_the_ref">HEAD</h3>
</div>
<div class="paragraph">
<p>In einigen seltenen Fällen kann die HEAD-Datei jedoch den SHA-1-Wert eines Git-Objekts enthalten.
Dies geschieht beim Auschecken eines Tags, Commits oder eines Remote-Branches, wodurch Ihr Repository in den Status <a href="https://git-scm.com/docs/git-checkout#_detached_head" target="_blank" rel="noopener">"detached HEAD"</a> versetzt wird.</p>
Dies geschieht beim Auschecken eines Tags, Commits oder eines Remote-Branches, wodurch Ihr Repository in den Status <a href="https://git-scm.com/docs/git-checkout/#_detached_head" target="_blank" rel="noopener">"detached HEAD"</a> versetzt wird.</p>
</div>
<div class="paragraph">
<p>Wenn Sie sich die Datei ansehen, sehen Sie normalerweise Folgendes:</p>
Expand Down
2 changes: 1 addition & 1 deletion content/book/en/v2/Git-Internals-Git-References.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h3 id="ref_the_ref">The HEAD</h3>
</div>
<div class="paragraph">
<p>However in some rare cases the HEAD file may contain the SHA-1 value of a Git object.
This happens when you checkout a tag, commit, or remote branch, which puts your repository in <a href="https://git-scm.com/docs/git-checkout#_detached_head" target="_blank" rel="noopener">"detached HEAD"</a> state.</p>
This happens when you checkout a tag, commit, or remote branch, which puts your repository in <a href="https://git-scm.com/docs/git-checkout/#_detached_head" target="_blank" rel="noopener">"detached HEAD"</a> state.</p>
</div>
<div class="paragraph">
<p>If you look at the file, you’ll normally see something like this:</p>
Expand Down
2 changes: 1 addition & 1 deletion content/book/fa/v2/Git-Internals-Git-References.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h3 id="ref_the_ref">The HEAD</h3>
</div>
<div class="paragraph">
<p>However in some rare cases the HEAD file may contain the SHA-1 value of a git object.
This happens when you checkout a tag, commit, or remote branch, which puts your repository in <a href="https://git-scm.com/docs/git-checkout#_detached_head">"detached HEAD"</a> state.</p>
This happens when you checkout a tag, commit, or remote branch, which puts your repository in <a href="https://git-scm.com/docs/git-checkout/#_detached_head">"detached HEAD"</a> state.</p>
</div>
<div class="paragraph">
<p>If you look at the file, you’ll normally see something like this:</p>
Expand Down
2 changes: 1 addition & 1 deletion content/book/fr/v2/Les-tripes-de-Git-Références-Git.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ <h3 id="s_the_head">La branche HEAD</h3>
</div>
<div class="paragraph">
<p>Cependant dans certains cas rares, le fichier HEAD peut contenir l’empreinte SHA-1 d’un objet git.
Cela arrive quand vous extrayez une étiquette, un commit ou une branche distante, ce qui bascule le dépôt en état <a href="https://git-scm.com/docs/git-checkout#_detached_head">"HEAD détachée"</a></p>
Cela arrive quand vous extrayez une étiquette, un commit ou une branche distante, ce qui bascule le dépôt en état <a href="https://git-scm.com/docs/git-checkout/#_detached_head">"HEAD détachée"</a></p>
</div>
<div class="paragraph">
<p>Si vous regardez ce fichier, vous devriez voir quelque chose comme ceci :</p>
Expand Down
2 changes: 1 addition & 1 deletion content/book/nl/v2/Git-Binnenwerk-Git-Referenties.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h3 id="ref_the_ref">De HEAD</h3>
</div>
<div class="paragraph">
<p>Echter, in enkele uitzonderlijke gevallen kan het HEAD bestand de SHA-1 waarde bevatten van een git-object.
Dit gebeurt als een tag, commit of remote branch uitcheckt, wat je repository in een <a href="https://git-scm.com/docs/git-checkout#_detached_head">"detached HEAD"</a> staat brengt.</p>
Dit gebeurt als een tag, commit of remote branch uitcheckt, wat je repository in een <a href="https://git-scm.com/docs/git-checkout/#_detached_head">"detached HEAD"</a> staat brengt.</p>
</div>
<div class="paragraph">
<p>Als je naar het bestand kijkt, zie je normaalgesproken zoiets als dit:</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h3 id="r_the_head">HEAD</h3>
</div>
<div class="paragraph">
<p>В некоторых случаях файл HEAD может содержать SHA-1 хеш какого-либо объекта.
Это происходит при извлечении тега, коммита или удалённой ветки, что приводит репозиторий в состояние <a href="https://git-scm.com/docs/git-checkout#_detached_head" target="_blank" rel="noopener">"detached HEAD"</a>.</p>
Это происходит при извлечении тега, коммита или удалённой ветки, что приводит репозиторий в состояние <a href="https://git-scm.com/docs/git-checkout/#_detached_head" target="_blank" rel="noopener">"detached HEAD"</a>.</p>
</div>
<div class="paragraph">
<p>Если вы заглянете внутрь HEAD, то увидите следующее:</p>
Expand Down
2 changes: 1 addition & 1 deletion content/book/sl/v2/Notranjost-Gita-Reference-Git.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h3 id="ref_the_ref">HEAD</h3>
</div>
<div class="paragraph">
<p>Vendar pa v nekaterih redkih primerih datoteka HEAD vsebuje vrednost SHA-1 objekta Git.
To se zgodi, ko izvlečete oznako, potrditev, ali oddaljeno vejo, kar postavi vaš repozitorij v <a href="https://git-scm.com/docs/git-checkout#_detached_head" target="_blank" rel="noopener">stanje ločene glave</a>.</p>
To se zgodi, ko izvlečete oznako, potrditev, ali oddaljeno vejo, kar postavi vaš repozitorij v <a href="https://git-scm.com/docs/git-checkout/#_detached_head" target="_blank" rel="noopener">stanje ločene glave</a>.</p>
</div>
<div class="paragraph">
<p>Če pogledate datoteko, boste običajno videli nekaj takega:</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h3 id="ref_the_ref">Референца HEAD</h3>
</div>
<div class="paragraph">
<p>Међутим, у неким ретким случајевима <em>HEAD</em> фајл може да садржи SHA-1 вредност гит објекта.
Ово се дешава када одјавите ознаку, комит, или удаљену грану што оставља ваш репозиторијум у стању <a href="https://git-scm.com/docs/git-checkout#_detached_head">„одвојене HEAD”</a> (одвојене главе).</p>
Ово се дешава када одјавите ознаку, комит, или удаљену грану што оставља ваш репозиторијум у стању <a href="https://git-scm.com/docs/git-checkout/#_detached_head">„одвојене HEAD”</a> (одвојене главе).</p>
</div>
<div class="paragraph">
<p>Ако погледате у фајл, обично ћете видети нешто слично овоме:</p>
Expand Down
2 changes: 1 addition & 1 deletion content/book/tr/v2/Git-Internals-Git-References.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h3 id="ref_the_ref">The HEAD</h3>
</div>
<div class="paragraph">
<p>However in some rare cases the HEAD file may contain the SHA-1 value of a git object.
This happens when you checkout a tag, commit, or remote branch, which puts your repository in <a href="https://git-scm.com/docs/git-checkout#_detached_head">"detached HEAD"</a> state.</p>
This happens when you checkout a tag, commit, or remote branch, which puts your repository in <a href="https://git-scm.com/docs/git-checkout/#_detached_head">"detached HEAD"</a> state.</p>
</div>
<div class="paragraph">
<p>If you look at the file, you’ll normally see something like this:</p>
Expand Down
2 changes: 1 addition & 1 deletion content/book/zh/v2/Git-内部原理-Git-引用.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ <h3 id="ref_the_ref">HEAD 引用</h3>
<div class="paragraph">
<p>然而在某些罕见的情况下,HEAD 文件可能会包含一个 git 对象的 SHA-1 值。
当你在检出一个标签、提交或远程分支,让你的仓库变成
<a href="https://git-scm.com/docs/git-checkout#_detached_head">“分离 HEAD”</a>状态时,就会出现这种情况。</p>
<a href="https://git-scm.com/docs/git-checkout/#_detached_head">“分离 HEAD”</a>状态时,就会出现这种情况。</p>
</div>
<div class="paragraph">
<p>如果查看 HEAD 文件的内容,通常我们看到类似这样的内容:</p>
Expand Down
2 changes: 1 addition & 1 deletion content/docs/_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1>Reference</h1>
</p>
</div>
<div class="callout all-commands">
<a href="{{< relurl "docs/git#_git_commands" >}}">Complete list of all commands<a/>
<a href="{{< relurl "docs/git/#_git_commands" >}}">Complete list of all commands<a/>
</div>
<div class='reference-menu'>
<div class='two-column'>
Expand Down
2 changes: 1 addition & 1 deletion data/doc_categories/guides.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ commands:
title: "Tutorial"
- doc: "gitworkflows"
title: "Workflows"
- doc: "git#_guides"
- doc: "git/#_guides"
title: "All guides..."
no_append_lang: true
---
9 changes: 9 additions & 0 deletions script/update-book2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@ def genbook(language_code, &get_content)
end
end

xlink = html.scan(/href="(https:\/\/git-scm\.com\/.*?[^\/])\#(.*?)"/)
xlink&.each do |link|
begin
html.gsub!("href=\"#{link.first}\##{link[1]}\"", "href=\"#{link.first}/\##{link[1]}\"")
rescue StandardError
nil
end
end

images = []
subsec = html.scan(/<img src="(.*?)"/)
subsec&.each do |sub|
Expand Down

0 comments on commit 5e9c595

Please sign in to comment.