mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use XeLateX to build PDF manual which does not fail for chinese and turkish languages
This commit is contained in:
parent
22ead7db5a
commit
1e6d8cee00
@ -40,7 +40,6 @@ def sphinx_build(language, base, builder='html', bdir='html', t=None, quiet=True
|
|||||||
|
|
||||||
def build_manual(language, base):
|
def build_manual(language, base):
|
||||||
sb = partial(sphinx_build, language, base)
|
sb = partial(sphinx_build, language, base)
|
||||||
skip_pdf = language == 'tr' or 'zh' in language
|
|
||||||
onlinedir = sb(t='online')
|
onlinedir = sb(t='online')
|
||||||
epubdir = sb('myepub', 'epub')
|
epubdir = sb('myepub', 'epub')
|
||||||
latexdir = sb('mylatex', 'latex')
|
latexdir = sb('mylatex', 'latex')
|
||||||
@ -52,22 +51,20 @@ def build_manual(language, base):
|
|||||||
p.stdin.close()
|
p.stdin.close()
|
||||||
return p.wait()
|
return p.wait()
|
||||||
try:
|
try:
|
||||||
if not skip_pdf:
|
for i in range(3):
|
||||||
for i in range(3):
|
run_cmd(['xelatex', '-interaction=nonstopmode', 'calibre.tex'])
|
||||||
run_cmd(['pdflatex', '-interaction=nonstopmode', 'calibre.tex'])
|
run_cmd(['makeindex', '-s', 'python.ist', 'calibre.idx'])
|
||||||
run_cmd(['makeindex', '-s', 'python.ist', 'calibre.idx'])
|
for i in range(2):
|
||||||
for i in range(2):
|
run_cmd(['xelatex', '-interaction=nonstopmode', 'calibre.tex'])
|
||||||
run_cmd(['pdflatex', '-interaction=nonstopmode', 'calibre.tex'])
|
if not os.path.exists('calibre.pdf'):
|
||||||
if not os.path.exists('calibre.pdf'):
|
print('Failed to build pdf file, see calibre.log in the latex directory', file=sys.stderr)
|
||||||
print('Failed to build pdf file, see calibre.log in the latex directory', file=sys.stderr)
|
raise SystemExit(1)
|
||||||
raise SystemExit(1)
|
|
||||||
finally:
|
finally:
|
||||||
os.chdir(pwd)
|
os.chdir(pwd)
|
||||||
epub_dest = j(onlinedir, 'calibre.epub')
|
epub_dest = j(onlinedir, 'calibre.epub')
|
||||||
pdf_dest = j(onlinedir, 'calibre.pdf')
|
pdf_dest = j(onlinedir, 'calibre.pdf')
|
||||||
shutil.copyfile(j(epubdir, 'calibre.epub'), epub_dest)
|
shutil.copyfile(j(epubdir, 'calibre.epub'), epub_dest)
|
||||||
if not skip_pdf:
|
shutil.copyfile(j(latexdir, 'calibre.pdf'), pdf_dest)
|
||||||
shutil.copyfile(j(latexdir, 'calibre.pdf'), pdf_dest)
|
|
||||||
epub_to_azw3(epub_dest)
|
epub_to_azw3(epub_dest)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user