Skip to content

Commit

Permalink
Cria as XSL para a versão 3.0 implementando SciELO Design System (#379)
Browse files Browse the repository at this point in the history
* Cria a pasta v3.0 contendo XSL que incluem o arquivo XSL correspondente na versão 2.0

* Reescreve os templates para trocar H1 por H3

* Altera templates que apresentam autores
- troca `class="contribGroup"` por `class="scielo__contribGroup"`
- troca `class="outlineFadeLink" data-toggle="modal"` por `class="btn btn-secondary btn-sm outlineFadeLink" data-bs-toggle="modal"`
- troca `<span class="dropdown">...</span>` por `<div class="dropdown">...</div>`
- altera apresentação dos dados dos autores

* Troca h1 por h3

* Modifica atributos dos links que abrem um modal

* Altera os atributos do link que faz cópia do DOI do artigo

* Troca h1 para h3, h2 para h4, h3 para h5

* Modifica atributos de links presentes em modal

* Aplicação de design system em elementos a, ul, logo acesso aberto, etc
Deixa configurável os caminhos de CSS

* Adiciona novos parâmetros:
 - bootstrap_css_path
 - article_css_path
 - design_system_static_img_path

* Troca h1 por h3

* Troca h4 por h5 e corrige botão 'close'

* XSL root para a versão 3.0

* Aplica Design System aos modais

* Garante a existência de um espaço após doi

* Modifica os atributos do elemento a (link) que há no thumbnail de figura ou tabela

* Adiciona `<meta name="viewport" content="width=device-width, initial-scale=1"/>`
Faz ajustes no menu flutuante do rodapé

* Modifica os links entre as menções de notas e referências bibliográficas para se adequar com o modo de leitura para acessibilidade

* Modifica htmlgenerator para gerar os htmls com a versão 3.0

* voltar à versão anterior, pois mudanças aplicadas deveriam ter sido feitas em v3.0

* Faz correções na aplicação do design system

* Adiciona html v3.0 (design system)

* Evita que conteúdo de xref fique com `sup` excedente

* Adiciona os HTML gerados pela versão 3.0

* Atualiza a versão do Design System

* Remove link de retorno para a menção da nota

* Ajusta a apresentação de xref e elementos associados (fn, author-notes, ref) para atender leitor / acessibilidade

* Ajustes no código / testes para corrigir testes quebrados

* Corrige o link para a versão "original" de graphic

* Ajusta o path dos arquivos html de controle de mudança

* Adiciona dados de afiliação ocultos no html para adicionar link para o scimago

* Adiciona dados de afiliação ocultos no html para adicionar link para o scimago e adiciona estilo na lista de referência para o número ser apresentado em azul

* Corrige o nome do módulo que contém a classe para manipular os dados de journal-meta

* Remove item duplicado

* Altera versão para 3.1.0
  • Loading branch information
robertatakenaka authored Feb 16, 2023
1 parent 46fccd3 commit 2104f9b
Show file tree
Hide file tree
Showing 138 changed files with 44,069 additions and 184 deletions.
5 changes: 5 additions & 0 deletions packtools/catalogs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@
'HTML_GEN_XSLTS': {
'root-html-1.2.xslt': os.path.join(_CWD, 'htmlgenerator/root-html-1.2.xslt'),
'root-html-2.0.xslt': os.path.join(_CWD, 'htmlgenerator/root-html-2.0.xslt'),
'root-html-3.0.xslt': os.path.join(_CWD, 'htmlgenerator/root-html-3.0.xslt'),
},
'HTML_GEN_BOOTSTRAP_CSS_PATH': os.path.join(_CWD,
'htmlgenerator/v3.0/scielo.parati.design/aberto-ds-scielo/dist/version/1.1.3/css/bootstrap.css'),
'HTML_GEN_ARTICLE_CSS_PATH': os.path.join(_CWD,
'htmlgenerator/v3.0/scielo.parati.design/aberto-ds-scielo/dist/version/1.1.3/css/article.css'),
'HTML_GEN_DEFAULT_PRINT_CSS_PATH': os.path.join(_CWD,
'htmlgenerator/static/scielo-bundle-print.css'),
'HTML_GEN_DEFAULT_CSS_PATH': os.path.join(_CWD,
Expand Down
10 changes: 10 additions & 0 deletions packtools/catalogs/htmlgenerator/root-html-3.0.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
exclude-result-prefixes="xlink mml">

<xsl:include href="v3.0/article.xsl"/>

</xsl:stylesheet>
15 changes: 5 additions & 10 deletions packtools/catalogs/htmlgenerator/v2.0/article-text-xref.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@
</span>
</xsl:template>

<xsl:template match="text()" mode="xref">
<xsl:value-of select="."/>
</xsl:template>

<xsl:template match="*" mode="xref">
<xsl:apply-templates select="*|text()" mode="xref"/>
</xsl:template>
Expand All @@ -144,7 +148,7 @@
<xsl:template match="fn/label" mode="xref">
<strong class="fn-title"><xsl:apply-templates select="*|text()" mode="xref"/></strong>
</xsl:template>

<xsl:template match="ref" mode="xref">
<xsl:variable name="url"><xsl:apply-templates select="." mode="url"></xsl:apply-templates></xsl:variable>
<xsl:if test="label">
Expand All @@ -159,16 +163,7 @@
</xsl:if>

</xsl:template>

<xsl:template match="mixed-citation" mode="xref">

<xsl:apply-templates select="*|text()" mode="xref"/>
</xsl:template>

<xsl:template match="mixed-citation//*" mode="xref">
<xsl:apply-templates select="*|text()" mode="xref"/>
</xsl:template>

<xsl:template match="fn//ext-link" mode="xref">
<xsl:apply-templates select="."></xsl:apply-templates>
</xsl:template>
Expand Down
2 changes: 1 addition & 1 deletion packtools/catalogs/htmlgenerator/v2.0/article.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,4 @@
<a id="shorten" href="#" class="short-link"><span class="sci-ico-link"/></a>
</h1>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>
1 change: 1 addition & 0 deletions packtools/catalogs/htmlgenerator/v2.0/generic-history.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:variable name="related_preprint" select="//related-article[@related-article-type='preprint']"/>

<xsl:template match="article-meta | sub-article | response" mode="generic-history">
<xsl:if test=".//history">
<div class="articleSection">
Expand Down
22 changes: 13 additions & 9 deletions packtools/catalogs/htmlgenerator/v2.0/html-modals.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@
<xsl:apply-templates select="p | sec | body/p | body/sec" mode="graphic-modal"/>
</xsl:template>

<xsl:template match="article" mode="modal-header-content">
<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>
<h4 class="modal-title"><xsl:value-of select="$graphic_elements_title"/></h4>
</xsl:template>

<xsl:template match="article" mode="modal-grouped-figs-tables-schemes">
<!--
Modal que apresenta juntos figuras, tabelas e fórmulas presentes
Expand All @@ -63,15 +75,7 @@
<div class="modal-dialog">
<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>
<h4 class="modal-title"><xsl:value-of select="$graphic_elements_title"/></h4>
<xsl:apply-templates select="." mode="modal-header-content"/>
</div>
<div class="modal-body">
<ul class="nav nav-tabs md-tabs" role="tablist">
Expand Down
52 changes: 52 additions & 0 deletions packtools/catalogs/htmlgenerator/v3.0/article-meta-abstract.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML"
exclude-result-prefixes="xlink mml">

<xsl:include href="../v2.0/article-meta-abstract.xsl"/>

<xsl:template match="article" mode="create-anchor-and-title-for-abstracts-without-title">
<xsl:variable name="q_titles" select="count(.//abstract[title])+count(.//trans-abstract[title])"/>
<xsl:if test="$q_titles = 0">
<xsl:variable name="q_abstracts" select="count(.//abstract[.//text()])+count(.//trans-abstract[.//text()])"/>

<!-- obtém o título traduzido para Abstracts ou Abstract -->
<xsl:variable name="title">
<xsl:apply-templates select="." mode="text-labels">
<xsl:with-param name="text">
<xsl:choose>
<xsl:when test="$q_abstracts=1">Abstract</xsl:when>
<xsl:otherwise>Abstracts</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:apply-templates>
</xsl:variable>

<!-- insere a âncora e o título -->
<div class="articleSection" data-anchor="{$title}">
<h3 class="articleSectionTitle"><xsl:value-of select="$title"/></h3>
</div>
</xsl:if>
</xsl:template>

<xsl:template match="abstract/sec/title | trans-abstract/sec/title">
<h4><xsl:apply-templates select="*|text()"/></h4>
</xsl:template>

<xsl:template match="abstract[title] | trans-abstract[title]" mode="anchor-and-title">
<!-- Apresenta a âncora e o título, ou seja, Abstract, Resumo, ou Resumen -->

<!-- âncora -->
<xsl:attribute name="class">articleSection</xsl:attribute>
<xsl:attribute name="data-anchor"><xsl:apply-templates select="." mode="title"/></xsl:attribute>
<xsl:if test="@xml:lang='ar'">
<xsl:attribute name="dir">rtl</xsl:attribute>
</xsl:if>

<!-- título -->
<h3>
<xsl:attribute name="class">articleSectionTitle</xsl:attribute>
<xsl:apply-templates select="." mode="title"></xsl:apply-templates>
</h3>
</xsl:template>
</xsl:stylesheet>
105 changes: 105 additions & 0 deletions packtools/catalogs/htmlgenerator/v3.0/article-meta-contrib.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML"
exclude-result-prefixes="xlink mml">

<xsl:include href="../v2.0/article-meta-contrib.xsl"/>

<xsl:template match="article" mode="contrib-group">
<div>
<xsl:attribute name="class">scielo__contribGroup</xsl:attribute>
<xsl:apply-templates select="front/article-meta//contrib-group"/>
</div>
</xsl:template>

<xsl:template match="sub-article" mode="contrib-group">
<div>
<xsl:attribute name="class">scielo__contribGroup</xsl:attribute>
<xsl:apply-templates select="front-stub/contrib-group | front/contrib-group"></xsl:apply-templates>
<xsl:if test="not(.//contrib) and ../@article-type='translation'">
<xsl:apply-templates select="$article//article-meta//contrib"></xsl:apply-templates>
</xsl:if>
</div>
</xsl:template>

<xsl:template match="article-meta/contrib-group | front/contrib-group | front-stub/contrib-group">
<xsl:variable name="id"><xsl:apply-templates select="." mode="modal-id"></xsl:apply-templates></xsl:variable>
<xsl:apply-templates select="contrib[@contrib-type='author']" mode="article-meta-contrib"/>
<xsl:if test="contrib/*[name()!='name' and name()!='collab']">
<a href="" class="btn btn-secondary btn-sm outlineFadeLink" data-bs-toggle="modal"
data-bs-target="#ModalTutors{$id}">
<xsl:apply-templates select="." mode="interface">
<xsl:with-param name="text">About the author<xsl:if test="count(contrib[@contrib-type='author'])&gt;1">s</xsl:if></xsl:with-param>
</xsl:apply-templates>
</a>
</xsl:if>
</xsl:template>

<xsl:template match="contrib" mode="article-meta-contrib">
<xsl:variable name="id">
<xsl:value-of select="position()"/>
</xsl:variable>
<div class="dropdown">
<button id="contribGroupTutor{$id}">
<xsl:attribute name="class">btn btn-secondary dropdown-toggle</xsl:attribute>
<xsl:attribute name="type">button</xsl:attribute>
<xsl:attribute name="data-bs-toggle">dropdown</xsl:attribute>
<xsl:attribute name="aria-expanded">false</xsl:attribute>
<xsl:choose>
<xsl:when test="$ABBR_CONTRIB='true'">
<xsl:apply-templates select="name|collab|on-behalf-of" mode="abbrev"/>
</xsl:when>
<xsl:otherwise><xsl:apply-templates select="name|collab|on-behalf-of"/></xsl:otherwise>
</xsl:choose>
</button>
<xsl:apply-templates select="." mode="contrib-dropdown-menu">
<xsl:with-param name="id">
<xsl:value-of select="$id"/>
</xsl:with-param>
</xsl:apply-templates>
</div>
</xsl:template>


<xsl:template match="contrib" mode="contrib-dropdown-menu">
<xsl:param name="id"/>
<xsl:if test="role or xref or contrib-id or bio">
<ul class="dropdown-menu" role="menu" aria-labelledby="contribGrupoTutor{$id}">
<xsl:apply-templates select="." mode="contrib-dropdown-menu-general"/>
<xsl:apply-templates select="xref[@ref-type='corresp']" mode="contrib-dropdown-menu-corresp"/>
</ul>
</xsl:if>
</xsl:template>

<xsl:template match="contrib" mode="contrib-dropdown-menu-general">
<xsl:if test="role or xref[@ref-type!='corresp'] or contrib-id or bio">
<li>
<xsl:apply-templates select="role | bio"/>
<xsl:apply-templates select="xref[@ref-type!='corresp']" mode="contrib-dropdown-menu"/>
<xsl:apply-templates select="contrib-id"/>
</li>
</xsl:if>
</xsl:template>

<xsl:template match="*" mode="contrib-dropdown-menu-corresp">
<xsl:apply-templates select="*|text()"/>
</xsl:template>

<xsl:template match="xref[@ref-type='corresp']" mode="contrib-dropdown-menu-corresp">
<xsl:variable name="rid"><xsl:value-of select="@rid"/></xsl:variable>
<!--
<li><div class="corresp"> <h3><sup>4</sup></h3> Autor para correspondência: <a href="mailto:author@gmail.com">author@gmail.com</a> </div></li>
-->

<li>
<xsl:apply-templates select="$article//*[@id=$rid]" mode="contrib-dropdown-menu-corresp"/>
</li>
</xsl:template>

<xsl:template match="author-notes/corresp" mode="contrib-dropdown-menu-corresp">
<div class="corresp">
<xsl:apply-templates select="*|text()"/>
</div>
</xsl:template>

</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML"
exclude-result-prefixes="xlink mml">

<xsl:include href="../v2.0/article-meta-permissions.xsl"/>

</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML"
exclude-result-prefixes="xlink mml">

<xsl:include href="../v2.0/article-meta-product.xsl"/>

</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML"
exclude-result-prefixes="xlink mml">

<xsl:include href="../v2.0/article-meta-related-article.xsl"/>

</xsl:stylesheet>
22 changes: 22 additions & 0 deletions packtools/catalogs/htmlgenerator/v3.0/article-meta.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML"
exclude-result-prefixes="xlink mml">

<xsl:include href="../v2.0/article-meta.xsl"/>

<xsl:template match="article-id[@pub-id-type='doi']" mode="display">
<xsl:variable name="link">https://doi.org/<xsl:value-of select="."/></xsl:variable>
<a href="{$link}" class="_doi" target="_blank"><xsl:value-of select="$link"/></a>
<xsl:text> <!-- espaço --></xsl:text>
<a
href="javascript:;"
class="btn btn-secondary btn-sm scielo__btn-with-icon--left copyLink"
data-clipboard-text="{$link}">
<span class="material-icons-outlined">link</span>
<xsl:apply-templates select="." mode="interface">
<xsl:with-param name="text">copy</xsl:with-param>
</xsl:apply-templates>
</a>
</xsl:template>
</xsl:stylesheet>
62 changes: 62 additions & 0 deletions packtools/catalogs/htmlgenerator/v3.0/article-text-back.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML"
exclude-result-prefixes="xlink mml">

<xsl:include href="../v2.0/article-text-back.xsl"/>

<xsl:template match="fn-group" mode="back-section">
<!--
Insere o "título" da seção de notas de rodapé
-->
<div class="articleSection">
<div class="row">
<div class="col">
<ul class="refList articleFootnotes">
<xsl:apply-templates select="*|text()" mode="back-section-content"/>
</ul>
</div>
</div>
</div>
</xsl:template>

<xsl:template match="back/fn" mode="back-section">
<!--
Insere o "título" da seção de notas de rodapé
-->
<div>
<xsl:attribute name="class">articleSection</xsl:attribute>
<div class="row">
<div class="col">
<ul class="refList articleFootnotes">
<xsl:apply-templates select="."/>
</ul>
</div>
</div>
</div>
</xsl:template>

<xsl:template match="*[title] | *[label]" mode="back-section">
<div>
<xsl:attribute name="class">articleSection</xsl:attribute>
<xsl:attribute name="data-anchor"><xsl:apply-templates select="." mode="title"/></xsl:attribute>
<h3>
<xsl:attribute name="class">articleSectionTitle</xsl:attribute>
<xsl:apply-templates select="." mode="title"/>
</h3>
<xsl:apply-templates select="*|text()" mode="back-section-content"/>
</div>
</xsl:template>

<xsl:template match="text()" mode="back-section-content">
<xsl:value-of select="."/>
</xsl:template>

<xsl:template match="*" mode="back-section-content">
<xsl:apply-templates select="."/>
</xsl:template>

<xsl:template match="title|label" mode="back-section-content">
<!-- do nothing -->
</xsl:template>
</xsl:stylesheet>
Loading

0 comments on commit 2104f9b

Please sign in to comment.