Support more fine-grained lastupdated data.
This commit is contained in:
parent
d58c66af82
commit
d013172c26
|
@ -69,7 +69,7 @@ def extract_markdown_yaml(filename):
|
||||||
if 'abstract' in y:
|
if 'abstract' in y:
|
||||||
y['abstract'] = y.get('abstract').strip().replace('\n', ' ')
|
y['abstract'] = y.get('abstract').strip().replace('\n', ' ')
|
||||||
if 'lastupdated' in y:
|
if 'lastupdated' in y:
|
||||||
y['lastupdated'] = int(y.get('lastupdated'))
|
y['lastupdated'] = str(y.get('lastupdated'))
|
||||||
return y
|
return y
|
||||||
else:
|
else:
|
||||||
yaml_block += line
|
yaml_block += line
|
||||||
|
@ -110,9 +110,9 @@ def markdown_to_html(input_file, output_dir):
|
||||||
pyaml = extract_markdown_yaml(path)
|
pyaml = extract_markdown_yaml(path)
|
||||||
pages_new.append((ptitle, pyaml, url, path))
|
pages_new.append((ptitle, pyaml, url, path))
|
||||||
|
|
||||||
pages_new.append(('Potators', {'abstract': 'Do not look.', 'lastupdated': 2011}, '/potator/', '/potator/'))
|
pages_new.append(('Potators', {'abstract': 'Do not look.', 'lastupdated': '2011'}, '/potator/', '/potator/'))
|
||||||
|
|
||||||
pages_new.sort(key=lambda p: (10000 - (p[1].get('lastupdated') or 10000), p[0]))
|
pages_new.sort(key=lambda p: (p[1].get('lastupdated') or '9999', p[0]), reverse=True)
|
||||||
md = ''
|
md = ''
|
||||||
for page in pages_new:
|
for page in pages_new:
|
||||||
ptitle, pyaml, url, _ = page
|
ptitle, pyaml, url, _ = page
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
abstract: |
|
abstract: |
|
||||||
A text about the failings of digital education and "copy protection". In
|
A text about the failings of digital education and "copy protection". In
|
||||||
Danish.
|
Danish.
|
||||||
lastupdated: 2011
|
lastupdated: 2011-03
|
||||||
---
|
---
|
||||||
|
|
||||||
# Digital sikring mod gennemførsel af eksamen en realitet
|
# Digital sikring mod gennemførsel af eksamen en realitet
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
abstract: |
|
abstract: |
|
||||||
A text about the continuing failings of digital education and "copy
|
A text about the continuing failings of digital education and "copy
|
||||||
protection". In Danish.
|
protection". In Danish.
|
||||||
lastupdated: 2011
|
lastupdated: 2011-05
|
||||||
---
|
---
|
||||||
|
|
||||||
*2011.*
|
*2011.*
|
||||||
|
|
Loading…
Reference in New Issue