+
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
do site.
-->
<xsl:choose>
<xsl:when test="$article/@article-type='addendum'">This addendum adds information to the following document</xsl:when>
<xsl:when test=".='corrected-article'">This erratum corrects</xsl:when>
<xsl:when test=".='retracted-article'">This retraction retracts</xsl:when>
<xsl:when test=".='commentary-article'">This document comments</xsl:when>
Expand Down
24 changes: 15 additions & 9 deletions packtools/catalogs/htmlgenerator/v2.0/article-text-graphic.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -129,29 +129,35 @@
<xsl:value-of select="@xlink:href"/>
</xsl:template>

<!-- ORIGINAL FILE LOCATION -->
<xsl:template match="*" mode="original-file-location">
<xsl:template match="table-wrap-group | fig-group" mode="original-file-location">
<!--
CAMINHO DO ARQUIVO DA IMAGEM ORIGINAL (TAMANHO MAIOR)
-->
<xsl:apply-templates select="*" mode="original-file-location"/>
<xsl:apply-templates select="table-wrap | fig" mode="original-file-location"/>
</xsl:template>

<xsl:template match="alternatives" mode="original-file-location">
<xsl:template match="table-wrap | fig | disp-formula" mode="original-file-location">
<!--
CAMINHO DO ARQUIVO DA IMAGEM ORIGINAL (TAMANHO MAIOR)
-->
<xsl:apply-templates select="*[@xlink:href!='' and not(@specific-use) and not(@content-type)][1]" mode="original-file-location"/>
<xsl:apply-templates select="alternatives | graphic" mode="original-file-location"/>
</xsl:template>

<xsl:template match="graphic | inline-graphic" mode="original-file-location">
<xsl:template match="alternatives" mode="original-file-location">
<!--
CAMINHO DO ARQUIVO DA IMAGEM ORIGINAL (TAMANHO MAIOR | TIFF)
CAMINHO DO ARQUIVO DA IMAGEM ORIGINAL (TAMANHO MAIOR)
-->
<xsl:apply-templates select="@xlink:href" mode="fix_extension"/>
<xsl:choose>
<xsl:when test="*[not(@content-type) and not(@specific-use) and @xlink:href!='']">
<xsl:apply-templates select="*[not(@content-type) and not(@specific-use) and @xlink:href!='']" mode="original-file-location"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="*[@xlink:href!=''][1]" mode="original-file-location"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="alternatives/graphic | alternatives/inline-graphic" mode="original-file-location">
<xsl:template match="graphic | inline-graphic" mode="original-file-location">
<!--
CAMINHO DO ARQUIVO DA IMAGEM ORIGINAL (TAMANHO MAIOR | TIFF)
-->
Expand Down
8 changes: 2 additions & 6 deletions packtools/catalogs/htmlgenerator/v2.0/article-text-xref.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,11 @@
<xsl:template match="fn" mode="xref">
<xsl:apply-templates select="*|text()" mode="xref"></xsl:apply-templates>
</xsl:template>

<xsl:template match="fn/label" mode="xref">
<strong class="fn-title"><xsl:apply-templates select="*|text()" mode="xref"/></strong>
</xsl:template>

<xsl:template match="fn//*" mode="xref">
<xsl:apply-templates select="*|text()" mode="xref"/>
</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 Down
7 changes: 7 additions & 0 deletions packtools/catalogs/htmlgenerator/v2.0/config-labels.xml
Original file line number Diff line number Diff line change
Expand Up @@ -493,4 +493,11 @@
<name lang="pt">Este documento tem um adendo</name>
<name lang="es">Este documento tiene una addenda</name>
</term>
<term>
<name>This addendum adds information to the following document</name>
<name lang="en">This addendum adds information to the following document</name>
<name lang="pt">Este adendo adiciona informação ao documento</name>
<name lang="es">Esta addenda agrega información al documento</name>
</term>

</labels>
64 changes: 63 additions & 1 deletion packtools/catalogs/htmlgenerator/v2.0/html-modals-contribs.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,71 @@
<xsl:template match="aff" mode="modal-contrib">
<div>
<xsl:apply-templates select="." mode="display"/>
<xsl:apply-templates select="." mode="hidden-for-scimago"/>
</div>
</xsl:template>


<xsl:template match="aff" mode="hidden-for-scimago">
<span data-aff-orgname="{@id}" hidden="">
<xsl:apply-templates select="." mode="hidden-for-scimago-orgname"/>
</span>
<span data-aff-country="{@id}" hidden="">
<xsl:apply-templates select=".//country"/>
</span>
<span data-aff-country-code="{@id}" hidden="">
<xsl:apply-templates select=".//country/@country"/>
</span>
<span data-aff-location="{@id}" hidden="">
<xsl:apply-templates select="." mode="hidden-for-scimago-location"/>
</span>
<span data-aff-full="{@id}" hidden="">
<xsl:apply-templates select="." mode="hidden-for-scimago-orgname"/>, <xsl:apply-templates select="." mode="hidden-for-scimago-location"/>
</span>
<a href="" class="scimago-link" data-scimago-link="{@id}"/>
</xsl:template>

<xsl:template match="aff" mode="hidden-for-scimago-orgname">
<xsl:variable name="text"><xsl:apply-templates select="text()"/></xsl:variable>
<!--
<xsl:comment> $text: <xsl:value-of select="$text"/> </xsl:comment>
<xsl:comment> text(): <xsl:apply-templates select="text()"></xsl:apply-templates></xsl:comment>
-->

<xsl:choose>
<xsl:when
test="institution[@content-type='orgname']">
<!--
<xsl:comment> $text </xsl:comment>
-->
<xsl:value-of select="institution[@content-type='orgname']"/>
</xsl:when>
<xsl:when test="institution[@content-type='original']">
<!--
<xsl:comment> aff original </xsl:comment>
-->
<xsl:apply-templates select="institution[@content-type='original']"/>
</xsl:when>
<xsl:when
test="*[name()!='label']">
<!--
<xsl:comment> aff insert separator </xsl:comment>
-->
<xsl:apply-templates select="*[name()!='label']" mode="insert-separator"/>
</xsl:when>
<xsl:otherwise>
<!--
<xsl:comment> $text </xsl:comment>
-->
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>

</xsl:template>

<xsl:template match="aff" mode="hidden-for-scimago-location">
<xsl:apply-templates select=".//city | .//*[@content-type='city']"/>, <xsl:apply-templates select=".//state | .//*[@content-type='state']"/>, <xsl:apply-templates select=".//country"/>
</xsl:template>

<xsl:template match="contrib-id" mode="list-item">
<li>
<xsl:apply-templates select="."></xsl:apply-templates>
Expand Down
5 changes: 2 additions & 3 deletions packtools/file_utils_mimetype.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import magic
import mimetypes


def is_valid_file(file_path, check_mimetype=False):
Expand All @@ -14,5 +14,4 @@ def is_valid_file(file_path, check_mimetype=False):


def get_mimetype(file_path):
with open(file_path, 'rb') as fin:
return magic.from_buffer(fin.read(2048), mime=True)
return mimetypes.guess_type(file_path, strict=True)
21 changes: 18 additions & 3 deletions packtools/sps/models/article_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,28 @@ def v2(self, value):
node = self._get_node(
'.//article-id[@specific-use="scielo-v2"]'
)
if node is not None and node.text:
raise AttributeError(
"can't set attribute ArticleIds.v2. It is already set: %s" %
node.text
)
if not value:
raise ValueError(
"can't set attribute ArticleIds.v2. "
"Given value %s is not valid" % value)
if node is None:
node = etree.Element("article-id")
node.set("pub-id-type", "publisher-id")
node.set("specific-use", "scielo-v2")
self.am.insert(1, node)
if node is not None:
node.text = value
node.text = value

@v3.setter
def v3(self, value):
if not value:
raise ValueError(
"can't set attribute ArticleIds.v3. "
"Given value %s is not valid" % value)
node = self._get_node(
'.//article-id[@specific-use="scielo-v3"]'
)
Expand All @@ -87,6 +99,10 @@ def v3(self, value):

@aop_pid.setter
def aop_pid(self, value):
if not value:
raise ValueError(
"can't set attribute ArticleIds.aop_pid. "
"Given value %s is not valid" % value)
node = self._get_node(
'.//article-id[@specific-use="previous-pid" and '
'@pub-id-type="publisher-id"]'
Expand All @@ -110,4 +126,3 @@ def _get_node_text(self, xpath):
return self._get_node(xpath).text
except AttributeError:
return None

6 changes: 2 additions & 4 deletions packtools/sps/models/funding_group.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import logging

from packtools.sps.utils import xml_utils


logger = logging.getLogger(__name__)

Expand All @@ -23,8 +21,8 @@ class FundingGroup:
Arrangement containing a dictionary that correlates funding-source and award-id or values of one of the attributes.
"""

def __init__(self, xml):
self._xmltree = xml_utils.get_xml_tree(xml)
def __init__(self, xmltree):
self._xmltree = xmltree

@property
def award_groups(self):
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载