Skip to content

Commit

Permalink
Corrige apresentação de tabelas e figuras representadas em table-wrap…
Browse files Browse the repository at this point in the history
…-group e fig-group (#282)

* Remove trecho e cria um template com ele para tratar da área do título da tabela

* Cria um template para a área do corpo e rodapé da tabela

* Inibe a apresentação de `table-wrap[not(@id)]` e inclui a apresentação de `table-wrap-group[@id]`

* Cria template para apresentar os títulos das tabelas

* Cria o modal para `table-wrap-group[@id]`

* Apresentação de legendas de `table-wrap-group`

* Corrige a apresentação de `fig-group[@id]`

* Inclui a classe thumbImg no css

* Atualiza versão do packtools para 2.8.2

* Corrige testes que estavam com falha
  • Loading branch information
robertatakenaka authored Feb 24, 2022
1 parent ee5543a commit 69f08dc
Show file tree
Hide file tree
Showing 8 changed files with 293 additions and 75 deletions.

Large diffs are not rendered by default.

23 changes: 13 additions & 10 deletions packtools/catalogs/htmlgenerator/v2.0/article-text-fig.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,15 @@
exclude-result-prefixes="xlink mml"
version="1.0">

<xsl:template match="fig | fig-group">
<xsl:template match="fig[@id] | fig-group[@id]">
<!--
Cria a miniatura no texto completo, que ao ser clicada mostra a figura
ampliada
-->
<xsl:variable name="location">
<xsl:apply-templates select="alternatives | graphic" mode="file-location-thumb"/>
</xsl:variable>
<xsl:variable name="figid">
<xsl:choose>
<xsl:when test="@id"><xsl:value-of select="@id"/></xsl:when>
<xsl:otherwise>IDMISSING</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="figid"><xsl:apply-templates select="." mode="figure-id"/></xsl:variable>
<div class="row fig" id="{$figid}">
<a name="{$figid}"></a>
<div class="col-md-4 col-sm-4">
Expand All @@ -42,13 +37,21 @@
</a>
</div>
<div class="col-md-8 col-sm-8">
<xsl:apply-templates select="." mode="label-caption-thumb"></xsl:apply-templates>
<xsl:apply-templates select="." mode="fig-label-caption-thumb"/>
</div>
</div>
</xsl:template>

<xsl:template match="fig-group" mode="label-caption">
<xsl:apply-templates select="fig[@xml:lang=$TEXT_LANG]" mode="label-caption"></xsl:apply-templates>
<xsl:template match="fig-group[@id]" mode="fig-label-caption-thumb">
<xsl:apply-templates select="fig" mode="fig-label-caption-thumb"/>
</xsl:template>

<xsl:template match="fig" mode="fig-label-caption-thumb">
<xsl:apply-templates select="." mode="label-caption-thumb"/><br/>
</xsl:template>

<xsl:template match="fig[@id] | fig-group[@id]" mode="figure-id">
<xsl:value-of select="@id"/>
</xsl:template>

</xsl:stylesheet>
16 changes: 14 additions & 2 deletions packtools/catalogs/htmlgenerator/v2.0/article-text-table.xsl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="table-wrap">
<xsl:template match="table-wrap[@id] | table-wrap-group[@id]">
<div class="row table" id="{@id}">
<a name="{@id}"/>

Expand All @@ -14,10 +14,22 @@
</a>
</div>
<div class="col-md-8 col-sm-8">
<xsl:apply-templates select="." mode="label-caption-thumb"></xsl:apply-templates>
<!-- apresenta a legenda -->
<xsl:apply-templates select="." mode="table-label-caption-thumb"/>
</div>
</div>
</xsl:template>

<xsl:template match="table-wrap-group[@id]" mode="table-label-caption-thumb">
<!-- apresenta as legendas -->
<xsl:apply-templates select="table-wrap" mode="table-label-caption-thumb"/>
</xsl:template>

<xsl:template match="table-wrap" mode="table-label-caption-thumb">
<!-- apresenta a legenda -->
<xsl:apply-templates select="." mode="label-caption-thumb"/><br/>
</xsl:template>

<xsl:template match="table-wrap/table/@*">
<xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute>
</xsl:template>
Expand Down
44 changes: 26 additions & 18 deletions packtools/catalogs/htmlgenerator/v2.0/html-modals-figs.xsl
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="fig-group" mode="label-caption">
<xsl:apply-templates select="fig[@xml:lang=$TEXT_LANG]" mode="label-caption"></xsl:apply-templates>

<xsl:template match="fig-group[@id]" mode="fig-label-caption">
<xsl:apply-templates select="fig" mode="fig-label-caption"/>
</xsl:template>

<xsl:template match="fig" mode="fig-label-caption">
<xsl:apply-templates select="." mode="label-caption"/><br/>
</xsl:template>

<xsl:template match="fig | fig-group" mode="modal">
<xsl:variable name="figid">
<xsl:choose>
<xsl:when test="@id"><xsl:value-of select="@id"/></xsl:when>
<xsl:otherwise>IDMISSING</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="figid"><xsl:apply-templates select="." mode="figure-id"/></xsl:variable>
<div class="modal fade ModalFigs" id="ModalFig{$figid}" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
Expand All @@ -35,24 +35,17 @@
<span class="sci-ico-newWindow"></span>
</a>
</xsl:if>
<h4 class="modal-title"><span class="sci-ico-fileFigure"></span> <xsl:apply-templates select="." mode="label-caption"></xsl:apply-templates></h4>
<h4 class="modal-title"><span class="sci-ico-fileFigure"></span> <xsl:apply-templates select="." mode="fig-label-caption"></xsl:apply-templates></h4>
</div>
<div class="modal-body">
<xsl:apply-templates select="alternatives | graphic"/>
<xsl:apply-templates select="disp-formula"></xsl:apply-templates>
<xsl:apply-templates select="attrib"></xsl:apply-templates>
</div>
<div class="modal-footer">
<!--
<h4 class="modal-title"><span class="sci-ico-fileFigure"></span> <xsl:apply-templates select="." mode="label-caption"></xsl:apply-templates></h4>
-->
<xsl:apply-templates select="." mode="fig-modal-body"/>
</div>
</div>
</div>
</div>
</xsl:template>

<xsl:template match="fig-group" mode="file-location">
<xsl:template match="fig-group[@id]" mode="file-location">
<!--
Localização da imagem ampliada
-->
Expand All @@ -66,4 +59,19 @@
<xsl:apply-templates select="graphic | alternatives" mode="file-location"/>
</xsl:template>

<xsl:template match="fig-group[@id]" mode="fig-modal-body">
<!--
<img/>
-->
<xsl:apply-templates select="fig" mode="fig-modal-body"/>
</xsl:template>

<xsl:template match="fig" mode="fig-modal-body">
<!--
<img/>
-->
<xsl:apply-templates select="alternatives | graphic"/>
<xsl:apply-templates select="disp-formula"></xsl:apply-templates>
<xsl:apply-templates select="attrib"></xsl:apply-templates>
</xsl:template>
</xsl:stylesheet>
111 changes: 76 additions & 35 deletions packtools/catalogs/htmlgenerator/v2.0/html-modals-tables.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,87 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:template match="table-wrap" mode="modal">
<xsl:template match="table-wrap" mode="modal"/>
<xsl:template match="table-wrap" mode="modal-header"/>
<xsl:template match="table-wrap" mode="modal-body-and-footer"/>

<xsl:template match="table-wrap[@id] | table-wrap-group[@id]" mode="modal">
<div class="modal fade ModalTables" id="ModalTable{@id}" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&#xd7;</span>
<span class="sr-only">
<xsl:apply-templates select="." mode="interface">
<xsl:with-param name="text">Close</xsl:with-param>
</xsl:apply-templates>
</span>
</button>
<!-- FIXME -->
<!-- a class="link-newWindow showTooltip" href="" target="_blank" data-placement="left">
<xsl:attribute name="title"><xsl:apply-templates select="." mode="interface">
<xsl:with-param name="text">Open new window</xsl:with-param>
</xsl:apply-templates></xsl:attribute>
<span class="sci-ico-newWindow"></span></a -->
<h4 class="modal-title"><span class="sci-ico-fileTable"></span> <xsl:apply-templates select="." mode="label-caption"/></h4>
</div>
<div class="modal-body">
<xsl:choose>
<xsl:when test="table">
<xsl:apply-templates select="table"/>
</xsl:when>
<xsl:when test="graphic">
<xsl:apply-templates select="graphic"></xsl:apply-templates>
</xsl:when>
<xsl:when test="alternatives">
<xsl:apply-templates select="alternatives"/>
</xsl:when>
</xsl:choose>
</div>
<div class="modal-footer">
<xsl:apply-templates select="table-wrap-foot"></xsl:apply-templates>
</div>

<xsl:apply-templates select="." mode="modal-header"/>
<xsl:apply-templates select="." mode="modal-body-and-footer"/>

</div>
</div>
</div>
</div>
</xsl:template>

<xsl:template match="table-wrap[@id] | table-wrap-group[@id]" mode="modal-header">
<!--
Template para criar a área do título da tabela
-->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&#xd7;</span>
<span class="sr-only">
<xsl:apply-templates select="." mode="interface">
<xsl:with-param name="text">Close</xsl:with-param>
</xsl:apply-templates>
</span>
</button>
<!-- FIXME -->
<!-- a class="link-newWindow showTooltip" href="" target="_blank" data-placement="left">
<xsl:attribute name="title"><xsl:apply-templates select="." mode="interface">
<xsl:with-param name="text">Open new window</xsl:with-param>
</xsl:apply-templates></xsl:attribute>
<span class="sci-ico-newWindow"></span></a -->
<h4 class="modal-title">
<span class="sci-ico-fileTable"></span>
<xsl:apply-templates select="." mode="modal-header-label-caption"/>
</h4>
</div>
</xsl:template>

<xsl:template match="table-wrap-group[@id]" mode="modal-header-label-caption">
<!--
Template para os títulos da tabela
-->
<xsl:apply-templates select="table-wrap" mode="modal-header-label-caption"/>
</xsl:template>

<xsl:template match="table-wrap" mode="modal-header-label-caption">
<!--
Template para o título da tabela
-->
<xsl:apply-templates select="." mode="label-caption"/><br/>
</xsl:template>

<xsl:template match="table-wrap-group[@id]" mode="modal-body-and-footer">
<xsl:apply-templates select="table-wrap" mode="modal-body-and-footer"/>
</xsl:template>

<xsl:template match="table-wrap[table] | table-wrap[graphic] | table-wrap[alternatives]" mode="modal-body-and-footer">
<!--
Template para criar a área do corpo e nota de rodapé da tabela
-->
<div class="modal-body">
<xsl:choose>
<xsl:when test="table">
<xsl:apply-templates select="table"/>
</xsl:when>
<xsl:when test="graphic">
<xsl:apply-templates select="graphic"/>
</xsl:when>
<xsl:when test="alternatives">
<xsl:apply-templates select="alternatives"/>
</xsl:when>
</xsl:choose>
</div>
<div class="modal-footer">
<xsl:apply-templates select="table-wrap-foot"></xsl:apply-templates>
</div>
</xsl:template>

<xsl:template match="ref" mode="select">
Expand Down
2 changes: 1 addition & 1 deletion packtools/catalogs/htmlgenerator/v2.0/html-modals.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

<xsl:template match="front | body | back | sub-article" mode="table-individual-modal">
<!-- cria um modal para cada tabela existente no body-->
<xsl:apply-templates select=".//table-wrap[@xml:lang=$TEXT_LANG] | .//table-wrap[not(@xml:lang)]" mode="modal"/>
<xsl:apply-templates select=".//table-wrap[@id] | .//table-wrap-group[@id]" mode="modal"/>
</xsl:template>

<xsl:template match="article" mode="scheme-individual-modal">
Expand Down
2 changes: 1 addition & 1 deletion packtools/version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Single source to the version across setup.py and the whole project.
"""
from __future__ import unicode_literals
__version__ = '2.7.5'
__version__ = '2.8.2'

Loading

0 comments on commit 69f08dc

Please sign in to comment.