commit:     e01e6ccbdecf369c6f6c0d9da800ebea2e264f96
Author:     Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 15 12:29:29 2019 +0000
Commit:     Göktürk Yüksek <gokturk <AT> gentoo <DOT> org>
CommitDate: Thu Dec 19 20:53:00 2019 +0000
URL:        https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=e01e6ccb

Fix make all URL relative to root directory

Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org>
Signed-off-by: Göktürk Yüksek <gokturk <AT> gentoo.org>

 Makefile        | 3 +--
 search_index.py | 4 +++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 4a52cc0..343234b 100644
--- a/Makefile
+++ b/Makefile
@@ -20,8 +20,7 @@ prereq:
          exit 1; }
 
 index:
-       @echo -n "var documents = " > documents.js
-       @./search_index.py text.xml >> documents.js
+       @./search_index.py text.xml > documents.js
 
 %.png : %.svg
        convert $< $@

diff --git a/search_index.py b/search_index.py
index 2ab79f1..3226775 100755
--- a/search_index.py
+++ b/search_index.py
@@ -8,7 +8,9 @@ import xml.etree.ElementTree as ET
 
 xmlFile = sys.argv[1]
 documents = []
+url_root = 'https://devmanual.gentoo.org/'
 
+print('var documents = ', end = '')
 for path, dirs, files in os.walk('.'):
     if xmlFile in files:
         tree = ET.parse(path + '/' + xmlFile)
@@ -17,7 +19,7 @@ for path, dirs, files in os.walk('.'):
             try:
                 documents.append({"name": chapter.find('title').text,
                     "text": chapter.find('body').find('p').text,
-                    "url": path })
+                                  "url": url_root + path[+2:] })
             except:
                 pass
     if '.git' in dirs:

Reply via email to