fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ilustr sizes in json for app
[wolnelektury.git]
/
src
/
catalogue
/
api
/
tojson.py
diff --git
a/src/catalogue/api/tojson.py
b/src/catalogue/api/tojson.py
index
d3b7ab5
..
691ee3d
100644
(file)
--- a/
src/catalogue/api/tojson.py
+++ b/
src/catalogue/api/tojson.py
@@
-3,7
+3,14
@@
import json
import re
from sys import argv
from lxml import etree
import re
from sys import argv
from lxml import etree
-from catalogue.utils import absolute_url, gallery_url
+from catalogue.utils import get_ilustr_sizes
+
+
+def ilustr_sizes_getter(e, S):
+ sizes = get_ilustr_sizes(e.attrib['src'], S['slug'], S['ilustr'])
+ S['ilustr'] += 1
+ return sizes
+
tags = {
'utwor': ('_pass', False, None, None, None),
tags = {
'utwor': ('_pass', False, None, None, None),
@@
-125,7
+132,9
@@
tags = {
'kol': ('td', True, None, None, None),
'ilustr': ('img', False, None, {
'kol': ('td', True, None, None, None),
'ilustr': ('img', False, None, {
- 'src': lambda e, S: absolute_url(gallery_url(S['slug'])) + e.attrib['src'].rsplit('/', 1)[-1],
+ 'src': lambda e, S: e.attrib['src'],
+ 'sizes': ilustr_sizes_getter,
+ 'alt': 'alt',
}, False),
'tab': ('span', False, {'class': 'tab'}, {'szer': 'szer'}, False),
}, False),
'tab': ('span', False, {'class': 'tab'}, {'szer': 'szer'}, False),
@@
-254,6
+263,7
@@
def conv(tree, slug):
S = {
'index': 0,
'vindex': 0,
S = {
'index': 0,
'vindex': 0,
+ 'ilustr': 0,
'id': defaultdict(lambda: 0),
'stack': [],
'front1': [],
'id': defaultdict(lambda: 0),
'stack': [],
'front1': [],