Skip to content

Commit

Permalink
DOCTEAM-1368: Improve handling of SBP series
Browse files Browse the repository at this point in the history
In the regular stylesheets:
* Introduce a new parameter json-ld-seriesname (default empty)
* Introduce add.series.name and implement the following algorithm
  for meta[@name='series']:
  * Check for non-empty $json-ld-seriesname parameter. If yes,
    use it. If not, continue
  * Check if d:info/d:meta[@name='series'] exist. If yes, use.
    If not abort.
* Adapt SASS/CSS stylesheets

For the SBP stylesheets

* Set parameter json-ld-seriesname to "SUSE Best Practices"
* Change FO/HTML stylesheet to produce a single line for each category
* Fix series and categories for SBP in cover page
  The cover page places series name and categories in the
  following way:

  Series Name ("SUSE Best Practices")
  - space -
  Category 1
  Category 2
  • Loading branch information
tomschr committed May 13, 2024
1 parent 3699d03 commit 7171dd1
Show file tree
Hide file tree
Showing 10 changed files with 421 additions and 350 deletions.
13 changes: 8 additions & 5 deletions sbp/fo/article.titlepage.templates.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
<fo:table>
<fo:table-body>
<fo:table-cell text-align="start">
<fo:block>
<!-- The logo needs this placement, otherwise it's shited down and right -->
<fo:block padding-top="0pt" margin-top="-14pt" margin-left="-10pt">
<fo:instream-foreign-object
content-width="{$titlepage.logo.width.article}"
width="{$titlepage.logo.width}">
Expand All @@ -36,9 +37,9 @@
</fo:table-cell>
<fo:table-cell text-align="right" color="&c_jungle;">
<fo:block font-size="&xxx-large;pt">
<xsl:apply-templates select="d:info/d:meta[@name='series'][1]" mode="article.titlepage.recto.auto.mode"/>
<xsl:value-of select="$json-ld-seriesname"/>
</fo:block>
<fo:block font-size="&large;pt">
<fo:block font-size="&large;pt" space-before="1em">
<xsl:apply-templates select="d:info/d:meta[@name='category'][1]" mode="article.titlepage.recto.auto.mode"/>
</fo:block>
</fo:table-cell>
Expand Down Expand Up @@ -106,11 +107,13 @@
</xsl:template>

<xsl:template match="d:meta[@name='series']" mode="article.titlepage.recto.auto.mode">
<xsl:apply-templates/>
<!-- We don't process it anymore, using $json-ld-seriesname parameter -->
</xsl:template>

<xsl:template match="d:meta[@name='category']" mode="article.titlepage.recto.auto.mode">
<xsl:apply-templates/>
<xsl:for-each select="*">
<fo:block><xsl:apply-templates/></fo:block>
</xsl:for-each>
</xsl:template>

<xsl:template match="d:meta[@name='platform']" mode="article.titlepage.recto.auto.mode">
Expand Down
5 changes: 4 additions & 1 deletion sbp/fo/param.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
xmlns:fo="http://www.w3.org/1999/XSL/Format"
exclude-result-prefixes="d">

<xsl:param name="titlepage.logo.image"><xsl:value-of select="$styleroot"/>images/sbp-tools-title.svg</xsl:param>

<xsl:param name="titlepage.logo.image"><xsl:value-of select="$styleroot"/>images/sbp-tools-title.svg</xsl:param>
<!-- Used as series name -->
<xsl:param name="json-ld-seriesname">SUSE Best Practices</xsl:param>
<xsl:param name="json-ld-seriesnameshort"/>
</xsl:stylesheet>
1 change: 1 addition & 0 deletions sbp/xhtml/docbook.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@

<xsl:include href="../VERSION.xsl"/>
<xsl:include href="titlepage.templates.xsl"/>
<xsl:include href="param.xsl"/>

</xsl:stylesheet>
10 changes: 10 additions & 0 deletions sbp/xhtml/param.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Specific parameters for the SBP stylesheets
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:param name="json-ld-seriesname">SUSE Best Practices</xsl:param>

</xsl:stylesheet>
21 changes: 18 additions & 3 deletions sbp/xhtml/titlepage.templates.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,16 @@


<xsl:template match="d:meta[@name='series']" mode="article.titlepage.recto.auto.mode">
<xsl:apply-templates select="."/>
<div class="series"><xsl:value-of select="$json-ld-seriesname"/></div>
</xsl:template>


<xsl:template match="d:meta[@name='category' or @name='type']" mode="article.titlepage.recto.auto.mode">
<xsl:apply-templates select="."/>
<div class="category">
<xsl:for-each select="*">
<p class="{local-name()}"><xsl:apply-templates/></p>
</xsl:for-each>
</div>
</xsl:template>


Expand All @@ -214,6 +218,17 @@
</xsl:template>


<xsl:template name="add.series.name">
<xsl:choose>
<xsl:when test="$json-ld-seriesname != ''">
<div class="series"><xsl:value-of select="$json-ld-seriesname"/></div>
</xsl:when>
<xsl:when test="d:info/d:meta[@name='series']">
<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="d:info/d:meta[@name='series']"/>
</xsl:when>
</xsl:choose>
</xsl:template>

<!-- XHTML titlepage -->
<xsl:template name="article.titlepage.recto">
<!-- TITLE -->
Expand Down Expand Up @@ -253,7 +268,7 @@

<div class="series-category">
<xsl:comment/>
<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="d:info/d:meta[@name='series']"/>
<xsl:call-template name="add.series.name"/>
<xsl:apply-templates mode="article.titlepage.recto.auto.mode" select="d:info/d:meta[@name='category' or @name='type']"/>
</div>

Expand Down
8 changes: 8 additions & 0 deletions source-assets/styles2022/sass/custom/content-title.sass
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ h2
margin-top: 3rem
margin-bottom: 3rem

.category
margin-top: 1.75rem

.phrase
display: block
text-align: right
line-height: 1rem


.cover
margin-top: 2rem
Expand Down
683 changes: 347 additions & 336 deletions suse2022-ns/static/css/style-new.css

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions suse2022-ns/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2435,6 +2435,12 @@ h2 {
font-size: 1.25rem;
margin-top: 3rem;
margin-bottom: 3rem; }
.titlepage .series-category .category {
margin-top: 1.75rem; }
.titlepage .series-category .category .phrase {
display: block;
text-align: right;
line-height: 1rem; }

.cover {
margin-top: 2rem;
Expand Down
20 changes: 15 additions & 5 deletions suse2022-ns/xhtml/json-ld.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,6 @@
</xsl:choose>
</xsl:template>


<xsl:template name="json-ld-publisher">
"sameAs": [
"https://www.facebook.com/SUSEWorldwide/about",
Expand Down Expand Up @@ -913,12 +912,23 @@
<!-- The following templates access the Docserv config -->
<xsl:template name="json-ld-series">
<xsl:param name="node" select="."/>
<xsl:variable name="meta-series" select="$node/d:info/d:meta[@name='series']"/>
<xsl:variable name="meta-series" select="$node/d:info/d:meta[@name='series'][1]"/>
<xsl:variable name="candidate-series">
<xsl:choose>
<xsl:when test="$json-ld-seriesname != ''">
<xsl:value-of select="$json-ld-seriesname"/>
</xsl:when>
<xsl:when test="$meta-series">
<xsl:value-of select="$meta-series"/>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>

<xsl:if test="$meta-series != ''">
"isPartOf": {
<xsl:if test="$candidate-series != ''">
"isPartOf": {
"@type": "CreativeWorkSeries",
"name": "<xsl:value-of select="normalize-space($meta-series)"/>"
"name": "<xsl:value-of select="normalize-space($candidate-series)"/>"
},
</xsl:if>
</xsl:template>
Expand Down
4 changes: 4 additions & 0 deletions suse2022-ns/xhtml/param.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@ task before
>https://www.suse.com/assets/img/suse-white-logo-green.svg</xsl:param>
<!-- The logo -->
<xsl:param name="json-ld-image-url" select="$json-ld-fallback-author-logo" />
<!-- By default, these are empty and are set by the SBP stylesheets -->
<xsl:param name="json-ld-seriesname"/>
<xsl:param name="json-ld-seriesnameshort"/>


<!-- The DC file needs to be passed to find the structure in the Docserv config -->
<xsl:param name="dcfilename"/>
Expand Down

0 comments on commit 7171dd1

Please sign in to comment.