Browse Source

try sorting based on locale preferences

remotes/origin/staging
Romain Goffe 13 years ago
parent
commit
551fcd3df5
  1. 3
      songbook-makeindex.py
  2. 3
      songbook.py

3
songbook-makeindex.py

@ -13,6 +13,7 @@ import sys
import os.path
import glob
import re
import locale
from optparse import OptionParser
# Pattern set to ignore latex command in title prefix
@ -59,7 +60,7 @@ class index:
def idxBlockToStr(self, letter, entries):
str = '\\begin{idxblock}{'+letter+'}'+'\n'
for key in sorted(entries.keys()):
for key in sorted(entries.keys(), cmp=locale.strcoll):
str += self.entryToStr(key, entries[key])
str += '\\end{idxblock}'+'\n'
return str

3
songbook.py

@ -7,6 +7,7 @@ import os.path
import glob
import re
import json
import locale
def matchRegexp(reg, iterable):
return [ m.group(1) for m in (reg.match(l) for l in iterable) if m ]
@ -94,7 +95,7 @@ def makeTexFile(sb, output):
# output songslist
if songs == "all":
songs = map(lambda x: x[6:], glob.glob('songs/*/*.sg'))
songs.sort()
songs = sorted(songs, cmp=locale.strcoll)
if len(songs) > 0:
out.write(formatDefinition('songslist', songslist(songs)))
out.write('\\makeatother\n')

Loading…
Cancel
Save