Skip to content

Commit

Permalink
Merge pull request #4 from robertatakenaka/packtools_3.1.0_design_system
Browse files Browse the repository at this point in the history
Geração da página do artigo com Packtools 3.1.0 design system
  • Loading branch information
gitnnolabs authored Feb 27, 2023
2 parents 88bb775 + 6e19650 commit 2ff9584
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions opac/webapp/config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@
SSM_XML_URL_REWRITE = os.environ.get("OPAC_SSM_XML_URL_REWRITE", "True") == "True"
SSM_ARTICLE_ASSETS_OR_RENDITIONS_URL_REWRITE = SSM_XML_URL_REWRITE

HTML_GENERATOR_VERSION = os.environ.get('HTML_GENERATOR_VERSION', '3.0')

# SSM_BASE_URI ex: 'https://homolog.ssm.scielo.org:80/'
SSM_BASE_URI = "{scheme}://{domain}:{port}".format(
scheme=SSM_SCHEME, domain=SSM_DOMAIN, port=SSM_PORT
Expand Down
8 changes: 7 additions & 1 deletion opac/webapp/main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,10 +1140,16 @@ def render_html_from_xml(article, lang, gs_abstract=False):
else:
result = fetch_data(article.xml)

try:
xslt = current_app.config["HTML_GENERATOR_VERSION"]
except:
xslt = "3.0"

xml = etree.parse(BytesIO(result))

generator = HTMLGenerator.parse(
xml, valid_only=False, gs_abstract=gs_abstract, output_style="website"
xml, valid_only=False, gs_abstract=gs_abstract, output_style="website",
xslt=xslt,
)

return generator.generate(lang), generator.languages
Expand Down

0 comments on commit 2ff9584

Please sign in to comment.