@@ -175,7 +175,7 @@ def preprocess_html_file(root, fn, rename_map):
175175
176176 # remove non-printable elements
177177 for el in html .xpath ('//*' ):
178- if has_class (el , ['noprint' , 'editsection' ]):
178+ if has_class (el , ['noprint' , 'editsection' ]) and el . get ( 'id' ) != 'cpp-footer-base' :
179179 el .getparent ().remove (el )
180180 if el .get ('id' ) == 'toc' :
181181 el .getparent ().remove (el )
@@ -192,6 +192,22 @@ def preprocess_html_file(root, fn, rename_map):
192192 elif el .text is not None and ('google-analytics.com/ga.js' in el .text or 'pageTracker' in el .text ):
193193 el .getparent ().remove (el )
194194
195+ # make custom footer
196+ footer = html .xpath ('//*[@id=\' footer\' ]' )[0 ]
197+ for child in footer .getchildren ():
198+ id = child .get ('id' )
199+ if id == 'cpp-navigation' :
200+ items = child .find ('ul' )
201+ items .clear ()
202+ link = etree .SubElement (etree .SubElement (items , 'li' ), 'a' )
203+ url = re .sub ('(..)/(.*)\\ .html' , 'http://\\ 1.cppreference.com/w/\\ 2' , os .path .relpath (fn , root ))
204+ link .set ('href' , url )
205+ link .text = 'Online version'
206+ elif id == 'footer-info' :
207+ pass
208+ else :
209+ footer .remove (child )
210+
195211 # apply changes to links caused by file renames
196212 for el in html .xpath ('//*[@src or @href]' ):
197213 if el .get ('src' ) is not None :
0 commit comments