On Wed, Jan 04, 2017 at 04:49:08PM +0100, Andrea Bolognani wrote:
Instead of encoding formatting information inside the corresponding XSLT stylesheet, use a Python script to reformat the text appropriately based on a few simple markers. Splitting the task between the XSLT stylesheet and the Python script allows us to keep both parts very simple. --- Yeah, I'm not great at Python.
Oh, so that's why there's not print(), just sys.stdout.write()... =) I'm not going to comment on the python style, for me it's enough that it works now, it can be made more python-ish later on.
Makefile.am | 16 ++++---- docs/Makefile.am | 2 +- docs/reformat-news.py | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 8 deletions(-) create mode 100755 docs/reformat-news.py diff --git a/Makefile.am b/Makefile.am index 445e35e..bb63993 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,13 +46,15 @@ EXTRA_DIST = \ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libvirt.pc libvirt-qemu.pc libvirt-lxc.pc libvirt-admin.pc -NEWS: $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml - $(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \ - $(XSLTPROC) --nonet $(srcdir)/docs/NEWS.xsl \ - $(srcdir)/docs/news.xml \ - | perl -0777 -pe 's/\n\n+$$/\n/' \ - | perl -pe 's/[ \t]+$$//' \ - > $@-t && mv $@-t $@ ; fi +NEWS: $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml $(srcdir)/docs/reformat-news.py
This ^^ and
+ $(AM_V_GEN) \ + if [ -x $(XSLTPROC) ]; then \ + $(XSLTPROC) --nonet $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml >$@-tmp \
^^ this fails (. Do you even) syntax-check.
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list