fnp
/
librarian.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
93943be
)
fix tests
author
Radek Czajka
<rczajka@rczajka.pl>
Mon, 28 Apr 2025 12:04:42 +0000
(14:04 +0200)
committer
Radek Czajka
<rczajka@rczajka.pl>
Mon, 28 Apr 2025 12:04:42 +0000
(14:04 +0200)
setup.py
patch
|
blob
|
history
src/librarian/builders/daisy.py
patch
|
blob
|
history
src/librarian/elements/base.py
patch
|
blob
|
history
src/librarian/html.py
patch
|
blob
|
history
tests/files/text/asnyk_miedzy_nami_expected.legacy.html
patch
|
blob
|
history
tox.ini
patch
|
blob
|
history
diff --git
a/setup.py
b/setup.py
index
df8212c
..
41fa6a4
100755
(executable)
--- a/
setup.py
+++ b/
setup.py
@@
-40,11
+40,11
@@
setup(
'Pillow>=9.1.0',
'texml',
'ebooklib',
'Pillow>=9.1.0',
'texml',
'ebooklib',
- 'aeneas',
'mutagen',
'qrcode',
'requests',
'fonttools',
'mutagen',
'qrcode',
'requests',
'fonttools',
+ 'python-bidi',
],
entry_points = {
"console_scripts": [
],
entry_points = {
"console_scripts": [
diff --git
a/src/librarian/builders/daisy.py
b/src/librarian/builders/daisy.py
index
c706cbd
..
bdfc306
100644
(file)
--- a/
src/librarian/builders/daisy.py
+++ b/
src/librarian/builders/daisy.py
@@
-5,8
+5,6
@@
from copy import deepcopy
import subprocess
import tempfile
import zipfile
import subprocess
import tempfile
import zipfile
-from aeneas.executetask import ExecuteTask
-from aeneas.task import Task
from lxml import etree
import mutagen
from librarian import OutputFile, get_resource
from lxml import etree
import mutagen
from librarian import OutputFile, get_resource
@@
-117,7
+115,7
@@
class DaisyBuilder:
directory + "book%d.mp3" % i,
)
directory + "book%d.mp3" % i,
)
- config_string = "task_language=pol|is_text_type=unparsed|is_text_unparsed_id_regex=sec\d+$|is_text_unparsed_id_sort=numeric|os_task_file_format=tab"
+ config_string = "task_language=pol|is_text_type=unparsed|is_text_unparsed_id_regex=sec\
\
d+$|is_text_unparsed_id_sort=numeric|os_task_file_format=tab"
task = Task(config_string=config_string)
with tempfile.TemporaryDirectory() as temp:
task = Task(config_string=config_string)
with tempfile.TemporaryDirectory() as temp:
diff --git
a/src/librarian/elements/base.py
b/src/librarian/elements/base.py
index
b0d16ed
..
f430c23
100644
(file)
--- a/
src/librarian/elements/base.py
+++ b/
src/librarian/elements/base.py
@@
-136,7
+136,7
@@
class WLElement(etree.ElementBase):
for i, child in enumerate(self):
if isinstance(child, WLElement):
getattr(child, build_method)(builder)
for i, child in enumerate(self):
if isinstance(child, WLElement):
getattr(child, build_method)(builder)
- elif getattr(builder, 'debug') and child.tag is etree.Comment:
+ elif getattr(builder, 'debug'
, False
) and child.tag is etree.Comment:
builder.process_comment(child)
if self.CAN_HAVE_TEXT and child.tail:
text = self.normalize_text(child.tail, builder)
builder.process_comment(child)
if self.CAN_HAVE_TEXT and child.tail:
text = self.normalize_text(child.tail, builder)
diff --git
a/src/librarian/html.py
b/src/librarian/html.py
index
d6482dc
..
73ea15d
100644
(file)
--- a/
src/librarian/html.py
+++ b/
src/librarian/html.py
@@
-113,7
+113,10
@@
def transform(wldoc, stylesheet='legacy', options=None, flags=None, css=None, ga
document.edoc.getroot().set(flag, 'yes')
ltag = document.edoc.find('//' + DCNS('language'))
document.edoc.getroot().set(flag, 'yes')
ltag = document.edoc.find('//' + DCNS('language'))
- lang = functions.lang_code_3to2(ltag.text) or 'pl'
+ if ltag is not None:
+ lang = functions.lang_code_3to2(ltag.text)
+ else:
+ lang = 'pl'
document.edoc.getroot().set('lang', lang)
document.clean_ed_note()
document.edoc.getroot().set('lang', lang)
document.clean_ed_note()
diff --git
a/tests/files/text/asnyk_miedzy_nami_expected.legacy.html
b/tests/files/text/asnyk_miedzy_nami_expected.legacy.html
index
7004f5a
..
64fea81
100644
(file)
--- a/
tests/files/text/asnyk_miedzy_nami_expected.legacy.html
+++ b/
tests/files/text/asnyk_miedzy_nami_expected.legacy.html
@@
-1,4
+1,4
@@
-<div xmlns:wl="http://wolnelektury.pl/functions" xmlns:dc="http://purl.org/dc/elements/1.1/" id="book-text">
+<div xmlns:wl="http://wolnelektury.pl/functions" xmlns:dc="http://purl.org/dc/elements/1.1/" id="book-text"
lang="pl"
>
<div id="toc">
<h2>Spis treści</h2>
<ol></ol>
<div id="toc">
<h2>Spis treści</h2>
<ol></ol>
@@
-34,14
+34,14
@@
<div class="stanza">
<a name="sec7"></a><div class="verse">Prócz tych wspólnych, jasnych zdrojów,</div>
<div class="verse">Z których serce zachwyt piło;</div>
<div class="stanza">
<a name="sec7"></a><div class="verse">Prócz tych wspólnych, jasnych zdrojów,</div>
<div class="verse">Z których serce zachwyt piło;</div>
-<a name="f15" class="target"> </a><a href="#f15" class="anchor">15</a><div class="verse">Prócz pierwiosnków<a name="anchor-id
mNNN"></a><a href="#footnote-idmNNN
" class="annotation">[1]</a><a class="reference" data-uri="https://www.wikidata.org/wiki/Q158974"></a> i powojów,—</div>
+<a name="f15" class="target"> </a><a href="#f15" class="anchor">15</a><div class="verse">Prócz pierwiosnków<a name="anchor-id
1"></a><a href="#footnote-id1
" class="annotation">[1]</a><a class="reference" data-uri="https://www.wikidata.org/wiki/Q158974"></a> i powojów,—</div>
<div class="verse">Między nami nic nie było!<span class="theme-end" fid="1189062528872"></span><span class="theme-end" fid="1189062500041"></span>
</div>
</div>
<div id="footnotes">
<h3>Przypisy</h3>
<div class="fn-pe">
<div class="verse">Między nami nic nie było!<span class="theme-end" fid="1189062528872"></span><span class="theme-end" fid="1189062500041"></span>
</div>
</div>
<div id="footnotes">
<h3>Przypisy</h3>
<div class="fn-pe">
-<a name="footnote-id
mNNN"></a><a href="#anchor-idmNNN
" class="annotation">[1]</a><p><em class="foreign-word">pierwiosnek</em> — taki kwiatek [przypis edytorski]</p>
+<a name="footnote-id
1"></a><a href="#anchor-id1
" class="annotation">[1]</a><p><em class="foreign-word">pierwiosnek</em> — taki kwiatek [przypis edytorski]</p>
</div>
</div>
</div>
</div>
</div>
</div>
diff --git
a/tox.ini
b/tox.ini
index
ecf3ecc
..
489be44
100644
(file)
--- a/
tox.ini
+++ b/
tox.ini
@@
-1,26
+1,27
@@
[tox]
envlist =
clean,
[tox]
envlist =
clean,
- py{3
7,38,39,310,311
},
+ py{3
8,39,310,311,312
},
stats
[testenv]
deps =
coverage
stats
[testenv]
deps =
coverage
-passenv = HOME ; Needed to find locally installed fonts when testing PDF production.
+; Needed to find locally installed fonts when testing PDF production.
+passenv = HOME
download = true
commands =
coverage run
download = true
commands =
coverage run
-install_command = pip install
numpy; pip install
--extra-index-url https://py.mdrn.pl/simple {packages}
+install_command = pip install --extra-index-url https://py.mdrn.pl/simple {packages}
[testenv:clean]
[testenv:clean]
-basepython = python3
+basepython = python3
12
commands =
coverage erase
deps = coverage
[testenv:stats]
commands =
coverage erase
deps = coverage
[testenv:stats]
-basepython = python3
+basepython = python3
12
commands =
coverage combine
coverage report
commands =
coverage combine
coverage report