This function was iterating over a table with pairs() to generate output (the
sample theme file). Since pairs() does not guarantee any iteration order, this
lead to a different order each time this file was generated. This is, for
example, visible in the diffs in the generate api documentation repository.
Fix this by using a self-made iteration function which behaves like pairs(), but
guarantees an iteration order sorted by keys.
Signed-off-by: Uli Schlachter <psychon@znc.in>