mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-21 16:55:47 +02: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
2 changed files with 15 additions and 1 deletions
|
|
@ -38,6 +38,7 @@ Sections
|
|||
glossary
|
||||
|
||||
|
||||
.. REMOVE_IN_PDF
|
||||
The main |app| user interface
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,8 @@ def run(self, opts):
|
|||
'-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 @@ def clean(self):
|
|||
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…
Reference in a new issue