Skip to content

Commit aa227ec

Browse files
committed
Add retrieval date to footer.
The footer now shows the date and time when a page was retrieved next to the link to the online version.
1 parent 882c687 commit aa227ec

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

preprocess.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
# along with this program. If not, see http://www.gnu.org/licenses/.
1919

2020
import argparse
21+
from datetime import datetime
2122
import fnmatch
2223
from lxml import etree
2324
import re
@@ -199,10 +200,15 @@ def preprocess_html_file(root, fn, rename_map):
199200
if id == 'cpp-navigation':
200201
items = child.find('ul')
201202
items.clear()
203+
202204
link = etree.SubElement(etree.SubElement(items, 'li'), 'a')
203205
url = re.sub('(..)/(.*)\\.html', 'http://\\1.cppreference.com/w/\\2', os.path.relpath(fn, root))
204206
link.set('href', url)
205207
link.text = 'Online version'
208+
209+
li = etree.SubElement(items, 'li')
210+
mtime = datetime.fromtimestamp(os.stat(fn).st_mtime);
211+
li.text = f"Offline version retrieved {mtime.isoformat(sep=' ', timespec='minutes')}."
206212
elif id == 'footer-info':
207213
pass
208214
else:

0 commit comments

Comments
 (0)