Skip to content

Commit

Permalink
Merge pull request #26 from moggers87/25-strip-ext
Browse files Browse the repository at this point in the history
Fix extension stripping
  • Loading branch information
moggers87 committed Jul 8, 2018
2 parents 90da389 + 230bbc8 commit 7cc3af8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Unreleased
----------

- Fix bug where extension stripping was not being applied


.. _zero-zero-two:

0.0.2
Expand Down
2 changes: 1 addition & 1 deletion exhibition/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class Node:
"""
_meta_names = ["meta.yaml", "meta.yml"]
_index_file = "index.html"
_strip_exts = ["html"]
_strip_exts = [".html"]

_meta_header = "---\n"
_meta_footer = "---\n"
Expand Down
12 changes: 11 additions & 1 deletion exhibition/tests/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,24 @@ def test_full_url(self):
self.assertEqual(node.full_url, "/")

def test_full_url_with_parent(self):
parent_path = pathlib.Path(self.content_path.name)
child_path = pathlib.Path(self.content_path.name, "page.jpg")
child_path.touch()

parent_node = Node(parent_path, None, meta=self.default_settings)
child_node = Node(child_path, parent_node)

self.assertEqual(child_node.full_url, "/page.jpg")

def test_full_url_with_strip_ext(self):
parent_path = pathlib.Path(self.content_path.name)
child_path = pathlib.Path(self.content_path.name, "page.html")
child_path.touch()

parent_node = Node(parent_path, None, meta=self.default_settings)
child_node = Node(child_path, parent_node)

self.assertEqual(child_node.full_url, "/page.html")
self.assertEqual(child_node.full_url, "/page")

def test_full_url_with_index(self):
parent_path = pathlib.Path(self.content_path.name)
Expand Down

0 comments on commit 7cc3af8

Please sign in to comment.