[libvirt] [PATCH 0/2] docs: news: add per-release links

Ján Tomko (2): docs: news: remove sed sorcery docs: news: add per-release links docs/Makefile.am | 8 +------- docs/news-html.xsl | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 14 deletions(-) -- 2.20.1

Set a default namespace in the stylesheet instead. Signed-off-by: Ján Tomko <jtomko@redhat.com> --- docs/Makefile.am | 8 +------- docs/news-html.xsl | 4 +++- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index 1cfa38dc80..bc2fd6ea42 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -236,9 +236,6 @@ $(srcdir)/hvsupport.html.in: $(srcdir)/hvsupport.pl $(api_DATA) \ $(AM_V_GEN)$(PERL) $(srcdir)/hvsupport.pl $(top_srcdir)/src > $@ \ || { rm $@ && exit 1; } -# xsltproc seems to add the xmlns="" attribute to random output elements: -# use sed to strip it out, as leaving it there triggers XML errors during -# further transformation steps news.html.in: \ $(srcdir)/news.xml \ $(srcdir)/news-html.xsl @@ -246,10 +243,7 @@ news.html.in: \ $(srcdir)/news-html.xsl \ $(srcdir)/news.xml \ >$@-tmp \ - || { rm -f $@-tmp; exit 1; }; \ - sed 's/ xmlns=""//g' $@-tmp >$@ \ - || { rm -f $@-tmp; exit 1; }; \ - rm -f $@-tmp + || { rm -f $@-tmp; exit 1; }; EXTRA_DIST += \ $(srcdir)/news.xml \ $(srcdir)/news.rng \ diff --git a/docs/news-html.xsl b/docs/news-html.xsl index 2b02578cb9..6763a71fa3 100644 --- a/docs/news-html.xsl +++ b/docs/news-html.xsl @@ -1,5 +1,7 @@ <?xml version="1.0"?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<xsl:stylesheet version="1.0" + xmlns="http://www.w3.org/1999/xhtml" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" encoding="UTF-8"/> <!-- This XSLT stylesheet can be applied to the XML version of the release -- 2.20.1

On Wed, 2019-07-17 at 16:37 +0200, Ján Tomko wrote: [...]
<?xml version="1.0"?> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<xsl:stylesheet version="1.0" + xmlns="http://www.w3.org/1999/xhtml" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
I suggest formatting this as <xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> instead, as it looks much better IMHO. Whichever version you decide to go with, you have my Reviewed-by: Andrea Bolognani <abologna@redhat.com> as well as my gratitude for tracking down the root cause of that yucky piece of shell scripting :) -- Andrea Bolognani / Red Hat / Virtualization

On Wed, Jul 17, 2019 at 16:37:06 +0200, Ján Tomko wrote:
Set a default namespace in the stylesheet instead.
Signed-off-by: Ján Tomko <jtomko@redhat.com> --- docs/Makefile.am | 8 +------- docs/news-html.xsl | 4 +++- 2 files changed, 4 insertions(+), 8 deletions(-)
news.html.in-tmp \ || { rm -f news.html.in-tmp; exit 1; }; name=`echo news.html.tmp | sed -e 's/.tmp//'`; \
Fails in vpath build: /usr/bin/xsltproc --nonet \ /home/pipo/libvirt/docs/news-html.xsl \ /home/pipo/libvirt/docs/news.xml \ dir=`dirname news.html.tmp` ; \ if test "$dir" = "."; \ then \ style=site.xsl; \ else \ /usr/bin/mkdir -p $dir; \ style=subsite.xsl; \ fi; \ /usr/bin/xsltproc --stringparam pagename $name \ --stringparam timestamp "Wed Jul 17 15:00:08 UTC 2019" --nonet \ /home/pipo/libvirt/docs/$style news.html.in > news.html.tmp \ || { rm news.html.tmp && exit 1; } warning: failed to load external entity "news.html.in"

On Wed, Jul 17, 2019 at 05:02:02PM +0200, Peter Krempa wrote:
On Wed, Jul 17, 2019 at 16:37:06 +0200, Ján Tomko wrote:
Set a default namespace in the stylesheet instead.
Signed-off-by: Ján Tomko <jtomko@redhat.com> --- docs/Makefile.am | 8 +------- docs/news-html.xsl | 4 +++- 2 files changed, 4 insertions(+), 8 deletions(-)
Fails in vpath build:
news.html.in-tmp \ || { rm -f news.html.in-tmp; exit 1; }; name=`echo news.html.tmp | sed -e 's/.tmp//'`; \
/usr/bin/xsltproc --nonet \ /home/pipo/libvirt/docs/news-html.xsl \ /home/pipo/libvirt/docs/news.xml \ dir=`dirname news.html.tmp` ; \ if test "$dir" = "."; \ then \ style=site.xsl; \ else \ /usr/bin/mkdir -p $dir; \ style=subsite.xsl; \ fi; \ /usr/bin/xsltproc --stringparam pagename $name \ --stringparam timestamp "Wed Jul 17 15:00:08 UTC 2019" --nonet \ /home/pipo/libvirt/docs/$style news.html.in > news.html.tmp \ || { rm news.html.tmp && exit 1; } warning: failed to load external entity "news.html.in"
In non-vpath as well. I had a leftover file which is why it worked for me: diff --git a/docs/Makefile.am b/docs/Makefile.am index bc2fd6ea42..ae2673ca9b 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -242,8 +242,8 @@ news.html.in: \ $(AM_V_GEN)$(XSLTPROC) --nonet \ $(srcdir)/news-html.xsl \ $(srcdir)/news.xml \ - >$@-tmp \ - || { rm -f $@-tmp; exit 1; }; + >$@ \ + || { rm -f $@; exit 1; }; EXTRA_DIST += \ $(srcdir)/news.xml \ $(srcdir)/news.rng \

On Wed, Jul 17, 2019 at 17:06:22 +0200, Ján Tomko wrote:
On Wed, Jul 17, 2019 at 05:02:02PM +0200, Peter Krempa wrote:
On Wed, Jul 17, 2019 at 16:37:06 +0200, Ján Tomko wrote:
Set a default namespace in the stylesheet instead.
Signed-off-by: Ján Tomko <jtomko@redhat.com> --- docs/Makefile.am | 8 +------- docs/news-html.xsl | 4 +++- 2 files changed, 4 insertions(+), 8 deletions(-)
Fails in vpath build:
news.html.in-tmp \ || { rm -f news.html.in-tmp; exit 1; }; name=`echo news.html.tmp | sed -e 's/.tmp//'`; \
/usr/bin/xsltproc --nonet \ /home/pipo/libvirt/docs/news-html.xsl \ /home/pipo/libvirt/docs/news.xml \ dir=`dirname news.html.tmp` ; \ if test "$dir" = "."; \ then \ style=site.xsl; \ else \ /usr/bin/mkdir -p $dir; \ style=subsite.xsl; \ fi; \ /usr/bin/xsltproc --stringparam pagename $name \ --stringparam timestamp "Wed Jul 17 15:00:08 UTC 2019" --nonet \ /home/pipo/libvirt/docs/$style news.html.in > news.html.tmp \ || { rm news.html.tmp && exit 1; } warning: failed to load external entity "news.html.in"
In non-vpath as well. I had a leftover file which is why it worked for me:
diff --git a/docs/Makefile.am b/docs/Makefile.am index bc2fd6ea42..ae2673ca9b 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -242,8 +242,8 @@ news.html.in: \ $(AM_V_GEN)$(XSLTPROC) --nonet \ $(srcdir)/news-html.xsl \ $(srcdir)/news.xml \ - >$@-tmp \ - || { rm -f $@-tmp; exit 1; }; + >$@ \ + || { rm -f $@; exit 1; }; EXTRA_DIST += \ $(srcdir)/news.xml \ $(srcdir)/news.rng \
ACK

Wrap each release headline in an <a> element with the id set to the release value and page.xsl will take care of the rest. Reported-by: Kashyap Chamarthy <kchamart@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com> --- docs/news-html.xsl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/news-html.xsl b/docs/news-html.xsl index 6763a71fa3..5ca78d9578 100644 --- a/docs/news-html.xsl +++ b/docs/news-html.xsl @@ -41,12 +41,17 @@ <!-- Release --> <xsl:template match="release"> <h3> - <strong> - <xsl:value-of select="@version"/> - <xsl:text> (</xsl:text> - <xsl:value-of select="@date"/> - <xsl:text>)</xsl:text> - </strong> + <a> + <xsl:attribute name="id"> + <xsl:value-of select="@version"/> + </xsl:attribute> + <strong> + <xsl:value-of select="@version"/> + <xsl:text> (</xsl:text> + <xsl:value-of select="@date"/> + <xsl:text>)</xsl:text> + </strong> + </a> </h3> <ul> <xsl:apply-templates select="section"/> -- 2.20.1

On Wed, 2019-07-17 at 16:37 +0200, Ján Tomko wrote:
Wrap each release headline in an <a> element with the id set to the release value and page.xsl will take care of the rest.
Reported-by: Kashyap Chamarthy <kchamart@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com> --- docs/news-html.xsl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
Neat! :) Reviewed-by: Andrea Bolognani <abologna@redhat.com> -- Andrea Bolognani / Red Hat / Virtualization

On Wed, Jul 17, 2019 at 04:37:07PM +0200, Ján Tomko wrote:
Wrap each release headline in an <a> element with the id set to the release value and page.xsl will take care of the rest.
Reported-by: Kashyap Chamarthy <kchamart@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
Thanks for the quick patch! Just tested this locally. Works for me. FWIW: Tested-by: Kashyap Chamarthy >kchamart@redhat.com>
--- docs/news-html.xsl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
[...] -- /kashyap
participants (4)
-
Andrea Bolognani
-
Ján Tomko
-
Kashyap Chamarthy
-
Peter Krempa