Add years to writings and sort based on them.

This commit is contained in:
Niels G. W. Serup 2019-10-30 13:28:37 +01:00
parent f767cec81b
commit d1fdcd7598
19 changed files with 64 additions and 10 deletions

View File

@ -53,7 +53,7 @@ def extract_markdown_title(filename):
if filename.endswith('.md'): if filename.endswith('.md'):
return os.path.basename(filename)[:-3] return os.path.basename(filename)[:-3]
def extract_markdown_abstract(filename): def extract_markdown_yaml(filename):
state = 0 state = 0
with open(filename) as f: with open(filename) as f:
for line in f: for line in f:
@ -66,7 +66,11 @@ def extract_markdown_abstract(filename):
if y is None: if y is None:
return None return None
else: else:
return y.get('abstract').strip().replace('\n', ' ') if 'abstract' in y:
y['abstract'] = y.get('abstract').strip().replace('\n', ' ')
if 'lastupdated' in y:
y['lastupdated'] = int(y.get('lastupdated'))
return y
else: else:
yaml_block += line yaml_block += line
@ -103,17 +107,22 @@ def markdown_to_html(input_file, output_dir):
for page in pages: for page in pages:
url, path = page url, path = page
ptitle = extract_markdown_title(path) ptitle = extract_markdown_title(path)
pabstract = extract_markdown_abstract(path) pyaml = extract_markdown_yaml(path)
pages_new.append((ptitle, pabstract, url, path)) pages_new.append((ptitle, pyaml, url, path))
pages_new.append(('Potators', 'Do not look.', '/potator/', '/potator/')) pages_new.append(('Potators', {'abstract': 'Do not look.', 'lastupdated': 2011}, '/potator/', '/potator/'))
pages_new.sort() pages_new.sort(key=lambda p: (10000 - (p[1].get('lastupdated') or 10000), p[0]))
md = '' md = ''
for page in pages_new: for page in pages_new:
ptitle, pabstract, url, _ = page ptitle, pyaml, url, _ = page
if pabstract is None: if pyaml is None or pyaml.get('abstract') is None:
pabstract = '(No description)' pabstract = '(No description)'
else:
pabstract = pyaml['abstract']
lu = pyaml.get('lastupdated')
if lu is not None:
pabstract += ' ({})'.format(lu)
md += '[{}]({})\n ~ {}\n\n'.format(ptitle, url, pabstract) md += '[{}]({})\n ~ {}\n\n'.format(ptitle, url, pabstract)
content = pandoc_stdin(input_base.replace('SPECIAL:ARTICLES', md)) content = pandoc_stdin(input_base.replace('SPECIAL:ARTICLES', md))

View File

@ -1,5 +1,6 @@
--- ---
abstract: A new spoken and written language not in development. abstract: A new spoken and written language not in development.
lastupdated: 2011
--- ---
# Na # Na

View File

@ -1,5 +1,6 @@
--- ---
abstract: A presentation of the new word 'atem' and why it's so desperately needed abstract: A presentation of the new word 'atem' and why it's so desperately needed
lastupdated: 2012
--- ---
# Atem: a new word # Atem: a new word

View File

@ -2,10 +2,13 @@
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
--- ---
# Digital sikring mod gennemførsel af eksamen en realitet # Digital sikring mod gennemførsel af eksamen en realitet
*2011.*
Jeg sendte denne besked til Undervisningsministeriet som så fortalte mig at de Jeg sendte denne besked til Undervisningsministeriet som så fortalte mig at de
skam nok var i gang med at gøre det nemmere for "Linus".. skam nok var i gang med at gøre det nemmere for "Linus"..

View File

@ -3,7 +3,9 @@
This is the personal website of [Niels G. W. Serup](/about/niels). This is the personal website of [Niels G. W. Serup](/about/niels).
## Articles ## Writings
My writings are spurious.
SPECIAL:ARTICLES SPECIAL:ARTICLES

View File

@ -2,10 +2,13 @@
abstract: | abstract: |
(A Long Poem.) Et langt digt jeg skrev for noget tid siden fordi (A Long Poem.) Et langt digt jeg skrev for noget tid siden fordi
jeg ikke kan lide digte. jeg ikke kan lide digte.
lastupdated: 2011
--- ---
# Et langt digt # Et langt digt
*2011.*
![Forsiden](frontpage.png) ![Forsiden](frontpage.png)
[Download digtet i PDF.](longpoem.pdf) [Download digtet i PDF.](longpoem.pdf)

View File

@ -1,10 +1,11 @@
--- ---
abstract: The Next Generation Programming Language abstract: The Next Generation Programming Language
lastupdated: 2012
--- ---
# MagicNG # MagicNG
*From 2012.* *2012.*
# Chapter 1: The Future of Yesterday # Chapter 1: The Future of Yesterday

View File

@ -1,9 +1,12 @@
--- ---
abstract: I have attempted to define a universe. abstract: I have attempted to define a universe.
lastupdated: 2013
--- ---
# My Universe # My Universe
*2013.*
Everything is much too complex, so I have defined a simpler universe. Everything is much too complex, so I have defined a simpler universe.
You can download v0.1 [here](myuniverse.pdf). You can download v0.1 [here](myuniverse.pdf).

View File

@ -1,9 +1,12 @@
--- ---
abstract: I have a NanoNote. abstract: I have a NanoNote.
lastupdated: 2011
--- ---
# My NanoNote # My NanoNote
*2011.*
![Glorious NanoNote](glorious-nanonote.jpg) ![Glorious NanoNote](glorious-nanonote.jpg)
I own a [NanoNote](http://sharism.cc/). I think it's cool (though I I own a [NanoNote](http://sharism.cc/). I think it's cool (though I

View File

@ -1,9 +1,12 @@
--- ---
abstract: Less than perfect C code abstract: Less than perfect C code
lastupdated: 2013
--- ---
# Old junk code: Word finder # Old junk code: Word finder
*2013.*
![Based on [this](https://commons.wikimedia.org/wiki/File:2001-91-1_Computer,_Laptop,_Pentagon_(5891422370).jpg), CC BY 2.0](sadcomputer.png) ![Based on [this](https://commons.wikimedia.org/wiki/File:2001-91-1_Computer,_Laptop,_Pentagon_(5891422370).jpg), CC BY 2.0](sadcomputer.png)
If you ever get tired of looking at your own junk code, take a look at this. If you ever get tired of looking at your own junk code, take a look at this.

View File

@ -1,9 +1,12 @@
--- ---
abstract: An old story abstract: An old story
lastupdated: 2011
--- ---
# Profeten, doktoren og videnskabsmanden # Profeten, doktoren og videnskabsmanden
*2011.*
"Profeten, doktoren og videnskabsmanden" ("The Prophet, the Doctor and the "Profeten, doktoren og videnskabsmanden" ("The Prophet, the Doctor and the
Scientist") is a short nonsensical story in Danish by Niels. It is available Scientist") is a short nonsensical story in Danish by Niels. It is available
under CC BY-SA 3.0+ as an A5-sized pdf. under CC BY-SA 3.0+ as an A5-sized pdf.

View File

@ -1,9 +1,12 @@
--- ---
abstract: How to combine two Pythonic graphical frameworks abstract: How to combine two Pythonic graphical frameworks
lastupdated: 2011
--- ---
# Combining PyGame and PyCairo # Combining PyGame and PyCairo
*2011. Most likely very outdated.*
**Note:** See **Note:** See
[http://pygame.org/wiki/CairoPygame](http://pygame.org/wiki/CairoPygame) [http://pygame.org/wiki/CairoPygame](http://pygame.org/wiki/CairoPygame)
for other examples. for other examples.

View File

@ -1,9 +1,12 @@
--- ---
abstract: Programming sound in Live-Sequencer and ChucK abstract: Programming sound in Live-Sequencer and ChucK
lastupdated: 2013
--- ---
# Sound Programming # Sound Programming
*2013.*
Much can be programmed, and that includes sound. In the digital world, Much can be programmed, and that includes sound. In the digital world,
sound is typically represented by sequences of about 90 kB per second, sound is typically represented by sequences of about 90 kB per second,
so "printing" sound is merely a matter of printing bytes. As such, any so "printing" sound is merely a matter of printing bytes. As such, any

View File

@ -2,8 +2,11 @@
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
--- ---
*2011.*
Jeg sendte denne besked til Undervisningsministeriet som så forklarede at de Jeg sendte denne besked til Undervisningsministeriet som så forklarede at de
var nødt til at bruge kopisikring fordi de brugte tekst, billeder og video fra var nødt til at bruge kopisikring fordi de brugte tekst, billeder og video fra
eksterne kilder (såsom BBC). Det må være muligt for dem at lave bedre aftaler i eksterne kilder (såsom BBC). Det må være muligt for dem at lave bedre aftaler i

View File

@ -1,9 +1,12 @@
--- ---
abstract: An old story abstract: An old story
lastupdated: 2011
--- ---
# The Trasbexian Flow Regulator # The Trasbexian Flow Regulator
*2011.*
"The Trasbexian Flow Regulator" is a short story by Niels. It is available under CC "The Trasbexian Flow Regulator" is a short story by Niels. It is available under CC
BY-SA 3.0+ as an A5-sized 12-paged pdf. BY-SA 3.0+ as an A5-sized 12-paged pdf.

View File

@ -1,5 +1,6 @@
--- ---
abstract: My master's thesis, including an overview of it in Danish. abstract: My master's thesis, including an overview of it in Danish.
lastupdated: 2017
--- ---
# My Master's Thesis # My Master's Thesis

View File

@ -1,9 +1,12 @@
--- ---
abstract: Not one. abstract: Not one.
lastupdated: 2015
--- ---
# Two spaces # Two spaces
*2015.*
When I end a sentence and intend on writing a new, I type two spaces instead of When I end a sentence and intend on writing a new, I type two spaces instead of
one. one.

View File

@ -1,5 +1,6 @@
--- ---
abstract: Wrote it because it was fun, stopped when it was not fun anymore. abstract: Wrote it because it was fun, stopped when it was not fun anymore.
lastupdated: 2012
--- ---
![Front page](frontpage.png) ![Front page](frontpage.png)
@ -8,6 +9,8 @@ abstract: Wrote it because it was fun, stopped when it was not fun anymore.
# Unnamed Good Story # Unnamed Good Story
*2012.*
1. Good (it's in the title) 1. Good (it's in the title)
2. 9 word-packed chapters full of words 2. 9 word-packed chapters full of words
3. Good, simple language 3. Good, simple language

View File

@ -1,5 +1,6 @@
--- ---
abstract: Rant about Haskell's parser "Happy". abstract: Rant about Haskell's parser "Happy".
lastupdated: 2014
--- ---
![](UNHAPPY.PNG) ![](UNHAPPY.PNG)
@ -7,6 +8,8 @@ abstract: Rant about Haskell's parser "Happy".
# Unhappy About Happy: A Reflection or Something Like That # Unhappy About Happy: A Reflection or Something Like That
*2014.*
For the purposes of my quiet rage, this document will be written in all For the purposes of my quiet rage, this document will be written in all
caps. I also will not use proper language. I won't even give suggestions caps. I also will not use proper language. I won't even give suggestions
on how to improve Happy; I'll just complain. on how to improve Happy; I'll just complain.