mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix duplicated sections in PDF user manual
Fixes #1215799 [double-sized calibre manual in pdf version](https://bugs.launchpad.net/calibre/+bug/1215799)
This commit is contained in:
parent
e90ba09426
commit
f0e040639c
@ -38,6 +38,7 @@ Sections
|
||||
glossary
|
||||
|
||||
|
||||
.. REMOVE_IN_PDF
|
||||
The main |app| user interface
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -84,7 +84,8 @@ class Manual(Command):
|
||||
'-d', '.build/doctrees', '.', '.build/html'])
|
||||
subprocess.check_call(['sphinx-build', '-b', 'myepub', '-d',
|
||||
'.build/doctrees', '.', '.build/epub'])
|
||||
subprocess.check_call(['sphinx-build', '-b', 'mylatex', '-d',
|
||||
with self:
|
||||
subprocess.check_call(['sphinx-build', '-b', 'mylatex', '-d',
|
||||
'.build/doctrees', '.', '.build/latex'])
|
||||
pwd = os.getcwdu()
|
||||
os.chdir('.build/latex')
|
||||
@ -107,6 +108,18 @@ class Manual(Command):
|
||||
if os.path.exists(path):
|
||||
shutil.rmtree(path)
|
||||
|
||||
def __enter__(self):
|
||||
with open('index.rst', 'r+b') as f:
|
||||
raw = self.orig_index = f.read()
|
||||
f.seek(0)
|
||||
f.truncate()
|
||||
pos = raw.index(b'.. REMOVE_IN_PDF')
|
||||
f.write(raw[:pos])
|
||||
|
||||
def __exit__(self, *args):
|
||||
with open('index.rst', 'wb') as f:
|
||||
f.write(self.orig_index)
|
||||
|
||||
class TagRelease(Command):
|
||||
|
||||
description = 'Tag a new release in git'
|
||||
|
Loading…
x
Reference in New Issue
Block a user