diff --git a/.gitingore b/.gitignore similarity index 100% rename from .gitingore rename to .gitignore diff --git a/data/templates/basic/layout/base.html b/data/templates/basic/layout/base.html index 3821ef7..93c90ef 100644 --- a/data/templates/basic/layout/base.html +++ b/data/templates/basic/layout/base.html @@ -46,7 +46,7 @@ {% endblock headjs %} {% block endhead %}{% endblock endhead %} - +
diff --git a/hyde/fs.py b/hyde/fs.py index 40d70ca..c468415 100644 --- a/hyde/fs.py +++ b/hyde/fs.py @@ -4,14 +4,14 @@ python are distributed across modules: os, os.path, fnamtch, shutil and distutil to make the right choices for common operations to provide a single interface. """ -import codecs -import fnmatch +# import codecs +# import fnmatch import os -import shutil -from datetime import datetime +# import shutil +# from datetime import datetime # pylint: disable-msg=E0611 -from distutils import dir_util, file_util +# from distutils import dir_util, file_util class FS(object): """ @@ -25,4 +25,32 @@ class FS(object): return self.path def __repr__(self): - return self.path \ No newline at end of file + return self.path + + @property + def name(self): + """ + Returns the name of the FS object with its extension + """ + return os.path.basename(self.path) + + @property + def name_without_extension(self): + """ + Returns the name of the FS object without its extension + """ + return os.path.splitext(self.name)[0] + + @property + def extension(self): + """ + File's extension prefixed with a dot. + """ + return os.path.splitext(self.path)[1] + + @property + def kind(self): + """ + File's extension without a dot prefix. + """ + return self.extension.lstrip(".") \ No newline at end of file diff --git a/hyde/tests/test_fs.py b/hyde/tests/test_fs.py index 89ebb9b..98c019d 100644 --- a/hyde/tests/test_fs.py +++ b/hyde/tests/test_fs.py @@ -12,3 +12,18 @@ def test_representation(): assert str(f) == __file__ assert repr(f) == __file__ +def test_name(): + f = FS(__file__) + assert f.name == "test_fs.py" + +def test_name_without_extension(): + f = FS(__file__) + assert f.name_without_extension == "test_fs" + +def test_extension(): + f = FS(__file__) + assert f.extension == ".py" + +def test_kind(): + f = FS(__file__) + assert f.kind == "py" \ No newline at end of file