Made the root of the man pages selectable in the CLI. Some fixes.
This commit is contained in:
parent
c93761c3ed
commit
579adf26d6
7 changed files with 23 additions and 10 deletions
2
Makefile
2
Makefile
|
|
@ -1,3 +1,3 @@
|
||||||
clean:
|
clean:
|
||||||
rm -rf ./output/*.html
|
rm -rf ./out/*
|
||||||
rm -rf ./tmp/*
|
rm -rf ./tmp/*
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,8 @@ feature ides:
|
||||||
- Maybe support for other converters / generators.
|
- Maybe support for other converters / generators.
|
||||||
- Links to other man pages as mentioned in the footer of all man pages, e.g.: pam(8).
|
- Links to other man pages as mentioned in the footer of all man pages, e.g.: pam(8).
|
||||||
But only if available in the current book.
|
But only if available in the current book.
|
||||||
- Maybe a progress bar instead of printing for every file being processed.
|
- Maybe a progress bar instead of printing for every file being processed
|
||||||
(https://www.geeksforgeeks.org/progress-bars-in-python/)
|
(https://www.geeksforgeeks.org/progress-bars-in-python/).
|
||||||
|
|
||||||
## Bugs
|
## Bugs
|
||||||
|
|
||||||
|
|
@ -89,4 +89,4 @@ path somewhere?).
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
- [The Linux man-pages project](https://www.kernel.org/doc/man-pages/) - I found this
|
- [The Linux man-pages project](https://www.kernel.org/doc/man-pages/) - I found this
|
||||||
project after researching a little for my idea and inspired me a lot to start my project.
|
project after researching a little for my idea and it inspired me a lot to start my project.
|
||||||
|
|
|
||||||
17
man2book
17
man2book
|
|
@ -32,9 +32,7 @@ __author__ = 'Johannes Findeisen <you@hanez.org>'
|
||||||
# currently i only increase the third number because i commit early and often and nearly on every
|
# currently i only increase the third number because i commit early and often and nearly on every
|
||||||
# commit there are new features. 0.2.0 will be ready for generating a full book. then i will use the
|
# commit there are new features. 0.2.0 will be ready for generating a full book. then i will use the
|
||||||
# pythonic version scheme.
|
# pythonic version scheme.
|
||||||
__version__ = '0.1.1'
|
__version__ = '0.1.2'
|
||||||
|
|
||||||
MANPAGE_PATH = '/usr/share/man/'
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
@ -62,13 +60,16 @@ def main():
|
||||||
'each manpage! e.g. df.1. it is not very '
|
'each manpage! e.g. df.1. it is not very '
|
||||||
'important actually.')
|
'important actually.')
|
||||||
|
|
||||||
|
parser.add_argument('-p', '--path', help='path to the root of the man pages. (default: '
|
||||||
|
'/usr/share/man/)')
|
||||||
|
|
||||||
parser.add_argument('-s', '--sections', help='the manpage sections. e.g. 8 or a list like '
|
parser.add_argument('-s', '--sections', help='the manpage sections. e.g. 8 or a list like '
|
||||||
'1,2,3')
|
'1,2,3')
|
||||||
|
|
||||||
parser.add_argument('target_directory', metavar='TARGET_DIRECTORY',
|
parser.add_argument('target_directory', metavar='TARGET_DIRECTORY',
|
||||||
help='the target directory for the output. it must contain two directories.'
|
help='the target directory for the output. it must contain two directories.'
|
||||||
'one is the directory for tempory file output (tmp/) and one for the '
|
'one is the directory for temporary file output (tmp/) and one for '
|
||||||
'final processing result (out).')
|
'the final processing result (out).')
|
||||||
|
|
||||||
parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + str(__version__))
|
parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + str(__version__))
|
||||||
|
|
||||||
|
|
@ -77,6 +78,10 @@ def main():
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
manpage_path = '/usr/share/man/'
|
||||||
|
if args.path:
|
||||||
|
manpage_path = args.path
|
||||||
|
|
||||||
output_dir = args.target_directory + 'out/'
|
output_dir = args.target_directory + 'out/'
|
||||||
sections = ['1', '2', '3', '4', '5', '6', '7', '8']
|
sections = ['1', '2', '3', '4', '5', '6', '7', '8']
|
||||||
tmp_dir = args.target_directory + 'tmp/'
|
tmp_dir = args.target_directory + 'tmp/'
|
||||||
|
|
@ -110,7 +115,7 @@ def main():
|
||||||
if args.debug:
|
if args.debug:
|
||||||
print('manpage_files: ' + str(manpage_files))
|
print('manpage_files: ' + str(manpage_files))
|
||||||
else:
|
else:
|
||||||
manpage_files = os.listdir(MANPAGE_PATH + 'man' + section + '/')
|
manpage_files = os.listdir(manpage_path + 'man' + section + '/')
|
||||||
|
|
||||||
args_limit = len(args_manpages)
|
args_limit = len(args_manpages)
|
||||||
if args.limit:
|
if args.limit:
|
||||||
|
|
|
||||||
0
template/cover.html
Normal file
0
template/cover.html
Normal file
0
template/foot.html
Normal file
0
template/foot.html
Normal file
3
template/head.html
Normal file
3
template/head.html
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<head>
|
||||||
|
<title>$TITLE</title>
|
||||||
|
</head>
|
||||||
5
template/index.html
Normal file
5
template/index.html
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en" id="top" xmlns="http://www.w3.org/1999/html">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
$HEAD
|
||||||
|
</html>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue