[libvirt] [PATCH 0/2] news: Further improvements

This applies on top of Peter's series[1], which has already been ACKed. [1] https://www.redhat.com/archives/libvir-list/2017-March/msg01478.html Andrea Bolognani (2): news: Remove handling of random HTML tags news: Allow empty <section> elements docs/news-html.xsl | 20 +++++++++----------- docs/news.xml | 9 --------- docs/schemas/news.rng | 17 ++++++++--------- 3 files changed, 17 insertions(+), 29 deletions(-) -- 2.7.4

Now that the source file is validated against a schema that only allows the <code> HTML tag to be used, we can rely on that assumption to simplify our XSLT stylesheet. --- docs/news-html.xsl | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/news-html.xsl b/docs/news-html.xsl index 2961106..dcbab86 100644 --- a/docs/news-html.xsl +++ b/docs/news-html.xsl @@ -82,15 +82,11 @@ <xsl:apply-templates/> </xsl:template> - <!-- Misc HTML tags, add more as they are needed --> - <xsl:template match="code|i|tt"> - <xsl:text disable-output-escaping="yes"><</xsl:text> - <xsl:value-of select="name()"/> - <xsl:text disable-output-escaping="yes">></xsl:text> + <!-- <code> HTML tag --> + <xsl:template match="code"> + <xsl:text disable-output-escaping="yes"><code></xsl:text> <xsl:apply-templates/> - <xsl:text disable-output-escaping="yes"></</xsl:text> - <xsl:value-of select="name()"/> - <xsl:text disable-output-escaping="yes">></xsl:text> + <xsl:text disable-output-escaping="yes"></code></xsl:text> </xsl:template> </xsl:stylesheet> -- 2.7.4

Creating dummy <change> elements was a workaround for the HTML DTD not allowing empty <ul> elements, but we can do better by tweaking the the XSLT stylesheet. --- docs/news-html.xsl | 8 +++++--- docs/news.xml | 9 --------- docs/schemas/news.rng | 17 ++++++++--------- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/docs/news-html.xsl b/docs/news-html.xsl index dcbab86..dd323f9 100644 --- a/docs/news-html.xsl +++ b/docs/news-html.xsl @@ -57,9 +57,11 @@ <strong> <xsl:value-of select="@title"/> </strong> - <ul> - <xsl:apply-templates select="change"/> - </ul> + <xsl:if test="*"> + <ul> + <xsl:apply-templates select="change"/> + </ul> + </xsl:if> </li> </xsl:template> diff --git a/docs/news.xml b/docs/news.xml index 9eb4d21..732d359 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -23,19 +23,10 @@ <release version="FIXME" date="unreleased"> <section title="New features"> - <change> - <summary/> - </change> </section> <section title="Improvements"> - <change> - <summary/> - </change> </section> <section title="Bug fixes"> - <change> - <summary/> - </change> </section> </release> diff --git a/docs/schemas/news.rng b/docs/schemas/news.rng index 94a6870..9212c3c 100644 --- a/docs/schemas/news.rng +++ b/docs/schemas/news.rng @@ -35,21 +35,20 @@ <attribute name="title"> <data type="string"/> </attribute> - <oneOrMore> - <ref name="change"/> - </oneOrMore> + <optional> + <oneOrMore> + <ref name="change"/> + </oneOrMore> + </optional> </element> </define> <define name="change"> <element name="change"> <element name="summary"> - <choice> - <data type="string"> - <param name="pattern">\n[^\n]+\n +</param> - </data> - <empty/> - </choice> + <data type="string"> + <param name="pattern">\n[^\n]+\n +</param> + </data> </element> <optional> <element name="description"> -- 2.7.4

On Thu, Mar 30, 2017 at 03:45:27PM +0200, Andrea Bolognani wrote:
Creating dummy <change> elements was a workaround for the HTML DTD not allowing empty <ul> elements, but we can do better by tweaking the the XSLT stylesheet. --- docs/news-html.xsl | 8 +++++--- docs/news.xml | 9 --------- docs/schemas/news.rng | 17 ++++++++--------- 3 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/docs/news.xml b/docs/news.xml index 9eb4d21..732d359 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -23,19 +23,10 @@
<release version="FIXME" date="unreleased"> <section title="New features"> - <change> - <summary/> - </change> </section> <section title="Improvements"> - <change> - <summary/> - </change> </section> <section title="Bug fixes"> - <change> - <summary/> - </change> </section> </release>
I think this defeats the purpose of the template. But on the other hand you can see how the change looks like in previous releases and git history etc.
diff --git a/docs/schemas/news.rng b/docs/schemas/news.rng index 94a6870..9212c3c 100644 --- a/docs/schemas/news.rng +++ b/docs/schemas/news.rng @@ -35,21 +35,20 @@ <attribute name="title"> <data type="string"/> </attribute> - <oneOrMore> - <ref name="change"/> - </oneOrMore> + <optional> + <oneOrMore> + <ref name="change"/> + </oneOrMore> + </optional>
Instead of this, you can use zeroOrMore. ACK series, with that changed if you are okay with the fact that I know XSL even less than RNG O=)

On Thu, Mar 30, 2017 at 03:45:27PM +0200, Andrea Bolognani wrote:
Creating dummy <change> elements was a workaround for the HTML DTD not allowing empty <ul> elements, but we can do better by tweaking the the XSLT stylesheet. --- docs/news-html.xsl | 8 +++++--- docs/news.xml | 9 --------- docs/schemas/news.rng | 17 ++++++++--------- 3 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/docs/news-html.xsl b/docs/news-html.xsl index dcbab86..dd323f9 100644 --- a/docs/news-html.xsl +++ b/docs/news-html.xsl @@ -57,9 +57,11 @@ <strong> <xsl:value-of select="@title"/> </strong> - <ul> - <xsl:apply-templates select="change"/> - </ul> + <xsl:if test="*"> + <ul> + <xsl:apply-templates select="change"/> + </ul> + </xsl:if> </li> </xsl:template>
diff --git a/docs/news.xml b/docs/news.xml index 9eb4d21..732d359 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -23,19 +23,10 @@
<release version="FIXME" date="unreleased"> <section title="New features"> - <change> - <summary/> - </change> </section> <section title="Improvements"> - <change> - <summary/> - </change> </section> <section title="Bug fixes"> - <change> - <summary/> - </change> </section> </release>
diff --git a/docs/schemas/news.rng b/docs/schemas/news.rng index 94a6870..9212c3c 100644 --- a/docs/schemas/news.rng +++ b/docs/schemas/news.rng @@ -35,21 +35,20 @@ <attribute name="title"> <data type="string"/> </attribute> - <oneOrMore> - <ref name="change"/> - </oneOrMore> + <optional> + <oneOrMore> + <ref name="change"/> + </oneOrMore> + </optional> </element> </define>
<define name="change"> <element name="change"> <element name="summary"> - <choice> - <data type="string"> - <param name="pattern">\n[^\n]+\n +</param> - </data> - <empty/> - </choice> + <data type="string"> + <param name="pattern">\n[^\n]+\n +</param> + </data> </element> <optional> <element name="description">
FYI, it looks like something in this change has broken schema validation on RHEL-6 vintage libxml https://ci.centos.org/view/libvirt/job/libvirt-master-check/systems=libvirt-... Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|

On Mon, 2017-04-03 at 17:54 +0100, Daniel P. Berrange wrote:
<define name="change"> <element name="change"> <element name="summary"> - <choice> - <data type="string"> - <param name="pattern">\n[^\n]+\n +</param> - </data> - <empty/> - </choice> + <data type="string"> + <param name="pattern">\n[^\n]+\n +</param> + </data> </element> <optional> <element name="description">
FYI, it looks like something in this change has broken schema validation on RHEL-6 vintage libxml
https://ci.centos.org/view/libvirt/job/libvirt-master-check/systems=libvirt-...
It was broken by introducing validation of release notes in the first place, not by tweaking the schema. I believe someone is already looking into it. -- Andrea Bolognani / Red Hat / Virtualization
participants (3)
-
Andrea Bolognani
-
Daniel P. Berrange
-
Martin Kletzander