Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
additional minor updates for 1.7.0-beta
Browse files Browse the repository at this point in the history
This update was combined with what was 1.6.3-beta
  • Loading branch information
afrubin committed Aug 10, 2019
2 parents 7c75ebe + 87eb263 commit 6fc56af
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 12 deletions.
34 changes: 25 additions & 9 deletions core/utilities/pandoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,25 @@

import pypandoc

PANDOC_DEFAULT_ARGS = (
"--mathml",
"--smart",
"--standalone",
"--biblatex",
"--html-q-tags",
)
if pypandoc.get_pandoc_version().startswith("2"):
MARKDOWN = "markdown+smart"
REST = "rst"
PANDOC_DEFAULT_ARGS = (
"--mathml",
"--standalone",
"--biblatex",
"--html-q-tags",
)
else:
MARKDOWN = "md"
REST = "rst"
PANDOC_DEFAULT_ARGS = (
"--mathml",
"--smart",
"--standalone",
"--biblatex",
"--html-q-tags",
)


def convert_md_to_html(source, extra_args=PANDOC_DEFAULT_ARGS, **kwargs):
Expand All @@ -23,7 +35,11 @@ def convert_md_to_html(source, extra_args=PANDOC_DEFAULT_ARGS, **kwargs):
"""
kwargs = {k: v for k, v in kwargs.items() if k not in ["format", "to"]}
md_blob = pypandoc.convert(
source, to="html", format="md", extra_args=extra_args, **kwargs
source,
to="html",
format=MARKDOWN,
extra_args=list(extra_args),
**kwargs
)
return md_blob

Expand All @@ -35,6 +51,6 @@ def convert_rest_to_html(source, extra_args=PANDOC_DEFAULT_ARGS, **kwargs):
"""
kwargs = {k: v for k, v in kwargs.items() if k not in ["format", "to"]}
rst_blob = pypandoc.convert(
source, to="html", format="rest", extra_args=extra_args, **kwargs
source, to="html", format=REST, extra_args=list(extra_args), **kwargs
)
return rst_blob
5 changes: 5 additions & 0 deletions data/main/citation_biorxiv.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
An open-source platform to distribute and interpret data from multiplexed assays of variant effect

Daniel Esposito, Jochen Weile, Jay Shendure, Lea M Starita, Anthony T Papenfuss, Frederick P Roth, Douglas M Fowler, Alan F Rubin

bioRxiv 555797; doi: https://doi.org/10.1101/555797
4 changes: 2 additions & 2 deletions data/main/site_info.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"branch": "",
"md_about": "about.md",
"md_citation": "",
"md_citation": "citation_biorxiv.md",
"md_documentation": "userdocs.md",
"md_privacy": "",
"md_terms": "",
"md_usage_guide": "",
"version": "1.6.3-beta"
"version": "1.7.0-beta"
}
8 changes: 8 additions & 0 deletions dataset/tests/test_views_scoreset.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ def setUp(self):
self.template_404 = "main/404.html"
celery_app.conf.update(CELERY_TASK_ALWAYS_EAGER=True)

def test_title_in_metadata_description_tag(self):
obj = ScoreSetFactory()
obj = publish_dataset(obj)
response = self.client.get("/scoreset/{}/".format(obj.urn))
self.assertEqual(response.status_code, 200)
tag = '<meta name="description" content="{}">'.format(obj.title)
self.assertContains(response, tag)

def test_404_status_and_template_used_when_object_not_found(self):
obj = ScoreSetFactory()
urn = obj.urn
Expand Down
6 changes: 5 additions & 1 deletion main/templates/main/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="MaveDB - repository for DMS/MAVE assay datasets">
{% if instance.title %}
<meta name="description" content="{{ instance.title }}">
{% else %}
<meta name="description" content="MaveDB - A repository for MAVE assay datasets.">
{% endif %}
<meta name="author" content="Daniel C. Esposito, Alan F. Rubin">
<meta name="keywords" content="dms,deep mutational scanning,mave,multiplex assays of
variant effect,variant effect,gene,genomic,variants,functional assay,multiplex assay">
Expand Down
9 changes: 9 additions & 0 deletions main/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ def test_uses_home_template(self):
response = self.client.get("/")
self.assertTemplateUsed(response, "main/home.html")

def test_render_default_metadata_description_tag(self):
response = self.client.get("/")
self.assertEqual(response.status_code, 200)
tag = (
'<meta name="description" content="MaveDB - '
'A repository for MAVE assay datasets.">'
)
self.assertContains(response, tag)

def test_news_items_display(self):
n1 = NewsFactory()
n2 = NewsFactory()
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ envlist = python3.4
skip_missing_interpreters = false

[testenv]
recreate = true
commands =
pip install -r requirements/staging.txt
python manage.py migrate --settings=settings.staging_ci
Expand Down

0 comments on commit 6fc56af

Please sign in to comment.