Adding upstream version 0.1.2.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
00981dc324
commit
d372080b5f
5 changed files with 51 additions and 4 deletions
2
PKG-INFO
2
PKG-INFO
|
@ -1,6 +1,6 @@
|
||||||
Metadata-Version: 2.1
|
Metadata-Version: 2.1
|
||||||
Name: pydyf
|
Name: pydyf
|
||||||
Version: 0.1.1
|
Version: 0.1.2
|
||||||
Summary: A low-level PDF generator.
|
Summary: A low-level PDF generator.
|
||||||
Keywords: pdf,generator
|
Keywords: pdf,generator
|
||||||
Author-email: CourtBouillon <contact@courtbouillon.org>
|
Author-email: CourtBouillon <contact@courtbouillon.org>
|
||||||
|
|
|
@ -2,6 +2,44 @@ Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
|
||||||
|
Version 0.1.2
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released on 2021-10-30.
|
||||||
|
|
||||||
|
Bug fixes:
|
||||||
|
|
||||||
|
* `#9 <https://github.com/CourtBouillon/pydyf/pull/9>`_:
|
||||||
|
Implement escaping for Strings
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
|
||||||
|
* Guillaume Ayoub
|
||||||
|
* Rian McGuire
|
||||||
|
|
||||||
|
Backers and sponsors:
|
||||||
|
|
||||||
|
* Grip Angebotssoftware
|
||||||
|
* SimonSoft
|
||||||
|
* Menutech
|
||||||
|
* Manuel Barkhau
|
||||||
|
* Simon Sapin
|
||||||
|
* KontextWork
|
||||||
|
* René Fritz
|
||||||
|
* Maykin Media
|
||||||
|
* NCC Group
|
||||||
|
* Crisp BV
|
||||||
|
* Des images et des mots
|
||||||
|
* Andreas Zettl
|
||||||
|
* Nathalie Gutton
|
||||||
|
* Tom Pohl
|
||||||
|
* Moritz Mahringer
|
||||||
|
* Florian Demmer
|
||||||
|
* Yanal-Yvez Fargialla
|
||||||
|
* G. Allard
|
||||||
|
* Gábor
|
||||||
|
|
||||||
|
|
||||||
Version 0.1.1
|
Version 0.1.1
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,11 @@ A low-level PDF generator.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import re
|
||||||
import zlib
|
import zlib
|
||||||
from codecs import BOM_UTF16_BE
|
from codecs import BOM_UTF16_BE
|
||||||
|
|
||||||
VERSION = __version__ = '0.1.1'
|
VERSION = __version__ = '0.1.2'
|
||||||
|
|
||||||
|
|
||||||
def _to_bytes(item):
|
def _to_bytes(item):
|
||||||
|
@ -375,7 +376,12 @@ class String(Object):
|
||||||
@property
|
@property
|
||||||
def data(self):
|
def data(self):
|
||||||
try:
|
try:
|
||||||
return b'(' + _to_bytes(self.string) + b')'
|
# "A literal string is written as an arbitrary number of characters
|
||||||
|
# enclosed in parentheses. Any characters may appear in a string
|
||||||
|
# except unbalanced parentheses and the backslash, which must be
|
||||||
|
# treated specially."
|
||||||
|
escaped = re.sub(rb'([\\\(\)])', rb'\\\1', _to_bytes(self.string))
|
||||||
|
return b'(' + escaped + b')'
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
encoded = BOM_UTF16_BE + str(self.string).encode('utf-16-be')
|
encoded = BOM_UTF16_BE + str(self.string).encode('utf-16-be')
|
||||||
return b'<' + encoded.hex().encode() + b'>'
|
return b'<' + encoded.hex().encode() + b'>'
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -19,7 +19,7 @@ extras_require = \
|
||||||
'pillow']}
|
'pillow']}
|
||||||
|
|
||||||
setup(name='pydyf',
|
setup(name='pydyf',
|
||||||
version='0.1.1',
|
version='0.1.2',
|
||||||
description='A low-level PDF generator.',
|
description='A low-level PDF generator.',
|
||||||
author=None,
|
author=None,
|
||||||
author_email='CourtBouillon <contact@courtbouillon.org>',
|
author_email='CourtBouillon <contact@courtbouillon.org>',
|
||||||
|
|
|
@ -706,3 +706,6 @@ def test_string_encoding():
|
||||||
assert pydyf.String('abc').data == b'(abc)'
|
assert pydyf.String('abc').data == b'(abc)'
|
||||||
assert pydyf.String('déf').data == b'<feff006400e90066>'
|
assert pydyf.String('déf').data == b'<feff006400e90066>'
|
||||||
assert pydyf.String('♡').data == b'<feff2661>'
|
assert pydyf.String('♡').data == b'<feff2661>'
|
||||||
|
assert pydyf.String('\\abc').data == b'(\\\\abc)'
|
||||||
|
assert pydyf.String('abc(').data == b'(abc\\()'
|
||||||
|
assert pydyf.String('ab)c').data == b'(ab\\)c)'
|
||||||
|
|
Loading…
Add table
Reference in a new issue