diff options
author | EuAndreh <eu@euandre.org> | 2020-10-30 16:24:10 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2020-10-30 16:24:10 -0300 |
commit | d4d5c9203670cc4ae3625cafdb1499fa18688bc2 (patch) | |
tree | 0e15515cb2cff6040d8386518890342a1f08f641 | |
parent | Add empty eo.txt dictionary (diff) | |
download | euandre.org-d4d5c9203670cc4ae3625cafdb1499fa18688bc2.tar.gz euandre.org-d4d5c9203670cc4ae3625cafdb1499fa18688bc2.tar.xz |
Translate alt of link icon
-rw-r--r-- | _config.yml | 5 | ||||
-rw-r--r-- | _plugins/add-anchor-to-header-from-header-id.rb | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/_config.yml b/_config.yml index 9fcd728..a4e4e78 100644 --- a/_config.yml +++ b/_config.yml @@ -186,6 +186,11 @@ t: pt: "Ícone de fechadura" fr: "Icône de verrouillage" eo: "Ŝlosila ikono" + link_icon: + en: "Icon for showing link to this header" + pt: "Ícone para mostrar link para esse cabeçalho" + fr: "Icône pour afficher le lien vers cet en-tête" + eo: "Ikono por montri ligon al ĉi tiu kaplinio" footer: en: >- The content for this site is licensed under <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>. The <a href="https://git.euandreh.xyz/website">code</a> is <a href="https://git.euandreh.xyz/website/tree/LICENSE">AGPLv3 or later</a>. Patches welcome. diff --git a/_plugins/add-anchor-to-header-from-header-id.rb b/_plugins/add-anchor-to-header-from-header-id.rb index 8846b24..373389a 100644 --- a/_plugins/add-anchor-to-header-from-header-id.rb +++ b/_plugins/add-anchor-to-header-from-header-id.rb @@ -1,9 +1,11 @@ Jekyll::Hooks.register [:documents, :pages], :post_render do |doc| if doc.output_ext == ".html" && doc.type != :slides + lang = doc.data["lang"] + alt = doc.site.site_payload["site"]["t"]["alt"]["link_icon"][lang] doc.output = doc.output.gsub( /<h([1-6])(.*?)id="([\w-]+)"(.*?)>(.*?)<\/h[1-6]>/, - '<div class="header-anchor"><h\1\2id="\3"\4>\5</h\1><a href="#\3"><img class="simple-icon" src="/images/link.svg" aria-hidden="true" alt="link icon for showing link to this header" /></a></div>' + '<div class="header-anchor"><h\1\2id="\3"\4>\5</h\1><a href="#\3"><img class="simple-icon" src="/images/link.svg" aria-hidden="true" alt="' + alt + '" /></a></div>' ) end end |