diff --git a/distribusi/cli.py b/distribusi/cli.py
index ac63c48..b55fa80 100644
--- a/distribusi/cli.py
+++ b/distribusi/cli.py
@@ -84,6 +84,11 @@ def build_argparser():
help="Append index.html to menu items to aid navigation",
action="store_true")
+ parser.add_argument(
+ '--unfolding',
+ help="Enable unfolding detecting .unfolding",
+ action="store_true")
+
return parser
diff --git a/distribusi/distribusi.py b/distribusi/distribusi.py
index 67ec604..2882524 100644
--- a/distribusi/distribusi.py
+++ b/distribusi/distribusi.py
@@ -108,6 +108,90 @@ def write_index(args,index, html, html_head, html_footer):
f.write(html_footer)
+def render_dir(args, root):
+ html = []
+
+ for entry in os.listdir(root):
+
+ if args.no_hidden:
+ if entry.startswith('.'):
+ continue
+
+ name = entry
+ lv = root.split("/")
+ relative = lv[len(lv) - 1]
+ relative_path = "./{}/{}".format(relative, name)
+
+ if os.path.isfile(root + '/' + entry):
+
+ if 'index.html' not in name:
+ full_path = os.path.join(root, name)
+ mime = MIME_TYPE.from_file(full_path)
+ # example: MIME plain/text becomes 'type' plain 'subtype' text
+ type_, subtype = mime.split('/')
+
+ caption = name
+
+ if args.verbose:
+ print('Found file in dir ', name, 'as', mime)
+
+ if type_ in FILE_TYPES:
+ a = FILE_TYPES[type_].format(relative_path, caption)
+
+ # expansion for different kind of text files
+ if type_ == 'text':
+ if name.endswith('.html') or subtype == 'html':
+ subtype = 'html'
+ # what types of text files to expand
+ a = '