added --no-underscore to support better _style.css & _main.js
This commit is contained in:
parent
1317784a43
commit
d8f6451123
6 changed files with 24 additions and 4 deletions
|
|
@ -79,6 +79,11 @@ def build_argparser():
|
|||
help="Exclude hidden directories",
|
||||
action="store_true")
|
||||
|
||||
parser.add_argument(
|
||||
'--no-underscore',
|
||||
help="Exclude files/dirs starts with underscore(_)",
|
||||
action="store_true")
|
||||
|
||||
parser.add_argument(
|
||||
'--menu-with-index',
|
||||
help="Append index.html to menu items to aid navigation",
|
||||
|
|
|
|||
|
|
@ -113,12 +113,17 @@ def write_index(args,index, html, html_head, html_footer):
|
|||
def render_dir(args, root):
|
||||
html = []
|
||||
|
||||
for name in sorted(os.listdir(root)):
|
||||
#for name in sorted(os.listdir(root)):
|
||||
for name in sorted(os.listdir(root),reverse=True):
|
||||
|
||||
if args.no_hidden:
|
||||
if name.startswith('.'):
|
||||
continue
|
||||
|
||||
if args.no_underscore:
|
||||
if name.startswith('_'):
|
||||
continue
|
||||
|
||||
lv = root.split("/")
|
||||
relative = lv[len(lv) - 1]
|
||||
relative_path = "./{}/{}".format(relative, name)
|
||||
|
|
@ -218,6 +223,10 @@ def distribusify(args, directory): # noqa
|
|||
dirs = list(filter(lambda d: not d.startswith('.'), dirs))
|
||||
files = list(filter(lambda f: not f.startswith('.'), files))
|
||||
|
||||
if args.no_underscore:
|
||||
dirs = list(filter(lambda d: not d.startswith('_'), dirs))
|
||||
files = list(filter(lambda f: not f.startswith('_'), files))
|
||||
|
||||
dirs.sort()
|
||||
files.sort()
|
||||
|
||||
|
|
@ -227,7 +236,8 @@ def distribusify(args, directory): # noqa
|
|||
if args.verbose:
|
||||
print('Generating directory listing for', root)
|
||||
|
||||
for name in sorted(files):
|
||||
#for name in sorted(files):
|
||||
for name in sorted(files,reverse=True):
|
||||
|
||||
if 'index.html' not in name:
|
||||
full_path = os.path.join(root, name)
|
||||
|
|
@ -296,7 +306,9 @@ def distribusify(args, directory): # noqa
|
|||
else:
|
||||
html.append('<a href="../">../</a>')
|
||||
|
||||
for name in dirs:
|
||||
#for name in dirs:
|
||||
for name in sorted(dirs,reverse=True):
|
||||
|
||||
#check - time string
|
||||
m = PATTERN_TSTR.search(name)
|
||||
tstring = ""
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ html_head = """
|
|||
<style>
|
||||
%s
|
||||
</style>
|
||||
<link rel="stylesheet" href="_style.css">
|
||||
<script src="_main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header"></div>
|
||||
|
|
|
|||
0
inst_deps.sh
Normal file → Executable file
0
inst_deps.sh
Normal file → Executable file
2
run.sh
2
run.sh
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
python run.py -d ./data/ -nf -s styles/dark.css --no-hidden --unfolding
|
||||
python run.py -d ./data/ -nf -s styles/white.css --no-hidden --no-underscore --unfolding
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ body::-webkit-scrollbar {
|
|||
|
||||
#header {
|
||||
padding-bottom: 3em;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.unfolded {
|
||||
|
|
|
|||
Loading…
Reference in a new issue