diff --git a/doc/scripts/fixes.xslt b/doc/scripts/fixes.xslt
index e0206ba54..752a3a637 100644
--- a/doc/scripts/fixes.xslt
+++ b/doc/scripts/fixes.xslt
@@ -89,19 +89,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/doc/scripts/wikiparser.py b/doc/scripts/wikiparser.py
index 3f71519d7..a6e60ae71 100644
--- a/doc/scripts/wikiparser.py
+++ b/doc/scripts/wikiparser.py
@@ -5,6 +5,7 @@ MoinMoin wiki parser
import logging
import re
+import urllib
from enum import Enum
from pathlib import Path
from xml.sax.saxutils import escape
@@ -189,6 +190,14 @@ class Link(Element):
def to_docbook(self, context=None):
target = escape(self.target)
+ if target.startswith('attachment:'):
+ target = target.lstrip('attachment:')
+ page_title = context.get('title', None) if context else None
+ if page_title:
+ target = f'https://wiki.debian.org/{page_title}' \
+ + '?action=AttachFile&do=get&' + \
+ urllib.parse.urlencode({'target': target})
+
if target.startswith('FreedomBox/') or \
target.startswith('InstallingDebianOn/'):
target = 'https://wiki.debian.org/' + target + '#'
@@ -1464,6 +1473,13 @@ PlainText('normal text followed by'), BoldText('bold text')])])
'\
Features introduction'
+ >>> generate_inner_docbook([Link("attachment:Let's Encrypt.webm", \
+[PlainText("Let's Encrypt")], 'do=get')], context={'title': \
+'FreedomBox/Manual/LetsEncrypt'})
+ '\
+Let\\'s Encrypt'
+
>>> generate_inner_docbook([EmbeddedAttachment('cockpit-enable.png')])
'\
\