Browse Source

Implement preprocessor for external links

master
Leon Etienne 6 months ago
parent
commit
38edab2bff
  1. 4
      book.toml
  2. 38
      preprocessor.external-link.py
  3. 4
      src/cv.md
  4. 5
      src/datenschutz.md
  5. 10
      src/projects/code-it-yourself/gcrypt.md
  6. 2
      src/projects/code-it-yourself/index.md
  7. 4
      src/projects/index.md
  8. 8
      src/projects/youtube-archiver.md

4
book.toml

@ -19,3 +19,7 @@ additional-css = [
[output.html.search]
enable = false
[preprocessor.external-link]
command = "python3 ./preprocessor.external-link.py"
renderer = ["html"]

38
preprocessor.external-link.py

@ -0,0 +1,38 @@
#!/bin/python3
# Find all like <external-link href="https://www.duckduckgo.com" title="xyz">external resource</external-link>
# and convert to:
# <a href="https://www.duckduckgo.com" title="xyz" rel="external" target="_blank">external resource</a>
import sys
import json
import re
def ReplaceExternalLinkTagsInChapter(chapter):
# Easy-peasy-lemon-squeezy regex substitution
chapter['content'] = re.sub(
r'<external-link (.+?)>(.+?)</external-link>',
r'<a \1 rel="external" target="_blank">\2</a>',
chapter['content']
)
def Recursive_TraverseAllChapters(chapter):
ReplaceExternalLinkTagsInChapter(chapter)
for subsection in chapter['sub_items']:
Recursive_TraverseAllChapters(subsection['Chapter'])
if __name__ == '__main__':
if len(sys.argv) > 1:
if sys.argv[1] == "supports":
sys.exit(0)
context, book = json.load(sys.stdin)
for section in book['sections']:
Recursive_TraverseAllChapters(section['Chapter'])
print(json.dumps(book))

4
src/cv.md

@ -4,9 +4,9 @@
<dl>
<dt>2020 - Now</dt>
<dd>Full stack developer at <a href="https://www.medienagenten.de" title="External link: Buero Medienagenten" rel="external" target="_blank">Buero Medienagenten</a>, focused on TYPO3 and Nuxt.js/Vue.js development</dd><br>
<dd>Full stack developer at <external-link href="https://www.medienagenten.de" title="External link: Buero Medienagenten">Buero Medienagenten</external-link>, focused on TYPO3 and Nuxt.js/Vue.js development</dd><br>
<dt>2020 - Now</dt>
<dd>Computer Science, Software Engineering Major at the <a href="https://www.hs-worms.de/ai-dual/beschreibung/" title="External link: University of Applied Sciences, Worms: Applied Computer Sciences" rel="external" target="_blank">University of Applied Sciences, Worms</a></dd><br>
<dd>Computer Science, Software Engineering Major at the <external-link href="https://www.hs-worms.de/ai-dual/beschreibung/" title="External link: University of Applied Sciences, Worms: Applied Computer Sciences">University of Applied Sciences, Worms</external-link></dd><br>
</dl>

5
src/datenschutz.md

@ -9,10 +9,9 @@ Diese Webseite erfasst keinerlei Nutzerdaten, der verwendete Webserver loggt kei
es werden keinerlei externe Resourcen eingebunden, alles wird von dieser Domain geladen.
Hyperlinks, die auf eine externe URL verweisen, sind rot markiert.
Ich behalte mir vor, zu einem späteren Zeitpunkt Änderungen daran vorzunehmen.
Vertrauen ist gut, Kontrolle ist besser. Der Sourcecode dieser Webseite ist auf meiner <a href="https://gitea.leonetienne.de/leonetienne/Homepage" title="Externer Link: Webseiten-Quellcode" rel="external" target="_blank">Gitea-Instanz</a> zu finden.
Vertrauen ist gut, Kontrolle ist besser. Der Sourcecode dieser Webseite ist auf meiner <external-link href="https://gitea.leonetienne.de/leonetienne/Homepage" title="Externer Link: Webseiten-Quellcode">Gitea-Instanz</external-link> zu finden.
Happy private browsing.
<br><br><br>

10
src/projects/code-it-yourself/gcrypt.md

@ -7,7 +7,7 @@
Or... by it's full name, *GhettoCrypt*
is an educational project I've started with the intention of learning more about feistel ciphers.
<a href="https://gitea.leonetienne.de/leonetienne/GCrypt" title="Gitea link: Gitea/GCrypt" rel="external" target="_blank">See repository</a>
<external-link href="https://gitea.leonetienne.de/leonetienne/GCrypt" title="Gitea link: Gitea/GCrypt">See repository</external-link>
GCrypt is a feistel block cipher implemented in C++ with the functional goal of providing a pythonic API.
It comes with a wrapper class making it even easier to use, and can be easily included as a git submodule.
@ -15,12 +15,12 @@ If even that's too much, there's also the option to include it as a mashed toget
Besides simple en- and decryption, it also supports calculating hashsums.
A more elaborate documentation is available in the projects <a href="https://gitea.leonetienne.de/leonetienne/GCrypt/src/branch/master/readme.md" title="Gitea link: Gitea/GCrypt/Readme" rel="external" target="_blank">readme</a>.
A more elaborate documentation is available in the projects <external-link href="https://gitea.leonetienne.de/leonetienne/GCrypt/src/branch/master/readme.md" title="Gitea link: Gitea/GCrypt/Readme">readme</external-link>.
## Worth a look: GCrypt-CLI
GCrypt is also available as a command line tool:
<a href="https://gitea.leonetienne.de/leonetienne/GCrypt/src/branch/master/GhettoCryptCLI" title="Gitea link: Gitea/GCrypt/CLI" rel="external" target="_blank">See repository</a>
<external-link href="https://gitea.leonetienne.de/leonetienne/GCrypt/src/branch/master/GhettoCryptCLI" title="Gitea link: Gitea/GCrypt/CLI">See repository</external-link>
One of my favourite features, this being a kind of esoteric project itself, are esoteric number bases, such as:
#### Base *UwU*
@ -50,8 +50,8 @@ Gah! Bah! Huh...? Ugh Bah! Uaah! Gah! Bah! Duh! Duh! Uh-huh... Grr... Ah... Grr.
Ugh Ah... Pft!
```
<sub>*I've added linebreaks to the ciphertexts, to make them more readable. They are not actually part of the output.</sub>
<sub>\*I've added linebreaks to the ciphertexts, to make them more readable. They are not actually part of the output.</sub>
these just bring a bit more fun into the big world of cryptography :).
A more elaborate documentation is available in the projects <a href="https://gitea.leonetienne.de/leonetienne/GCrypt/src/branch/master/GhettoCryptCLI/readme.md" title="Gitea link: Gitea/GCrypt/CLI/Readme" rel="external" target="_blank">readme</a>.
A more elaborate documentation is available in the projects <external-link href="https://gitea.leonetienne.de/leonetienne/GCrypt/src/branch/master/GhettoCryptCLI/readme.md" title="Gitea link: Gitea/GCrypt/CLI/Readme">readme</external-link>.

2
src/projects/code-it-yourself/index.md

@ -1,7 +1,7 @@
<sup>13.04.2022</sup>
# Code it yourself
inspired by <a href="https://community.onelonecoder.com/javidx9/" title="External link: onelonecoder/javidx9" rel="external" target="_blank">javidx9</a>,
inspired by <external-link href="https://community.onelonecoder.com/javidx9/" title="External link: onelonecoder/javidx9">javidx9</external-link>,
following the paradigma of coding big and complex applications, line by line, module by module, *all by yourself* with the intention of learning.
I like this idea so much, that i've adapted it, with a few more "*rules*", if one can call them that:

4
src/projects/index.md

@ -5,7 +5,9 @@ Here I present some of my projects.
These are not chosen by how big, how ambitious, or how complicated they are, but rather by
how interesting I find them.
If you want to see a broader picture, check out my <a href="https://gitea.leonetienne.de/leonetienne" title="External link: My Gitea" rel="external" target="_blank">Gitea</a> or, for even more, older Projects my <a href="https://github.com/Leonetienne" title="External link: My Github" rel="external" target="_blank">Github</a>. Do note that my github contains quite a few *mirrors* of projects that are maintained on my Gitea.
If you want to see a broader picture, check out my <external-link href="https://gitea.leonetienne.de/leonetienne" title="External link: My Gitea">Gitea</external-link>
or, for even more, older Projects my <external-link href="https://github.com/Leonetienne" title="External link: My Github">Github</external-link>.
Do note that my github contains quite a few *mirrors* of projects that are maintained on my Gitea.
These are my *personal pet projects*, and do *not* include projects I've worked on in any profesional capacity.

8
src/projects/youtube-archiver.md

@ -6,7 +6,7 @@
This project isn't complex, math-heavy, or anything like that.
It is just incredibly useful, and I use it a lot.
<a href="https://gitea.leonetienne.de/leonetienne/Youtube-Archiver" title="Gitea link: Gitea/Youtube-Archiver" rel="external" target="_blank">See repository</a>
<external-link href="https://gitea.leonetienne.de/leonetienne/Youtube-Archiver" title="Gitea link: Gitea/Youtube-Archiver">See repository</external-link>
This utility allows you to define a collection of links to youtube-channels and/or playlists, which you want to keep synced to your local storage.
All you have to do is to call `download.sh`, which will download all videos and mp3's of your defined playlists that are not already saved locally.
@ -17,7 +17,7 @@ This basically means, after doing the initial big download, that you could run i
Pretty easily.
#### 1
First, you define the stuff you want to download, in yaml files. For more info on syntax, see the <a href="https://gitea.leonetienne.de/leonetienne/Youtube-Archiver/src/branch/master/linklist-example.yaml" title="Gitea link: Gitea/Youtube-Archiver/linklist-example" rel="external" target="_blank">example file</a>.
First, you define the stuff you want to download, in yaml files. For more info on syntax, see the <external-link href="https://gitea.leonetienne.de/leonetienne/Youtube-Archiver/src/branch/master/linklist-example.yaml" title="Gitea link: Gitea/Youtube-Archiver/linklist-example">example file</external-link>.
```yaml
# linklist-music.yaml
@ -39,10 +39,10 @@ First, you define the stuff you want to download, in yaml files. For more info o
#### 2
Secondly, calling `download.sh` will invoke the two python scripts responsible for downloading.
These python scripts will invoke <a href="https://github.com/yt-dlp/yt-dlp" title="External link: Github/yt-dlp" rel="external" target="_blank">yt-dlp</a> for each link supplied. Yt-dlp runs in download-archive mode,
These python scripts will invoke <external-link href="https://github.com/yt-dlp/yt-dlp" title="External link: Github/yt-dlp">yt-dlp</external-link> for each link supplied. Yt-dlp runs in download-archive mode,
which basically means it won't download a video twice. It will save video IDs and check if a video already saved before downloading.
Files will be saved to `./videos/<folder>/` and `./music/<folder>/`.
For more information, check out the <a href="https://gitea.leonetienne.de/leonetienne/Youtube-Archiver" title="Gitea link: Gitea/Youtube-Archiver" rel="external" target="_blank">repository</a>.
For more information, check out the <external-link href="https://gitea.leonetienne.de/leonetienne/Youtube-Archiver" title="Gitea link: Gitea/Youtube-Archiver" >repository</external-link>.

Loading…
Cancel
Save