navigationtable needs to be generated in reverse order, as for regular navigation
authorGuillaume Cottenceau <gcottenc@gmail.com>
Mon, 1 Nov 2010 22:29:08 +0000 (23:29 +0100)
committerGuillaume Cottenceau <gcottenc@gmail.com>
Mon, 1 Nov 2010 22:29:08 +0000 (23:29 +0100)
bin/booh-backend

index 7660831..ab64b2c 100755 (executable)
@@ -638,19 +638,20 @@ end
 def substitute_navigation(html, xmldir)
     if xmldir.parent.name == 'dir'
         nav = ''
-        navtable = '<table id="navigation"><tr>'
+        navtable = ''
         path = '..'
         parent = xmldir.parent
         while parent.name == 'dir'
             parentcaption = parent.attributes['subdirs-caption'] || File.basename(parent.attributes['path'])
             nav = "<a href=\"#{path}/index#{$htmlsuffix}\">#{parentcaption}</a> #{defer_translation(N_(" > "))} #{nav}"
-            navtable += "<td><a href=\"#{path}/index#{$htmlsuffix}\">#{parentcaption}</a></td>"
+            navtable = "<td><a href=\"#{path}/index#{$htmlsuffix}\">#{parentcaption}</a></td>#{navtable}"
             path += '/..'
             parent = parent.parent
         end
         html.gsub!(/~~ifnavigation\?~~(.+?)~~fi~~/) { $1 }
         html.gsub!(/~~navigation~~/, nav + (xmldir.attributes['subdirs-caption'] || File.basename(xmldir.attributes['path'])))
-        html.gsub!(/~~navigationtable~~/, navtable + "<td>" + (xmldir.attributes['subdirs-caption'] || File.basename(xmldir.attributes['path'])) + "</td></tr></table>")
+        html.gsub!(/~~navigationtable~~/, '<table id="navigation"><tr>' + navtable + "<td>" +
+                                          (xmldir.attributes['subdirs-caption'] || File.basename(xmldir.attributes['path'])) + "</td></tr></table>")
     else
         html.gsub!(/~~ifnavigation\?~~(.+?)~~fi~~/, '')
     end