rebuilt with path for python-packaging 25 [release 0.103.1-2mamba;Wed May 21 2025]
This commit is contained in:
parent
02d50e5370
commit
2227f20f75
91
rst2pdf-0.103.1-python-packaging-25.patch
Normal file
91
rst2pdf-0.103.1-python-packaging-25.patch
Normal file
@ -0,0 +1,91 @@
|
||||
From e7f7dd78768ff756e0c0c5702fe7972bda20ecc2 Mon Sep 17 00:00:00 2001
|
||||
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
|
||||
Date: Sat, 19 Apr 2025 14:49:46 +0000
|
||||
Subject: [PATCH] Update dependency packaging to v25
|
||||
|
||||
---
|
||||
pyproject.toml | 2 +-
|
||||
uv.lock | 15 ++++++++-------
|
||||
2 files changed, 9 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/pyproject.toml b/pyproject.toml
|
||||
index 980f5dd62..303cd6db7 100644
|
||||
--- a/pyproject.toml
|
||||
+++ b/pyproject.toml
|
||||
@@ -27,7 +27,7 @@ dependencies = [
|
||||
"docutils~=0.21.2",
|
||||
"importlib-metadata~=8.0",
|
||||
"jinja2~=3.0",
|
||||
- "packaging~=24.0",
|
||||
+ "packaging~=25.0",
|
||||
"pygments~=2.0",
|
||||
"pyyaml~=6.0",
|
||||
"reportlab~=4.0",
|
||||
diff --git a/uv.lock b/uv.lock
|
||||
index 8ef08275c..f5b955e95 100644
|
||||
--- a/uv.lock
|
||||
+++ b/uv.lock
|
||||
@@ -1,4 +1,5 @@
|
||||
version = 1
|
||||
+revision = 1
|
||||
requires-python = ">=3.9"
|
||||
|
||||
[[package]]
|
||||
@@ -222,7 +223,7 @@ name = "click"
|
||||
version = "8.1.7"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
- { name = "colorama", marker = "platform_system == 'Windows'" },
|
||||
+ { name = "colorama", marker = "sys_platform == 'win32'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/96/d3/f04c7bfcf5c1862a2a5b845c6b2b360488cf47af55dfa79c98f6a6bf98b5/click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de", size = 336121 }
|
||||
wheels = [
|
||||
@@ -958,11 +959,11 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "packaging"
|
||||
-version = "24.2"
|
||||
+version = "25.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
-sdist = { url = "https://files.pythonhosted.org/packages/d0/63/68dbb6eb2de9cb10ee4c9c14a0148804425e13c4fb20d61cce69f53106da/packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f", size = 163950 }
|
||||
+sdist = { url = "https://files.pythonhosted.org/packages/a1/d4/1fc4078c65507b51b96ca8f8c3ba19e6a61c8253c72794544580a7b6c24d/packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f", size = 165727 }
|
||||
wheels = [
|
||||
- { url = "https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759", size = 65451 },
|
||||
+ { url = "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", size = 66469 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1413,7 +1414,6 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "rst2pdf"
|
||||
-version = "0.103.1"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "docutils" },
|
||||
@@ -1460,7 +1460,7 @@ requires-dist = [
|
||||
{ name = "importlib-metadata", specifier = "~=8.0" },
|
||||
{ name = "jinja2", specifier = "~=3.0" },
|
||||
{ name = "matplotlib", marker = "extra == 'mathsupport'" },
|
||||
- { name = "packaging", specifier = "~=24.0" },
|
||||
+ { name = "packaging", specifier = "~=25.0" },
|
||||
{ name = "plantuml", marker = "extra == 'plantumlsupport'" },
|
||||
{ name = "pygments", specifier = "~=2.0" },
|
||||
{ name = "pyyaml", specifier = "~=6.0" },
|
||||
@@ -1469,6 +1469,7 @@ requires-dist = [
|
||||
{ name = "svglib", marker = "extra == 'svgsupport'" },
|
||||
{ name = "xhtml2pdf", marker = "extra == 'rawhtmlsupport'" },
|
||||
]
|
||||
+provides-extras = ["aafiguresupport", "mathsupport", "plantumlsupport", "rawhtmlsupport", "sphinx", "svgsupport"]
|
||||
|
||||
[package.metadata.requires-dev]
|
||||
dev = [
|
||||
@@ -1665,7 +1666,7 @@ name = "tzlocal"
|
||||
version = "5.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
- { name = "tzdata", marker = "platform_system == 'Windows'" },
|
||||
+ { name = "tzdata", marker = "sys_platform == 'win32'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/04/d3/c19d65ae67636fe63953b20c2e4a8ced4497ea232c43ff8d01db16de8dc0/tzlocal-5.2.tar.gz", hash = "sha256:8d399205578f1a9342816409cc1e46a93ebd5755e39ea2d85334bea911bf0e6e", size = 30201 }
|
||||
wheels = [
|
262
rst2pdf-0.103.1-remove-smartypants_use_docutils_version.patch
Normal file
262
rst2pdf-0.103.1-remove-smartypants_use_docutils_version.patch
Normal file
@ -0,0 +1,262 @@
|
||||
From 31f8a129389945c4dbff583dcc41792351226fae Mon Sep 17 00:00:00 2001
|
||||
From: Lorna Jane Mitchell <lorna@lornajane.net>
|
||||
Date: Sun, 22 Dec 2024 18:27:59 +0000
|
||||
Subject: [PATCH 1/4] Remove smartypants, use the docutils version
|
||||
|
||||
---
|
||||
pyproject.toml | 1 -
|
||||
rst2pdf/basenodehandler.py | 10 +++++-----
|
||||
rst2pdf/createpdf.py | 13 +++----------
|
||||
uv.lock | 14 ++------------
|
||||
4 files changed, 10 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/pyproject.toml b/pyproject.toml
|
||||
index 4701243d1..55c4e8a69 100644
|
||||
--- a/pyproject.toml
|
||||
+++ b/pyproject.toml
|
||||
@@ -30,7 +30,6 @@ dependencies = [
|
||||
"pygments~=2.0",
|
||||
"pyyaml~=6.0",
|
||||
"reportlab~=4.0",
|
||||
- "smartypants~=2.0",
|
||||
]
|
||||
description = "Convert reStructured Text to PDF via ReportLab."
|
||||
dynamic = ["version"]
|
||||
diff --git a/rst2pdf/basenodehandler.py b/rst2pdf/basenodehandler.py
|
||||
index 0c5bcbb4a..caa7c9c6e 100644
|
||||
--- a/rst2pdf/basenodehandler.py
|
||||
+++ b/rst2pdf/basenodehandler.py
|
||||
@@ -35,8 +35,8 @@
|
||||
import inspect
|
||||
import types
|
||||
|
||||
-from smartypants import smartypants
|
||||
import docutils.nodes
|
||||
+from docutils.utils import smartquotes
|
||||
|
||||
from .flowables import BoundByWidth, TocEntry
|
||||
from .log import log, nodeid
|
||||
@@ -290,14 +290,14 @@ def get_pre_post(self, client, node, replaceEnt):
|
||||
def get_text(self, client, node, replaceEnt):
|
||||
return client.gather_pdftext(node)
|
||||
|
||||
- def apply_smartypants(self, text, smarty, node):
|
||||
- # Try to be clever about when to use smartypants
|
||||
+ def apply_replacements(self, text, smarty, node):
|
||||
+ # Try to be clever about when to replace characters
|
||||
if node.__class__ in (
|
||||
docutils.nodes.paragraph,
|
||||
docutils.nodes.block_quote,
|
||||
docutils.nodes.title,
|
||||
):
|
||||
- return smartypants(text, smarty)
|
||||
+ return smartquotes.smartyPants(text, smarty)
|
||||
return text
|
||||
|
||||
# End overridable attributes and methods for textdispatch
|
||||
@@ -313,6 +313,6 @@ def textdispatch(self, client, node, replaceEnt=True):
|
||||
except UnicodeDecodeError:
|
||||
pass
|
||||
|
||||
- text = self.apply_smartypants(text, client.smartypants_attributes, node)
|
||||
+ text = self.apply_replacements(text, client.smartypants_attributes, node)
|
||||
node.pdftext = text
|
||||
return text
|
||||
diff --git a/rst2pdf/createpdf.py b/rst2pdf/createpdf.py
|
||||
index 6bf93cf6b..1ff5ce955 100644
|
||||
--- a/rst2pdf/createpdf.py
|
||||
+++ b/rst2pdf/createpdf.py
|
||||
@@ -55,6 +55,7 @@
|
||||
from docutils.readers import standalone
|
||||
from docutils.transforms import Transform
|
||||
from docutils.utils import DependencyList
|
||||
+from docutils.utils import smartquotes
|
||||
|
||||
try:
|
||||
from roman import toRoman
|
||||
@@ -102,7 +103,6 @@
|
||||
from rst2pdf.sinker import Sinker
|
||||
from rst2pdf.image import MyImage, missing
|
||||
from rst2pdf.log import log, nodeid
|
||||
-from smartypants import smartypants
|
||||
from rst2pdf import styles as sty
|
||||
from rst2pdf.nodehandlers import nodehandlers
|
||||
from rst2pdf.languages import get_language_available
|
||||
@@ -213,14 +213,7 @@ def __init__(
|
||||
self.background_fit_mode = background_fit_mode
|
||||
self.to_unlink = []
|
||||
|
||||
- # See https://pythonhosted.org/smartypants/reference.html#smartypants-module
|
||||
- self.smartypants_attributes = 0
|
||||
- if smarty == '1':
|
||||
- self.smartypants_attributes = 1 | 6 | 8 | 64 | 512
|
||||
- elif smarty == '2':
|
||||
- self.smartypants_attributes = 1 | 6 | 24 | 64 | 512
|
||||
- elif smarty == '3':
|
||||
- self.smartypants_attributes = 1 | 6 | 40 | 64 | 512
|
||||
+ self.smartypants_attributes = smarty
|
||||
|
||||
self.baseurl = baseurl
|
||||
self.repeat_table_rows = repeat_table_rows
|
||||
@@ -1008,7 +1001,7 @@ def replace(text):
|
||||
text = text.replace(u"###Title###", doc.title)
|
||||
text = text.replace(u"###Section###", getattr(canv, 'sectName', ''))
|
||||
text = text.replace(u"###SectNum###", getattr(canv, 'sectNum', ''))
|
||||
- text = smartypants(text, smarty)
|
||||
+ text = smartquotes.smartyPants(text, smarty)
|
||||
return text
|
||||
|
||||
for i, e in enumerate(elems):
|
||||
diff --git a/uv.lock b/uv.lock
|
||||
index ceefd82e3..84d0aee3d 100644
|
||||
--- a/uv.lock
|
||||
+++ b/uv.lock
|
||||
@@ -222,7 +222,7 @@ name = "click"
|
||||
version = "8.1.7"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
- { name = "colorama", marker = "sys_platform == 'win32'" },
|
||||
+ { name = "colorama", marker = "platform_system == 'Windows'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/96/d3/f04c7bfcf5c1862a2a5b845c6b2b360488cf47af55dfa79c98f6a6bf98b5/click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de", size = 336121 }
|
||||
wheels = [
|
||||
@@ -1423,7 +1423,6 @@ dependencies = [
|
||||
{ name = "pygments" },
|
||||
{ name = "pyyaml" },
|
||||
{ name = "reportlab" },
|
||||
- { name = "smartypants" },
|
||||
]
|
||||
|
||||
[package.optional-dependencies]
|
||||
@@ -1466,7 +1465,6 @@ requires-dist = [
|
||||
{ name = "pygments", specifier = "~=2.0" },
|
||||
{ name = "pyyaml", specifier = "~=6.0" },
|
||||
{ name = "reportlab", specifier = "~=4.0" },
|
||||
- { name = "smartypants", specifier = "~=2.0" },
|
||||
{ name = "sphinx", marker = "extra == 'sphinx'", specifier = ">7.3" },
|
||||
{ name = "svglib", marker = "extra == 'svgsupport'" },
|
||||
{ name = "xhtml2pdf", marker = "extra == 'rawhtmlsupport'" },
|
||||
@@ -1489,14 +1487,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", size = 11050 },
|
||||
]
|
||||
|
||||
-[[package]]
|
||||
-name = "smartypants"
|
||||
-version = "2.0.1"
|
||||
-source = { registry = "https://pypi.org/simple" }
|
||||
-wheels = [
|
||||
- { url = "https://files.pythonhosted.org/packages/da/ed/1da76d11aa858ee23dac5b52d9ac2db7df02b89f7679d5d8970bcd44b59c/smartypants-2.0.1-py2.py3-none-any.whl", hash = "sha256:8db97f7cbdf08d15b158a86037cd9e116b4cf37703d24e0419a0d64ca5808f0d", size = 9875 },
|
||||
-]
|
||||
-
|
||||
[[package]]
|
||||
name = "snowballstemmer"
|
||||
version = "2.2.0"
|
||||
@@ -1675,7 +1665,7 @@ name = "tzlocal"
|
||||
version = "5.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
- { name = "tzdata", marker = "sys_platform == 'win32'" },
|
||||
+ { name = "tzdata", marker = "platform_system == 'Windows'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/04/d3/c19d65ae67636fe63953b20c2e4a8ced4497ea232c43ff8d01db16de8dc0/tzlocal-5.2.tar.gz", hash = "sha256:8d399205578f1a9342816409cc1e46a93ebd5755e39ea2d85334bea911bf0e6e", size = 30201 }
|
||||
wheels = [
|
||||
|
||||
From fb450d7ee66f44a17e084d559eb695a053b84b06 Mon Sep 17 00:00:00 2001
|
||||
From: Lorna Jane Mitchell <lorna@lornajane.net>
|
||||
Date: Sun, 5 Jan 2025 20:26:29 +0000
|
||||
Subject: [PATCH 2/4] Update reference PDFs to correct curly quotes and include
|
||||
more context
|
||||
|
||||
---
|
||||
tests/input/sphinx-smartquotes/index.rst | 13 ++++++++-----
|
||||
tests/input/test_smarty.rst | 13 ++++++++-----
|
||||
2 files changed, 16 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/tests/input/sphinx-smartquotes/index.rst b/tests/input/sphinx-smartquotes/index.rst
|
||||
index d8b11c759..3c6aedec8 100644
|
||||
--- a/tests/input/sphinx-smartquotes/index.rst
|
||||
+++ b/tests/input/sphinx-smartquotes/index.rst
|
||||
@@ -3,12 +3,15 @@ rst2pdf Sphinx pdf_smartquotes test
|
||||
|
||||
This test ensures that the ``pdf_smartquotes`` config option works.
|
||||
|
||||
-A -- B
|
||||
+A -- B has an en-dash between A and B
|
||||
|
||||
-A --- B
|
||||
+A --- B has an em-dash between A and B
|
||||
|
||||
-"A B"
|
||||
+"A B" has curly quotes around A and B
|
||||
|
||||
-A ... B
|
||||
+\`\`A B'' has curly quotes around A and B
|
||||
+
|
||||
+A ... B has an elipsis between A and B
|
||||
+
|
||||
+A . . . B has an elipsis between A and B
|
||||
|
||||
-\`\`A B''
|
||||
diff --git a/tests/input/test_smarty.rst b/tests/input/test_smarty.rst
|
||||
index 0ead38164..8b6e561de 100644
|
||||
--- a/tests/input/test_smarty.rst
|
||||
+++ b/tests/input/test_smarty.rst
|
||||
@@ -1,9 +1,12 @@
|
||||
-A -- B
|
||||
+A -- B has an en-dash between A and B
|
||||
|
||||
-A --- B
|
||||
+A --- B has an em-dash between A and B
|
||||
|
||||
-"A B"
|
||||
+"A B" has curly quotes around A and B
|
||||
|
||||
-A ... B
|
||||
+\`\`A B'' has curly quotes around A and B
|
||||
+
|
||||
+A ... B has an elipsis between A and B
|
||||
+
|
||||
+A . . . B has an elipsis between A and B
|
||||
|
||||
-\`\`A B''
|
||||
|
||||
From 53ce86b2c872eef5bf7e7fb31c4dee7834ac3be5 Mon Sep 17 00:00:00 2001
|
||||
From: Lorna Jane Mitchell <lorna@lornajane.net>
|
||||
Date: Sun, 5 Jan 2025 20:33:56 +0000
|
||||
Subject: [PATCH 3/4] Add updated reference PDFs to go with updated input files
|
||||
|
||||
---
|
||||
tests/reference/sphinx-smartquotes.pdf | Bin 2869 -> 3142 bytes
|
||||
tests/reference/test_smarty.pdf | Bin 1957 -> 2201 bytes
|
||||
2 files changed, 0 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/tests/input/sphinx-smartquotes/index.rst b/tests/input/sphinx-smartquotes/index.rst
|
||||
index 3c6aedec8..e8844328b 100644
|
||||
--- a/tests/input/sphinx-smartquotes/index.rst
|
||||
+++ b/tests/input/sphinx-smartquotes/index.rst
|
||||
@@ -7,7 +7,9 @@ A -- B has an en-dash between A and B
|
||||
|
||||
A --- B has an em-dash between A and B
|
||||
|
||||
-"A B" has curly quotes around A and B
|
||||
+"A B" has curly double quotes around A and B
|
||||
+
|
||||
+'A B' has curly single quotes around A and B
|
||||
|
||||
\`\`A B'' has curly quotes around A and B
|
||||
|
||||
diff --git a/tests/input/test_smarty.rst b/tests/input/test_smarty.rst
|
||||
index 8b6e561de..af1f131ea 100644
|
||||
--- a/tests/input/test_smarty.rst
|
||||
+++ b/tests/input/test_smarty.rst
|
||||
@@ -2,7 +2,9 @@ A -- B has an en-dash between A and B
|
||||
|
||||
A --- B has an em-dash between A and B
|
||||
|
||||
-"A B" has curly quotes around A and B
|
||||
+"A B" has curly double quotes around A and B
|
||||
+
|
||||
+'A B' has curly single quotes around A and B
|
||||
|
||||
\`\`A B'' has curly quotes around A and B
|
||||
|
@ -1,787 +0,0 @@
|
||||
--- rst2pdf-0.16/rst2pdf/createpdf.py.orig 2010-10-06 23:21:41.000000000 +0200
|
||||
+++ rst2pdf-0.16/rst2pdf/createpdf.py 2011-10-07 18:41:42.000000000 +0200
|
||||
@@ -1,8 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
-#$HeadURL: https://rst2pdf.googlecode.com/svn/tags/0.16/rst2pdf/createpdf.py $
|
||||
-#$LastChangedDate: 2010-10-06 18:21:41 -0300 (Wed, 06 Oct 2010) $
|
||||
-#$LastChangedRevision: 2396 $
|
||||
+#$HeadURL$
|
||||
+#$LastChangedDate$
|
||||
+#$LastChangedRevision$
|
||||
|
||||
# See LICENSE.txt for licensing terms
|
||||
|
||||
@@ -65,7 +65,7 @@ from docutils.readers import standalone
|
||||
from docutils.transforms import Transform
|
||||
|
||||
import pygments_code_block_directive # code-block directive
|
||||
-import oddeven_directive
|
||||
+import oddeven_directive
|
||||
|
||||
from reportlab.platypus import *
|
||||
from reportlab.platypus.doctemplate import IndexingFlowable
|
||||
@@ -125,13 +125,13 @@ from nodehandlers import nodehandlers
|
||||
'lowerroman': 'ROMAN_LOWER',
|
||||
'alpha': 'LETTERS_UPPER',
|
||||
'loweralpha': 'LETTERS_LOWER' }
|
||||
-
|
||||
+
|
||||
|
||||
|
||||
class RstToPdf(object):
|
||||
|
||||
def __init__(self, stylesheets=[],
|
||||
- language='en',
|
||||
+ language='en_US',
|
||||
header=None,
|
||||
footer=None,
|
||||
inlinelinks=False,
|
||||
@@ -157,6 +157,7 @@ from nodehandlers import nodehandlers
|
||||
custom_cover='cover.tmpl',
|
||||
floating_images=False,
|
||||
numbered_links=False,
|
||||
+ section_header_depth=2
|
||||
):
|
||||
self.debugLinesPdf=False
|
||||
self.depth=0
|
||||
@@ -165,17 +166,19 @@ from nodehandlers import nodehandlers
|
||||
self.splittables=splittables
|
||||
self.basedir=basedir
|
||||
self.language = language
|
||||
+ self.docutils_language = language
|
||||
try:
|
||||
- get_language (self.language)
|
||||
+ self.get_language(self.language)
|
||||
except ImportError:
|
||||
try:
|
||||
language = self.language.split('_', 1)[0]
|
||||
- get_language (language)
|
||||
- self.language = language
|
||||
+ self.get_language(language)
|
||||
+ self.docutils_language = language
|
||||
except ImportError:
|
||||
- log.warning("Can't load Docutils module "\
|
||||
- "for language %s or %s", self.language, language)
|
||||
- self.language = 'en'
|
||||
+ log.warning("Can't load Docutils module"
|
||||
+ " for language %s or %s", self.language, language)
|
||||
+ self.language = 'en_US'
|
||||
+ self.docutils_language = 'en'
|
||||
self.doc_title = ""
|
||||
self.doc_title_clean = ""
|
||||
self.doc_subtitle = ""
|
||||
@@ -193,13 +196,13 @@ from nodehandlers import nodehandlers
|
||||
self.PATH = abspath(dirname(sys.executable))
|
||||
else:
|
||||
self.PATH = abspath(dirname(__file__))
|
||||
-
|
||||
-
|
||||
+
|
||||
+
|
||||
self.font_path=font_path
|
||||
self.style_path=style_path
|
||||
self.def_dpi=def_dpi
|
||||
self.loadStyles(stylesheets)
|
||||
-
|
||||
+
|
||||
self.docutils_languages = {}
|
||||
self.inlinelinks = inlinelinks
|
||||
self.breaklevel = breaklevel
|
||||
@@ -218,6 +221,7 @@ from nodehandlers import nodehandlers
|
||||
self.def_dpi = def_dpi
|
||||
self.show_frame = show_frame
|
||||
self.numbered_links = numbered_links
|
||||
+ self.section_header_depth = section_header_depth
|
||||
self.img_dir = os.path.join(self.PATH, 'images')
|
||||
|
||||
# Sorry about this, but importing sphinx.roles makes some
|
||||
@@ -242,18 +246,20 @@ from nodehandlers import nodehandlers
|
||||
if self.language:
|
||||
self.styles.languages.append(self.language)
|
||||
self.styles['bodytext'].language = self.language
|
||||
-
|
||||
+ else:
|
||||
+ self.styles.languages.append('en_US')
|
||||
+ self.styles['bodytext'].language = 'en_US'
|
||||
# Load the docutils language modules for all required languages
|
||||
for lang in self.styles.languages:
|
||||
try:
|
||||
- self.docutils_languages[lang] = get_language(lang)
|
||||
+ self.docutils_languages[lang] = self.get_language(lang)
|
||||
except ImportError:
|
||||
try:
|
||||
self.docutils_languages[lang] = \
|
||||
- get_language(lang.split('_', 1)[0])
|
||||
+ self.get_language(lang.split('_', 1)[0])
|
||||
except ImportError:
|
||||
- log.warning("Can't load Docutils module \
|
||||
- for language %s", lang)
|
||||
+ log.warning("Can't load Docutils module"
|
||||
+ " for language %s", lang)
|
||||
|
||||
# Load the hyphenators for all required languages
|
||||
if wordaxe is not None:
|
||||
@@ -265,8 +271,8 @@ from nodehandlers import nodehandlers
|
||||
except Exception:
|
||||
# hyphenators may not always be available or crash,
|
||||
# e.g. wordaxe issue 2809074 (http://is.gd/16lqs)
|
||||
- log.warning("Can't load wordaxe DCW hyphenator "
|
||||
- "for German language, trying Py hyphenator instead")
|
||||
+ log.warning("Can't load wordaxe DCW hyphenator"
|
||||
+ " for German language, trying Py hyphenator instead")
|
||||
else:
|
||||
continue
|
||||
try:
|
||||
@@ -286,17 +292,25 @@ from nodehandlers import nodehandlers
|
||||
|
||||
self.pending_targets=[]
|
||||
self.targets=[]
|
||||
-
|
||||
+
|
||||
def loadStyles(self, styleSheets=None ):
|
||||
-
|
||||
+
|
||||
if styleSheets is None:
|
||||
styleSheets=[]
|
||||
-
|
||||
+
|
||||
self.styles = sty.StyleSheet(styleSheets,
|
||||
self.font_path,
|
||||
self.style_path,
|
||||
def_dpi=self.def_dpi)
|
||||
|
||||
+ def get_language(self, lang):
|
||||
+ try:
|
||||
+ return get_language(lang, reporter=log)
|
||||
+ except TypeError, err: # Docutils < 0.8
|
||||
+ if 'get_language' in str(err) and 'reporter' in str(err):
|
||||
+ return get_language(lang)
|
||||
+ raise # re-raise any other TypeError
|
||||
+
|
||||
def style_language(self, style):
|
||||
"""Return language corresponding to this style."""
|
||||
try:
|
||||
@@ -318,8 +332,8 @@ from nodehandlers import nodehandlers
|
||||
def text_for_label(self, label, style):
|
||||
"""Translate text for label."""
|
||||
try:
|
||||
- text = self.docutils_languages[self.style_language(style)]\
|
||||
- .labels[label]
|
||||
+ text = self.docutils_languages[
|
||||
+ self.style_language(style)].labels[label]
|
||||
except KeyError:
|
||||
text = label.capitalize()
|
||||
return text
|
||||
@@ -327,8 +341,8 @@ from nodehandlers import nodehandlers
|
||||
def text_for_bib_field(self, field, style):
|
||||
"""Translate text for bibliographic fields."""
|
||||
try:
|
||||
- text = self.docutils_languages[self.style_language(style)]\
|
||||
- .bibliographic_fields[field]
|
||||
+ text = self.docutils_languages[
|
||||
+ self.style_language(style)].bibliographic_fields[field]
|
||||
except KeyError:
|
||||
text = field
|
||||
return text + ":"
|
||||
@@ -336,8 +350,8 @@ from nodehandlers import nodehandlers
|
||||
def author_separator(self, style):
|
||||
"""Return separator string for authors."""
|
||||
try:
|
||||
- sep = self.docutils_languages[self.style_language(style)]\
|
||||
- .author_separators[0]
|
||||
+ sep = self.docutils_languages[
|
||||
+ self.style_language(style)].author_separators[0]
|
||||
except KeyError:
|
||||
sep = ';'
|
||||
return sep + " "
|
||||
@@ -366,13 +380,12 @@ from nodehandlers import nodehandlers
|
||||
if s.underline:
|
||||
r1.append('<u>')
|
||||
r2.insert(0,'</u>')
|
||||
-
|
||||
+
|
||||
return [''.join(r1), ''.join(r2)]
|
||||
except KeyError:
|
||||
log.warning('Unknown class %s', style)
|
||||
return None
|
||||
|
||||
-
|
||||
|
||||
def styleToFont(self, style):
|
||||
'''Takes a style name, returns a font tag for it, like
|
||||
@@ -387,7 +400,7 @@ from nodehandlers import nodehandlers
|
||||
if bc:
|
||||
r.append('backColor="#%s"' % bc.hexval()[2:])
|
||||
if s.trueFontSize:
|
||||
- r.append('size="%d"'%s.fontSize)
|
||||
+ r.append('size="%d"'%s.fontSize)
|
||||
r.append('>')
|
||||
return ''.join(r)
|
||||
except KeyError:
|
||||
@@ -420,14 +433,14 @@ from nodehandlers import nodehandlers
|
||||
else:
|
||||
start = 1
|
||||
|
||||
- if node.parent.get('bullet') or \
|
||||
- isinstance(node.parent, docutils.nodes.bullet_list):
|
||||
- b = node.parent.get('bullet','*')
|
||||
+ if node.parent.get('bullet') or isinstance(
|
||||
+ node.parent, docutils.nodes.bullet_list):
|
||||
+ b = node.parent.get('bullet', '*')
|
||||
if b == "None":
|
||||
b = ""
|
||||
t = 'bullet'
|
||||
|
||||
- elif node.parent.get('enumtype')=='arabic':
|
||||
+ elif node.parent.get('enumtype') == 'arabic':
|
||||
b = str(node.parent.children.index(node) + start) + '.'
|
||||
|
||||
elif node.parent.get('enumtype') == 'lowerroman':
|
||||
@@ -521,9 +534,9 @@ from nodehandlers import nodehandlers
|
||||
content=[XXPreformatted(text, style)],
|
||||
mode=self.fit_mode, style=style)
|
||||
|
||||
- def createPdf(self, text=None,
|
||||
- source_path=None,
|
||||
- output=None,
|
||||
+ def createPdf(self, text=None,
|
||||
+ source_path=None,
|
||||
+ output=None,
|
||||
doctree=None,
|
||||
compressed=False,
|
||||
# This adds entries to the PDF TOC
|
||||
@@ -541,7 +554,7 @@ from nodehandlers import nodehandlers
|
||||
'footer': self.footer,
|
||||
'endnotes': [],
|
||||
'extraflowables': []}
|
||||
-
|
||||
+
|
||||
self.pending_targets=[]
|
||||
self.targets=[]
|
||||
|
||||
@@ -550,7 +563,7 @@ from nodehandlers import nodehandlers
|
||||
if doctree is None:
|
||||
if text is not None:
|
||||
if self.language:
|
||||
- settings_overrides={'language_code': self.language}
|
||||
+ settings_overrides={'language_code': self.docutils_language}
|
||||
else:
|
||||
settings_overrides={}
|
||||
self.doctree = docutils.core.publish_doctree(text,
|
||||
@@ -570,7 +583,7 @@ from nodehandlers import nodehandlers
|
||||
self.doctree.walk(snf)
|
||||
srf = SectRefExpander(self.doctree, snf.sectnums)
|
||||
self.doctree.walk(srf)
|
||||
-
|
||||
+
|
||||
elements = self.gen_elements(self.doctree)
|
||||
|
||||
# Find cover template, save it in cover_file
|
||||
@@ -621,8 +634,8 @@ from nodehandlers import nodehandlers
|
||||
# Handle images with alignment more like in HTML
|
||||
new_elem=[]
|
||||
for i,e in enumerate(elements[::-1]):
|
||||
- if isinstance (e, MyImage) and e.image.hAlign != 'CENTER'\
|
||||
- and new_elem:
|
||||
+ if (isinstance (e, MyImage) and e.image.hAlign != 'CENTER'
|
||||
+ and new_elem):
|
||||
# This is an image where flowables should wrap
|
||||
# around it
|
||||
popped=new_elem.pop()
|
||||
@@ -670,7 +683,7 @@ from nodehandlers import nodehandlers
|
||||
# first pass in the case of ###Total###, then we
|
||||
# make a new forced two-pass build. This is broken.
|
||||
# conceptually.
|
||||
-
|
||||
+
|
||||
if getattr(self, 'mustMultiBuild', False):
|
||||
# Force a multibuild pass
|
||||
if not isinstance(elements[-1],UnhappyOnce):
|
||||
@@ -686,8 +699,8 @@ from nodehandlers import nodehandlers
|
||||
# Add it to the pile
|
||||
#if not isinstance (e, MySpacer):
|
||||
fnPile.append(e)
|
||||
- elif getattr(e, '_atTop', False) or \
|
||||
- isinstance (e, (UnhappyOnce, MyPageBreak)):
|
||||
+ elif getattr(e, '_atTop', False) or isinstance(
|
||||
+ e, (UnhappyOnce, MyPageBreak)):
|
||||
if fnPile:
|
||||
newStory.append(Sinker(fnPile))
|
||||
newStory.append(e)
|
||||
@@ -702,7 +715,7 @@ from nodehandlers import nodehandlers
|
||||
continue
|
||||
|
||||
|
||||
-
|
||||
+
|
||||
break
|
||||
except ValueError, v:
|
||||
# FIXME: cross-document links come through here, which means
|
||||
@@ -737,7 +750,7 @@ from reportlab.platypus import doctempla
|
||||
# Notify TOC entry for headings/abstracts/dedications.
|
||||
level, text = flowable.level, flowable.text
|
||||
parent_id = flowable.parent_id
|
||||
- node = flowable.node
|
||||
+ node = flowable.node
|
||||
pagenum = setPageCounter()
|
||||
self.notify('TOCEntry', (level, text, pagenum, parent_id, node))
|
||||
|
||||
@@ -790,7 +803,8 @@ from reportlab.platypus import doctempla
|
||||
self.afterFlowable(S[0])
|
||||
doctemplate._addGeneratedContent(flowables,frame)
|
||||
else:
|
||||
- ident = "Splitting error(n==%d) on page %d in\n%s" % (n,self.page,self._fIdent(f,60,frame))
|
||||
+ ident = "Splitting error(n==%d) on page %d in\n%s" % (
|
||||
+ n, self.page, self._fIdent(f, 60, frame))
|
||||
#leave to keep apart from the raise
|
||||
raise LayoutError(ident)
|
||||
del S[0]
|
||||
@@ -798,17 +812,17 @@ from reportlab.platypus import doctempla
|
||||
flowables.insert(i,f) # put split flowables back on the list
|
||||
else:
|
||||
if hasattr(f,'_postponed') and f._postponed > 4:
|
||||
- ident = "Flowable %s%s too large on page %d in frame %r%s of template %r" % \
|
||||
- (self._fIdent(f,60,frame),doctemplate._fSizeString(f),self.page, self.frame.id,
|
||||
- self.frame._aSpaceString(), self.pageTemplate.id)
|
||||
+ ident = "Flowable %s%s too large on page %d in frame %r%s of template %r" % (
|
||||
+ self._fIdent(f, 60, frame), doctemplate._fSizeString(f),self.page,
|
||||
+ self.frame.id, self.frame._aSpaceString(), self.pageTemplate.id)
|
||||
#leave to keep apart from the raise
|
||||
raise LayoutError(ident)
|
||||
# this ought to be cleared when they are finally drawn!
|
||||
f._postponed = 1
|
||||
- mbe = getattr(self,'_multiBuildEdits',None)
|
||||
+ mbe = getattr(self, '_multiBuildEdits', None)
|
||||
if mbe:
|
||||
- mbe((delattr,f,'_postponed'))
|
||||
- flowables.insert(0,f) # put the flowable back
|
||||
+ mbe((delattr, f, '_postponed'))
|
||||
+ flowables.insert(0, f) # put the flowable back
|
||||
self.handle_frameEnd()
|
||||
|
||||
|
||||
@@ -830,7 +844,7 @@ from reportlab.platypus import doctempla
|
||||
|
||||
def drawOn(self, canvas, x, y, _sW):
|
||||
pass
|
||||
-
|
||||
+
|
||||
flowables.PageCounter = PageCounter
|
||||
|
||||
def setPageCounter(counter=None, style=None):
|
||||
@@ -853,13 +867,13 @@ flowables.PageCounter = PageCounter
|
||||
else:
|
||||
ptext=unicode(_counter)
|
||||
return ptext
|
||||
-
|
||||
+
|
||||
class MyContainer(_Container, Flowable):
|
||||
pass
|
||||
|
||||
class UnhappyOnce(IndexingFlowable):
|
||||
'''An indexing flowable that is only unsatisfied once.
|
||||
- If added to a story, it will make multiBuild run
|
||||
+ If added to a story, it will make multiBuild run
|
||||
at least two passes. Useful for ###Total###'''
|
||||
_unhappy=True
|
||||
def isSatisfied(self):
|
||||
@@ -867,7 +881,7 @@ flowables.PageCounter = PageCounter
|
||||
self._unhappy= False
|
||||
return False
|
||||
return True
|
||||
-
|
||||
+
|
||||
def draw(self):
|
||||
pass
|
||||
|
||||
@@ -935,7 +949,7 @@ flowables.PageCounter = PageCounter
|
||||
getattr(canv, 'sectNum', ''))
|
||||
text = smartyPants(text, smarty)
|
||||
return text
|
||||
-
|
||||
+
|
||||
for i,e in enumerate(elems):
|
||||
if isinstance(e, Paragraph):
|
||||
text = replace(e.text)
|
||||
@@ -955,7 +969,7 @@ flowables.PageCounter = PageCounter
|
||||
even=self.replaceTokens([e.even,], canv, doc, smarty)[0]
|
||||
elems[i]=OddEven(odd, even)
|
||||
return elems
|
||||
-
|
||||
+
|
||||
def draw(self, pageobj, canv, doc, x, y, width, height):
|
||||
self.totalpages = max(self.totalpages, doc.page)
|
||||
items = self.prepared
|
||||
@@ -1007,11 +1021,11 @@ flowables.PageCounter = PageCounter
|
||||
return
|
||||
try:
|
||||
w, h, kind = MyImage.size_for_node(dict(uri=uri, ), self.client)
|
||||
- except ValueError:
|
||||
+ except ValueError:
|
||||
# Broken image, return arbitrary stuff
|
||||
uri=missing
|
||||
w, h, kind = 100, 100, 'direct'
|
||||
-
|
||||
+
|
||||
pw, ph = self.styles.pw, self.styles.ph
|
||||
if self.client.background_fit_mode == 'center':
|
||||
scale = min(1.0, 1.0 * pw / w, 1.0 * ph / h)
|
||||
@@ -1025,7 +1039,7 @@ flowables.PageCounter = PageCounter
|
||||
# Do scale anyway
|
||||
x, y = 0, 0
|
||||
sw, sh = pw, ph
|
||||
-
|
||||
+
|
||||
bg = MyImage(uri, sw, sh, client=self.client)
|
||||
self.image_cache[uri] = info = bg, x, y
|
||||
bg, x, y = info
|
||||
@@ -1041,8 +1055,8 @@ flowables.PageCounter = PageCounter
|
||||
|
||||
global _counter, _counterStyle
|
||||
|
||||
- self.tw = self.styles.pw - self.styles.lm -\
|
||||
- self.styles.rm - self.styles.gm
|
||||
+ styles = self.styles
|
||||
+ self.tw = styles.pw - styles.lm - styles.rm - styles.gm
|
||||
# What page template to use?
|
||||
tname = canv.__dict__.get('templateName',
|
||||
self.styles.firstTemplate)
|
||||
@@ -1052,34 +1066,33 @@ flowables.PageCounter = PageCounter
|
||||
doct = getattr(canv, '_doctemplate', None)
|
||||
canv._doctemplate = None # to make _listWrapOn work
|
||||
|
||||
- if doc.page==1:
|
||||
- _counter=0
|
||||
- _counterStyle='arabic'
|
||||
- _counter+=1
|
||||
+ if doc.page == 1:
|
||||
+ _counter = 0
|
||||
+ _counterStyle = 'arabic'
|
||||
+ _counter += 1
|
||||
|
||||
# Adjust text space accounting for header/footer
|
||||
-
|
||||
+
|
||||
self.hh = self._head.prepare(self, canv, doc)
|
||||
self.fh = self._foot.prepare(self, canv, doc)
|
||||
-
|
||||
+
|
||||
canv._doctemplate = doct
|
||||
|
||||
- self.hx = self.styles.lm
|
||||
- self.hy = self.styles.ph - self.styles.tm -self.hh
|
||||
+ self.hx = styles.lm
|
||||
+ self.hy = styles.ph - styles.tm - self.hh
|
||||
+
|
||||
+ self.fx = styles.lm
|
||||
+ self.fy = styles.bm
|
||||
+ self.th = styles.ph - styles.tm - styles.bm - self.hh \
|
||||
+ - self.fh - styles.ts - styles.bs
|
||||
|
||||
- self.fx = self.styles.lm
|
||||
- self.fy = self.styles.bm
|
||||
- self.th = self.styles.ph - self.styles.tm - \
|
||||
- self.styles.bm - self.hh - self.fh - \
|
||||
- self.styles.ts - self.styles.bs
|
||||
-
|
||||
# Adjust gutter margins
|
||||
if doc.page % 2: # Left page
|
||||
- x1 = self.styles.lm
|
||||
+ x1 = styles.lm
|
||||
else: # Right page
|
||||
- x1 = self.styles.lm + self.styles.gm
|
||||
- y1 = self.styles.bm + self.fh + self.styles.bs
|
||||
-
|
||||
+ x1 = styles.lm + styles.gm
|
||||
+ y1 = styles.bm + self.fh + styles.bs
|
||||
+
|
||||
# If there is a background parameter for this page Template, draw it
|
||||
if 'background' in self.template:
|
||||
self.draw_background('background', canv)
|
||||
@@ -1087,13 +1100,13 @@ flowables.PageCounter = PageCounter
|
||||
self.frames = []
|
||||
for frame in self.template['frames']:
|
||||
self.frames.append(SmartFrame(self,
|
||||
- self.styles.adjustUnits(frame[0], self.tw) + x1,
|
||||
- self.styles.adjustUnits(frame[1], self.th) + y1,
|
||||
- self.styles.adjustUnits(frame[2], self.tw),
|
||||
- self.styles.adjustUnits(frame[3], self.th),
|
||||
+ styles.adjustUnits(frame[0], self.tw) + x1,
|
||||
+ styles.adjustUnits(frame[1], self.th) + y1,
|
||||
+ styles.adjustUnits(frame[2], self.tw),
|
||||
+ styles.adjustUnits(frame[3], self.th),
|
||||
showBoundary=self.show_frame))
|
||||
- canv.firstSect=True
|
||||
- canv._pagenum=doc.page
|
||||
+ canv.firstSect = True
|
||||
+ canv._pagenum = doc.page
|
||||
for frame in self.frames:
|
||||
frame._pagenum=doc.page
|
||||
|
||||
@@ -1101,15 +1114,15 @@ flowables.PageCounter = PageCounter
|
||||
"""Draw header/footer."""
|
||||
# Adjust for gutter margin
|
||||
canv.addPageLabel(canv._pageNumber-1,numberingstyles[_counterStyle],_counter)
|
||||
-
|
||||
- log.info('Page %s [%s]'%(_counter,doc.page))
|
||||
+
|
||||
+ log.error('Page %s [%s]'%(_counter,doc.page))
|
||||
if doc.page % 2: # Left page
|
||||
hx = self.hx
|
||||
fx = self.fx
|
||||
else: # Right Page
|
||||
hx = self.hx + self.styles.gm
|
||||
fx = self.fx + self.styles.gm
|
||||
-
|
||||
+
|
||||
self._head.draw(self, canv, doc, hx, self.hy, self.tw, self.hh)
|
||||
self._foot.draw(self, canv, doc, fx, self.fy, self.tw, self.fh)
|
||||
|
||||
@@ -1119,12 +1132,12 @@ flowables.PageCounter = PageCounter
|
||||
|
||||
|
||||
def parse_commandline():
|
||||
-
|
||||
+
|
||||
parser = OptionParser()
|
||||
-
|
||||
+
|
||||
parser.add_option('--config', dest='configfile', metavar='FILE',
|
||||
help='Config file to use. Default=~/.rst2pdf/config')
|
||||
-
|
||||
+
|
||||
parser.add_option('-o', '--output', dest='output', metavar='FILE',
|
||||
help='Write the PDF to FILE')
|
||||
|
||||
@@ -1133,16 +1146,16 @@ flowables.PageCounter = PageCounter
|
||||
parser.add_option('-s', '--stylesheets', dest='style',
|
||||
type='string', action='append',
|
||||
metavar='STYLESHEETS', default=[def_ssheets],
|
||||
- help='A comma-separated list of custom stylesheets.'\
|
||||
- ' Default="%s"' % def_ssheets)
|
||||
+ help='A comma-separated list of custom stylesheets. Default="%s"'
|
||||
+ % def_ssheets)
|
||||
|
||||
def_sheetpath = os.pathsep.join([expanduser(p) for p in
|
||||
config.getValue("general", "stylesheet_path", "").split(os.pathsep)])
|
||||
parser.add_option('--stylesheet-path', dest='stylepath',
|
||||
metavar='FOLDER%sFOLDER%s...%sFOLDER'%((os.pathsep, )*3),
|
||||
default=def_sheetpath,
|
||||
- help='A list of folders to search for stylesheets,"\
|
||||
- " separated using "%s". Default="%s"' %(os.pathsep, def_sheetpath))
|
||||
+ help='A list of folders to search for stylesheets,'
|
||||
+ ' separated using "%s". Default="%s"' %(os.pathsep, def_sheetpath))
|
||||
|
||||
def_compressed = config.getValue("general", "compressed", False)
|
||||
parser.add_option('-c', '--compressed', dest='compressed',
|
||||
@@ -1161,59 +1174,64 @@ flowables.PageCounter = PageCounter
|
||||
parser.add_option('--font-path', dest='fpath',
|
||||
metavar='FOLDER%sFOLDER%s...%sFOLDER'%((os.pathsep, )*3),
|
||||
default=def_fontpath,
|
||||
- help='A list of folders to search for fonts,'\
|
||||
- ' separated using "%s". Default="%s"'%(os.pathsep, def_fontpath))
|
||||
+ help='A list of folders to search for fonts, separated using "%s".'
|
||||
+ ' Default="%s"' % (os.pathsep, def_fontpath))
|
||||
|
||||
def_baseurl = urlunparse(['file',os.getcwd()+os.sep,'','','',''])
|
||||
parser.add_option('--baseurl', dest='baseurl', metavar='URL',
|
||||
default=def_baseurl,
|
||||
help='The base URL for relative URLs. Default="%s"'%def_baseurl)
|
||||
|
||||
- def_lang = config.getValue("general", "language", 'en')
|
||||
+ def_lang = config.getValue("general", "language", 'en_US')
|
||||
parser.add_option('-l', '--language', metavar='LANG',
|
||||
default=def_lang, dest='language',
|
||||
- help='Language to be used for hyphenation and '\
|
||||
- 'docutils localizations. Default="%s"' % def_lang)
|
||||
+ help='Language to be used for hyphenation'
|
||||
+ ' and docutils localizations. Default="%s"' % def_lang)
|
||||
|
||||
def_header = config.getValue("general", "header")
|
||||
parser.add_option('--header', metavar='HEADER',
|
||||
default=def_header, dest='header',
|
||||
- help='Page header if not specified in the document.'\
|
||||
- ' Default="%s"' % def_header)
|
||||
+ help='Page header if not specified in the document.'
|
||||
+ ' Default="%s"' % def_header)
|
||||
|
||||
def_footer = config.getValue("general", "footer")
|
||||
parser.add_option('--footer', metavar='FOOTER',
|
||||
default=def_footer, dest='footer',
|
||||
- help='Page footer if not specified in the document.'\
|
||||
- ' Default="%s"' % def_footer)
|
||||
+ help='Page footer if not specified in the document.'
|
||||
+ ' Default="%s"' % def_footer)
|
||||
+
|
||||
+ def_section_header_depth = config.getValue("general","section_header_depth",2)
|
||||
+ parser.add_option('--section-header-depth', metavar='N',
|
||||
+ default=def_section_header_depth, dest='section_header_depth',
|
||||
+ help = '''Sections up to this depth will be used in the header and footer's replacement of ###Section###. Default=%s''' % def_section_header_depth)
|
||||
|
||||
def_smartquotes = config.getValue("general", "smartquotes", "0")
|
||||
parser.add_option("--smart-quotes", metavar="VALUE",
|
||||
default=def_smartquotes, dest="smarty",
|
||||
- help='Try to convert ASCII quotes, ellipsis and dashes '\
|
||||
- 'to the typographically correct equivalent. For details,'\
|
||||
- ' read the man page or the manual. Default="%s"'%def_smartquotes)
|
||||
+ help='Try to convert ASCII quotes, ellipses and dashes'
|
||||
+ ' to the typographically correct equivalent. For details,'
|
||||
+ ' read the man page or the manual. Default="%s"' % def_smartquotes)
|
||||
|
||||
def_fit = config.getValue("general", "fit_mode", "shrink")
|
||||
parser.add_option('--fit-literal-mode', metavar='MODE',
|
||||
default=def_fit, dest='fit_mode',
|
||||
- help='What todo when a literal is too wide. One of error,'\
|
||||
- ' overflow,shrink,truncate. Default="%s"'%def_fit)
|
||||
+ help='What to do when a literal is too wide. One of error,'
|
||||
+ ' overflow,shrink,truncate. Default="%s"' % def_fit)
|
||||
|
||||
def_fit_background = config.getValue("general", "background_fit_mode",
|
||||
- "center")
|
||||
+ "center")
|
||||
parser.add_option('--fit-background-mode', metavar='MODE',
|
||||
default=def_fit_background, dest='background_fit_mode',
|
||||
- help='How to fit the background image to the page.'\
|
||||
- ' One of scale or center. Default="%s"'%def_fit_background)
|
||||
+ help='How to fit the background image to the page.'
|
||||
+ ' One of scale or center. Default="%s"' % def_fit_background)
|
||||
|
||||
parser.add_option('--inline-links', action="store_true",
|
||||
dest='inlinelinks', default=False,
|
||||
- help='shows target between parenthesis instead of active link')
|
||||
+ help='Shows target between parentheses instead of active link.')
|
||||
|
||||
parser.add_option('--repeat-table-rows', action="store_true",
|
||||
dest='repeattablerows', default=False,
|
||||
- help='Repeats header row for each splitted table')
|
||||
+ help='Repeats header row for each split table.')
|
||||
|
||||
parser.add_option('-q', '--quiet', action="store_true",
|
||||
dest='quiet', default=False,
|
||||
@@ -1235,22 +1253,22 @@ flowables.PageCounter = PageCounter
|
||||
"footnote_backlinks", True)
|
||||
parser.add_option('--no-footnote-backlinks', action='store_false',
|
||||
dest='footnote_backlinks', default=def_footnote_backlinks,
|
||||
- help='Disable footnote backlinks.'\
|
||||
- ' Default=%s' % str(not def_footnote_backlinks))
|
||||
+ help='Disable footnote backlinks.'
|
||||
+ ' Default=%s' % str(not def_footnote_backlinks))
|
||||
|
||||
def_inline_footnotes = config.getValue("general",
|
||||
"inline_footnotes", False)
|
||||
parser.add_option('--inline-footnotes', action='store_true',
|
||||
dest='inline_footnotes', default=def_inline_footnotes,
|
||||
- help='Show footnotes inline.'\
|
||||
- ' Default=%s' % str(not def_inline_footnotes))
|
||||
+ help='Show footnotes inline.'
|
||||
+ ' Default=%s' % str(not def_inline_footnotes))
|
||||
|
||||
def_real_footnotes = config.getValue("general",
|
||||
"real_footnotes", False)
|
||||
parser.add_option('--real-footnotes', action='store_true',
|
||||
dest='real_footnotes', default=def_real_footnotes,
|
||||
- help='Show footnotes at the bottom of the page where they are defined.'\
|
||||
- ' Default=%s' % str(def_real_footnotes))
|
||||
+ help='Show footnotes at the bottom of the page where they are defined.'
|
||||
+ ' Default=%s' % str(def_real_footnotes))
|
||||
|
||||
def_dpi = config.getValue("general", "default_dpi", 300)
|
||||
parser.add_option('--default-dpi', dest='def_dpi', metavar='NUMBER',
|
||||
@@ -1263,20 +1281,20 @@ flowables.PageCounter = PageCounter
|
||||
|
||||
parser.add_option('--disable-splittables', dest='splittables',
|
||||
action='store_false', default=True,
|
||||
- help='Don\'t use splittable flowables in some elements. '
|
||||
- 'Only try this if you can\'t process a document any other way.')
|
||||
+ help="Don't use splittable flowables in some elements."
|
||||
+ " Only try this if you can't process a document any other way.")
|
||||
|
||||
def_break = config.getValue("general", "break_level", 0)
|
||||
parser.add_option('-b', '--break-level', dest='breaklevel',
|
||||
metavar='LEVEL', default=def_break,
|
||||
- help='Maximum section level that starts in a new page.'\
|
||||
- ' Default: %d' % def_break)
|
||||
+ help='Maximum section level that starts in a new page.'
|
||||
+ ' Default: %d' % def_break)
|
||||
|
||||
def_fpeven = config.getValue("general", "first_page_even", False)
|
||||
parser.add_option('--first-page-even', dest='first_page_even',
|
||||
action='store_true', default=def_fpeven,
|
||||
- help='Whether first page is odd (as in the screen on "facing pages"), '\
|
||||
- 'or even (as in a book)')
|
||||
+ help='Whether first page is odd (as in the screen on "facing pages"),'
|
||||
+ ' or even (as in a book).')
|
||||
|
||||
def_blankfirst = config.getValue("general", "blank_first_page", False)
|
||||
parser.add_option('--blank-first-page', dest='blank_first_page',
|
||||
@@ -1286,14 +1304,16 @@ flowables.PageCounter = PageCounter
|
||||
def_breakside = config.getValue("general", "break_side", 'any')
|
||||
parser.add_option('--break-side', dest='breakside', metavar='VALUE',
|
||||
default=def_breakside,
|
||||
- help='How section breaks work. Can be "even", and sections start in an even page,'\
|
||||
- '"odd", and sections start in odd pages, or "any" and sections start in the next page,'\
|
||||
- 'be it even or odd. See also the -b option.')
|
||||
+ help='How section breaks work. Can be "even", and sections start'
|
||||
+ ' in an even page, "odd", and sections start in odd pages,'
|
||||
+ ' or "any" and sections start in the next page, be it even or odd.'
|
||||
+ ' See also the -b option.')
|
||||
|
||||
- parser.add_option('--date-invariant', dest='invariant',
|
||||
+ parser.add_option('--date-invariant', dest='invariant',
|
||||
action='store_true', default=False,
|
||||
- help="Don't store the current date in the PDF. Useful mainly for the test suite, "\
|
||||
- "where we don't want the PDFs to change.")
|
||||
+ help="Don't store the current date in the PDF."
|
||||
+ " Useful mainly for the test suite,"
|
||||
+ " where we don't want the PDFs to change.")
|
||||
|
||||
parser.add_option('-e', '--extension-module', dest='extensions', action="append", type="string",
|
||||
default = ['vectorpdf'],
|
||||
@@ -1307,7 +1327,7 @@ flowables.PageCounter = PageCounter
|
||||
|
||||
def_floating_images = config.getValue("general", "floating_images", False)
|
||||
parser.add_option('--use-floating-images', action='store_true', default=def_floating_images,
|
||||
- help='Makes images with :aling: attribute work more like in rst2html. Default: %s'%def_floating_images,
|
||||
+ help='Makes images with :align: attribute work more like in rst2html. Default: %s'%def_floating_images,
|
||||
dest='floating_images')
|
||||
|
||||
def_numbered_links = config.getValue("general", "numbered_links", False)
|
||||
@@ -1324,7 +1344,7 @@ flowables.PageCounter = PageCounter
|
||||
options, args = parser.parse_args(copy(args))
|
||||
|
||||
if options.configfile:
|
||||
- options.cfname=options.configfile
|
||||
+ config.parseConfig(options.configfile)
|
||||
parser = parse_commandline()
|
||||
options, args = parser.parse_args(copy(args))
|
||||
|
||||
@@ -1415,9 +1435,8 @@ flowables.PageCounter = PageCounter
|
||||
options.inline_footnotes = True
|
||||
|
||||
if reportlab.Version < '2.3':
|
||||
- log.warning('You are using Reportlab version %s.'\
|
||||
- ' The suggested version '\
|
||||
- 'is 2.3 or higher'%reportlab.Version)
|
||||
+ log.warning('You are using Reportlab version %s.'
|
||||
+ ' The suggested version is 2.3 or higher' % reportlab.Version)
|
||||
|
||||
if options.invariant:
|
||||
patch_PDFDate()
|
||||
@@ -1450,6 +1469,7 @@ flowables.PageCounter = PageCounter
|
||||
custom_cover=options.custom_cover,
|
||||
floating_images=options.floating_images,
|
||||
numbered_links=options.numbered_links,
|
||||
+ section_header_depth=int(options.section_header_depth),
|
||||
).createPdf(text=options.infile.read(),
|
||||
source_path=options.infile.name,
|
||||
output=options.outfile,
|
||||
@@ -1489,7 +1509,7 @@ filenames change'''
|
||||
lambda yyyy,mm,dd,hh,m,s:
|
||||
"D:%04d%02d%02d%02d%02d%02d%+03d'%02d'" % (yyyy,mm,dd,hh,m,s,0,0))
|
||||
return pdfdoc.format(pdfdoc.PDFString(dfmt(*self.date)), doc)
|
||||
-
|
||||
+
|
||||
pdfdoc.PDFDate = PDFDate
|
||||
reportlab.rl_config.invariant = 1
|
||||
|
17
rst2pdf.spec
17
rst2pdf.spec
@ -1,6 +1,6 @@
|
||||
Name: rst2pdf
|
||||
Version: 0.103.1
|
||||
Release: 1mamba
|
||||
Release: 2mamba
|
||||
Summary: Convert reStructuredText to PDF via ReportLab
|
||||
Group: System/Libraries/Python
|
||||
Vendor: openmamba
|
||||
@ -8,29 +8,29 @@ Distribution: openmamba
|
||||
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
URL: https://github.com/rst2pdf/rst2pdf
|
||||
Source: https://github.com/rst2pdf/rst2pdf.git/%{version}/rst2pdf-%{version}.tar.bz2
|
||||
Patch: rst2pdf-0.16-docutils_0.8.patch
|
||||
Patch0: rst2pdf-0.103.1-remove-smartypants_use_docutils_version.patch
|
||||
Patch1: rst2pdf-0.103.1-python-packaging-25.patch
|
||||
License: MIT
|
||||
BuildArch: noarch
|
||||
## AUTOBUILDREQ-BEGIN
|
||||
BuildRequires: (python3.11dist(docutils) >= 0.21.2 with python3.11dist(docutils) < 0.22)
|
||||
BuildRequires: (python3.11dist(importlib-metadata) >= 8 with python3.11dist(importlib-metadata) < 9)
|
||||
BuildRequires: (python3.11dist(jinja2) >= 3 with python3.11dist(jinja2) < 4)
|
||||
BuildRequires: (python3.11dist(packaging) >= 24 with python3.11dist(packaging) < 25)
|
||||
BuildRequires: (python3.11dist(packaging) >= 25 with python3.11dist(packaging) < 26)
|
||||
BuildRequires: (python3.11dist(pygments) >= 2 with python3.11dist(pygments) < 3)
|
||||
BuildRequires: (python3.11dist(pyyaml) >= 6 with python3.11dist(pyyaml) < 7)
|
||||
BuildRequires: (python3.11dist(reportlab) >= 4 with python3.11dist(reportlab) < 5)
|
||||
BuildRequires: (python3.11dist(smartypants) >= 2 with python3.11dist(smartypants) < 3)
|
||||
BuildRequires: libpython311-devel
|
||||
## AUTOBUILDREQ-END
|
||||
Requires: python3 >= 3.11
|
||||
Requires: python-reportlab-py3
|
||||
BuildArch: noarch
|
||||
|
||||
%description
|
||||
Convert reStructuredText to PDF via ReportLab.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
#%patch -p1
|
||||
%patch 0 -p1 -b .remove-smartypants_use_docutils_version
|
||||
%patch 1 -p1 -b .python-packaging-25
|
||||
|
||||
%build
|
||||
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
|
||||
@ -57,6 +57,9 @@ export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
|
||||
%doc LICENSE.txt
|
||||
|
||||
%changelog
|
||||
* Wed May 21 2025 Silvan Calarco <silvan.calarco@mambasoft.it> 0.103.1-2mamba
|
||||
- rebuilt with path for python-packaging 25
|
||||
|
||||
* Sat Dec 28 2024 Automatic Build System <autodist@openmamba.org> 0.103.1-1mamba
|
||||
- automatic version update by autodist
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user