Skip to content

Commit

Permalink
Various issues
Browse files Browse the repository at this point in the history
Pull request #45 
- Potential fix for #9 (Left menu weird behavior)
- Fix for CSS argument in command line call
- Fix #44 [Closing tag in browser]
- Updated tests and bumped version to 0.0.5
  • Loading branch information
PonteIneptique committed Apr 19, 2016
1 parent 4bab839 commit b72f3f0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
11 changes: 4 additions & 7 deletions flask_nemo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ def __init__(self, name=None, app=None, api_url="/", retriever=None, base_url="/
if isinstance(urntransform, dict):
self.__urntransform.update(urntransform)


self.chunker = {}
self.chunker["default"] = Nemo.default_chunker
if isinstance(chunker, dict):
Expand Down Expand Up @@ -258,7 +257,7 @@ def transform(self, work, xml):
if isinstance(func, str):
with open(func) as f:
xslt = etree.XSLT(etree.parse(f))
return etree.tostring(xslt(xml), encoding=str)
return etree.tostring(xslt(xml), encoding=str, method="html", xml_declaration=None, pretty_print=False, with_tail=True, standalone=None)

# If we have a function, it means we return the result of the function
elif isinstance(func, Callable):
Expand Down Expand Up @@ -969,7 +968,6 @@ def scheme_chunker(text, getreffs):
:return: List of urn references with their human readable version
:rtype: [(str, str)]
"""
# print(text)
level = len(text.citation)
types = [citation.name for citation in text.citation]
if types == ["book", "poem", "line"]:
Expand Down Expand Up @@ -1177,7 +1175,7 @@ def cmd():
help='Host to use for the HTTP Server')
parser.add_argument('--inventory', type=str, default=None,
help='Inventory to request from the endpoint')
parser.add_argument('--css', type=str, default="",
parser.add_argument('--css', type=str, default=None, nargs='*',
help='Full path to secondary css file')
parser.add_argument('--groupby', type=int, default=25,
help='Number of passage to group in the deepest level of the hierarchy')
Expand All @@ -1189,14 +1187,13 @@ def cmd():
app = Flask(
__name__
)

# We set up Nemo
nemo = Nemo(
app=app,
name="nemo",
base_url="",
css=[args.css],
inventory=args.inventory,
css=args.css,
inventory = args.inventory,
api_url=args.endpoint,
chunker={"default": lambda x, y: Nemo.level_grouper(x, y, groupby=args.groupby)}
)
Expand Down
2 changes: 1 addition & 1 deletion flask_nemo/data/static/css/theme.min.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ul.menu li a,
#menu-container header .content,
#menu-container header .search {
display:block;
height:4;
min-height:1.618em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
Expand Down
1 change: 0 additions & 1 deletion flask_nemo/data/templates/container.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
{% for css in assets["css"] %}
<link rel="stylesheet" href="{{url_for('.secondary_assets', type='css', asset=css)}}">
{% endfor %}

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MyCapytain>=1.0.1
requests_cache>=0.4.9
Flask>=0.10.1
Flask>=0.10.1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='flask_nemo',
version="0.0.4",
version="0.0.5",
packages=find_packages(exclude=["examples"]),
url='https://github.com/capitains/flask-capitains-nemo',
license='GNU GPL',
Expand Down
4 changes: 3 additions & 1 deletion tests/test_customization.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,6 @@ def test_transform_urn_xslt(self):
),
etree.fromstring('<tei:body xmlns:tei="http://www.tei-c.org/ns/1.0" />')
)
self.assertEqual(transformed, '<tei:notbody xmlns:tei="http://www.tei-c.org/ns/1.0"/>')
self.assertEqual(transformed, '<tei:notbody xmlns:tei="http://www.tei-c.org/ns/1.0"></tei:notbody>',
"It should autoclose the tag"
)

0 comments on commit b72f3f0

Please sign in to comment.