wget lines optional
This commit is contained in:
@@ -22,7 +22,7 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
MARKDOWN_AVAILABLE = False
|
MARKDOWN_AVAILABLE = False
|
||||||
|
|
||||||
VERSION = "20220217"
|
VERSION = "20221124"
|
||||||
IMAGE_EXTENSIONS = ["png", "gif", "jpg", "jpeg", "tif", "tiff"]
|
IMAGE_EXTENSIONS = ["png", "gif", "jpg", "jpeg", "tif", "tiff"]
|
||||||
AUDIO_EXTENSIONS = ["wav", "mp3", "ogg"]
|
AUDIO_EXTENSIONS = ["wav", "mp3", "ogg"]
|
||||||
VIDEO_EXTENSIONS = ["mp4", "ogg", "webm"]
|
VIDEO_EXTENSIONS = ["mp4", "ogg", "webm"]
|
||||||
@@ -35,6 +35,7 @@ SAFE_OPTS = (
|
|||||||
"media",
|
"media",
|
||||||
"includes",
|
"includes",
|
||||||
"no_readme",
|
"no_readme",
|
||||||
|
"no_wget",
|
||||||
"reverse",
|
"reverse",
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -68,6 +69,13 @@ def setup():
|
|||||||
default=False,
|
default=False,
|
||||||
help="Do not show README.md on the page",
|
help="Do not show README.md on the page",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--no-wget",
|
||||||
|
action="store_true",
|
||||||
|
dest="no_wget",
|
||||||
|
default=False,
|
||||||
|
help="Do not show wget download links",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-t",
|
"-t",
|
||||||
type=str,
|
type=str,
|
||||||
@@ -253,8 +261,9 @@ def generate_index(opts):
|
|||||||
f.write(get_pathlink(path, di))
|
f.write(get_pathlink(path, di))
|
||||||
for fi in files:
|
for fi in files:
|
||||||
f.write(get_filelink(path, fi, opts.images, opts.media))
|
f.write(get_filelink(path, fi, opts.images, opts.media))
|
||||||
f.write(get_footer(readme))
|
f.write(get_footer(readme, show_wget=not opts.no_wget))
|
||||||
f.write(get_download_lines(files, recursive=opts.recursive))
|
if not opts.no_wget:
|
||||||
|
f.write(get_download_lines(files, recursive=opts.recursive))
|
||||||
f.close()
|
f.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -1033,15 +1042,22 @@ function show_wget_magic() {
|
|||||||
return header
|
return header
|
||||||
|
|
||||||
|
|
||||||
def get_footer(readme):
|
def get_footer(readme, show_wget=True):
|
||||||
return """</tbody></table>{README}
|
if show_wget:
|
||||||
</div>
|
wget_str = """
|
||||||
<div id=wget_container>
|
<div id=wget_container>
|
||||||
<div id=wget_toggle onclick="show_wget_magic()">wget?</div>
|
<div id=wget_toggle onclick="show_wget_magic()">wget?</div>
|
||||||
<pre id=wget_magic class=hidden></pre>
|
<pre id=wget_magic class=hidden></pre>
|
||||||
</div>
|
</div>
|
||||||
|
"""
|
||||||
|
else:
|
||||||
|
wget_str = ""
|
||||||
|
|
||||||
|
return """</tbody></table>{README}
|
||||||
|
</div>{WGET_STR}
|
||||||
</body></html>""".format(
|
</body></html>""".format(
|
||||||
README=readme
|
README=readme,
|
||||||
|
WGET_STR=wget_str
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user