From 1ac00cae11249aadc139b2503fbbef2220e4466c Mon Sep 17 00:00:00 2001
From: kthoden <kthoden@mpiwg-berlin.mpg.de>
Date: Wed, 29 Apr 2020 16:55:38 +0200
Subject: [PATCH] Use relative links in indices

---
 .../management/commands/publicationimport.py    | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/eoapublications/management/commands/publicationimport.py b/eoapublications/management/commands/publicationimport.py
index 91406cb..ac604d8 100644
--- a/eoapublications/management/commands/publicationimport.py
+++ b/eoapublications/management/commands/publicationimport.py
@@ -132,8 +132,7 @@ def process_index_entries(self, xmlIndex, xmlElement, xmlChapter, Newelement, Ne
                         if xmlIndexLink.get("chapterorder") == current_chapter_order and xmlIndexLink.get('elementorder') == current_element_order:
                             strHtml = strHtml + "<span>" + str(intLinkNumber) + "</span> "
                         else:
-                            strHtml = strHtml + "<a href='/" + Newpublication.Serie.lower() + "/" + \
-                                    Newpublication.Number + "/" + xmlIndexLink.get("chapterorder") + "/index.html#"\
+                            strHtml = strHtml + "<a href='../" + xmlIndexLink.get("chapterorder") + "/index.html#"\
                                     + xmlIndexLink.get('elementorder') + "'>"
                             strHtml = strHtml + str(intLinkNumber)
                             strHtml = strHtml + "</a> "
@@ -213,9 +212,10 @@ def process_indexsection(self, xmlIndexsection, intObjectOrder, intIndexEntry, p
                 # Process Links of the main entry
                 intMainIndexLinkNumber = 1
                 for xmlIndexlink in xmlIndexEntry.findall("./EOAindexlink"):
-                    strIndexLink = "<a href=\"/" + Newpublication.Serie.lower() + \
-                                   "/"+ publication_number \
-                                   + "/" + xmlIndexlink.get('chapterorder') + "/index.html#" + xmlIndexlink.get('elementorder') + "\">"
+                    # strIndexLink = "<a href=\"/" + Newpublication.Serie.lower() + \
+                    #                "/"+ publication_number \
+                    #                + "/" + xmlIndexlink.get('chapterorder') + "/index.html#" + xmlIndexlink.get('elementorder') + "\">"
+                    strIndexLink = "<a href='./" +  xmlIndexlink.get('chapterorder') + "/index.html#" + xmlIndexlink.get('elementorder') + "'>"
                     strIndexLink = strIndexLink + str(intMainIndexLinkNumber) + "</a> "
                     if xmlIndexlink.get('bold') == "True":
                         strIndexLink = "<strong>" + strIndexLink + "</strong>"
@@ -229,9 +229,10 @@ def process_indexsection(self, xmlIndexsection, intObjectOrder, intIndexEntry, p
                         strIndexHtml = strIndexHtml + "<p>" + xmlIndexSubEntry.get('secondary') + "<br/>"
                     intSubIndexLinkNumber = 1
                     for xmlIndexSublink in xmlIndexSubEntry.findall("EOAindexlink"):
-                        strIndexSubLink = "<a href=\"/" + Newpublication.Serie.lower() + \
-                                       "/"+ publication_number \
-                                       + "/" + xmlIndexSublink.get('chapterorder') + "/index.html#" + xmlIndexSublink.get('elementorder') + "\">"
+                        # strIndexSubLink = "<a href=\"/" + Newpublication.Serie.lower() + \
+                        #                "/"+ publication_number \
+                        #                + "/" + xmlIndexSublink.get('chapterorder') + "/index.html#" + xmlIndexSublink.get('elementorder') + "\">"
+                        strIndexSubLink = "<a href='./" + xmlIndexSublink.get('chapterorder') + "/index.html#" + xmlIndexSublink.get('elementorder') + "'>"
                         strIndexSubLink = strIndexSubLink + str(intSubIndexLinkNumber) + "</a> "
                         if xmlIndexSublink.get("bold") == "True":
                             strIndexSubLink = "<b>" + strIndexSubLink + "</b>"