fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
change in multilingual
[wolnelektury.git]
/
scripts
/
conv_genre_families.py
diff --git
a/scripts/conv_genre_families.py
b/scripts/conv_genre_families.py
index
6114713
..
f798d69
100644
(file)
--- a/
scripts/conv_genre_families.py
+++ b/
scripts/conv_genre_families.py
@@
-1,4
+1,8
@@
+#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
+# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
from lxml import etree
from slughifi import slughifi
from django.core.management import setup_environ
from lxml import etree
from slughifi import slughifi
from django.core.management import setup_environ
@@
-13,13
+17,13
@@
doc = etree.parse('rodziny.xml')
for element in doc.findall('//span'):
themes = [s.strip() for s in element.text.split(',')]
for element in doc.findall('//span'):
themes = [s.strip() for s in element.text.split(',')]
-
+
element.text = u''
element.text = u''
-
+
for theme in themes:
try:
Tag.objects.get(slug=slughifi(theme))
for theme in themes:
try:
Tag.objects.get(slug=slughifi(theme))
-
+
link = etree.SubElement(element, 'a', href=u'/katalog/%s' % slughifi(theme))
link.text = theme
link.tail = ', '
link = etree.SubElement(element, 'a', href=u'/katalog/%s' % slughifi(theme))
link.text = theme
link.tail = ', '