Skip to content

Commit f35cd26

Browse files
committed
Merge branch 'master' of github.com:BruceZhang1993/index-generator
2 parents 0384942 + a99e79a commit f35cd26

File tree

7 files changed

+58
-3
lines changed

7 files changed

+58
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
*.iml
33
__pycache__
44
/*.html
5+
/build

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
The MIT License (MIT)
3+
4+
Copyright (c) 2019 Bruce Zhang, Edward P
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

index_generator/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
APP_NAME = 'Index Generator'
22
APP_VERSION = '0.0.1'
33
APP_URL = 'https://github.com/BruceZhang1993/index-generator'
4+
PACKAGE_NAME = 'index-generator'

index_generator/__main__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ def generate_once(template_dir, root, files, name, if_print):
6565
html = template.render(ig={
6666
'root': '/'+root.lstrip('.*/'),
6767
'files': filelist
68+
'generator': {
69+
'name': APP_NAME,
70+
'version': APP_VERSION,
71+
'url': APP_URL
72+
}
6873
})
6974

7075
if if_print:
@@ -78,7 +83,7 @@ def generate_recursively(template_dir, path, name, if_print, max_depth=0):
7883
if max_depth != 0 and root.count(os.sep) >= max_depth:
7984
dirs.clear()
8085
continue
81-
86+
8287
dirs.sort()
8388
files.sort()
8489

@@ -88,7 +93,7 @@ def generate_recursively(template_dir, path, name, if_print, max_depth=0):
8893
print('dirs: {}'.format(dirs))
8994
print('files: {}'.format(files))
9095
print('-----------------------------------------')
91-
96+
9297
generate_once(template_dir, root, dirs+files, name, if_print)
9398

9499

index_generator/models/__init__.py

Whitespace-only changes.

index_generator/templates/default/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ <h1>Index of {{ ig.root }}</h1>
1313
{% endblock %}
1414
<hr>
1515
{% endblock %}
16-
<div>{% block footer %}Generated by index-generator.{% endblock %}</div>
16+
<div>{% block footer %}Generated by <a target="_blank" href="{{ ig.generator.url }}">{{ ig.generator.name }}</a> {{ ig.generator.version }}.{% endblock %}</div>
1717
</body>
1818
</html>

setup.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from setuptools import setup
2+
from index_generator import APP_NAME, APP_URL, APP_VERSION, PACKAGE_NAME
3+
4+
setup(
5+
name=PACKAGE_NAME,
6+
version=APP_VERSION,
7+
packages=[
8+
'index_generator',
9+
'index_generator.models'
10+
],
11+
package_data={
12+
'index_generator': ['templates/*/*']
13+
},
14+
include_package_data=True,
15+
url='https://github.com/BruceZhang1993',
16+
license='MIT',
17+
author='Bruce Zhang, Edward P',
18+
author_email='',
19+
description='Yet another index generator.',
20+
install_requires=['Jinja2'],
21+
entry_points={
22+
'console_scripts': [
23+
'index-generator=index_generator.__main__:main'
24+
]
25+
}
26+
)

0 commit comments

Comments
 (0)