Fix title of Sueddeutsche recipe and fix generation of MAN pages in unicode environments

This commit is contained in:
Kovid Goyal 2009-05-26 08:59:38 -07:00
parent fe7876189c
commit e35acbf104
2 changed files with 11 additions and 8 deletions

View File

@ -16,7 +16,7 @@ def create_man_page(prog, parser):
else: else:
usage[i] = line.replace('%prog', prog) usage[i] = line.replace('%prog', prog)
lines = [ lines = [
'.TH ' + prog.upper() + ' "1" ' + time.strftime('"%B %Y"') + '.TH ' + prog.upper() + ' "1" ' + time.strftime('"%B %Y"') +
' "%s (%s %s)" "%s"'%(prog, __appname__, __version__, __appname__), ' "%s (%s %s)" "%s"'%(prog, __appname__, __version__, __appname__),
'.SH NAME', '.SH NAME',
prog + r' \- part of '+__appname__, prog + r' \- part of '+__appname__,
@ -25,7 +25,7 @@ def create_man_page(prog, parser):
'.SH DESCRIPTION', '.SH DESCRIPTION',
] ]
lines += usage[1:] lines += usage[1:]
lines += [ lines += [
'.SH OPTIONS' '.SH OPTIONS'
] ]
@ -39,7 +39,7 @@ def create_man_page(prog, parser):
help = opt.help if opt.help else '' help = opt.help if opt.help else ''
ans.append(help.replace('%prog', prog).replace('%default', str(opt.default))) ans.append(help.replace('%prog', prog).replace('%default', str(opt.default)))
return ans return ans
for opt in parser.option_list: for opt in parser.option_list:
lines.extend(format_option(opt)) lines.extend(format_option(opt))
for group in parser.option_groups: for group in parser.option_groups:
@ -48,12 +48,15 @@ def create_man_page(prog, parser):
lines.extend(['.PP', group.description]) lines.extend(['.PP', group.description])
for opt in group.option_list: for opt in group.option_list:
lines.extend(format_option(opt)) lines.extend(format_option(opt))
lines += ['.SH SEE ALSO', lines += ['.SH SEE ALSO',
'The User Manual is available at ' 'The User Manual is available at '
'http://calibre.kovidgoyal.net/user_manual', 'http://calibre.kovidgoyal.net/user_manual',
'.PP', '.B Created by '+__author__] '.PP', '.B Created by '+__author__]
return bz2.compress('\n'.join(lines)) lines = [x if isinstance(x, unicode) else unicode(x, 'utf-8', 'replace') for
x in lines]
return bz2.compress((u'\n'.join(lines)).encode('utf-8'))

View File

@ -9,7 +9,7 @@ from calibre.web.feeds.news import BasicNewsRecipe
class Sueddeutsche(BasicNewsRecipe): class Sueddeutsche(BasicNewsRecipe):
title = u'S\xc3\xbcddeutsche' title = u'S\xfcddeutsche'
description = 'News from Germany' description = 'News from Germany'
__author__ = 'Oliver Niesner' __author__ = 'Oliver Niesner'
use_embedded_content = False use_embedded_content = False