Made the root of the man pages selectable in the CLI. Some fixes.

This commit is contained in:
Johannes Findeisen 2022-10-20 04:06:38 +02:00
commit 579adf26d6
7 changed files with 23 additions and 10 deletions

View file

@ -1,3 +1,3 @@
clean:
rm -rf ./output/*.html
rm -rf ./out/*
rm -rf ./tmp/*

View file

@ -77,8 +77,8 @@ feature ides:
- Maybe support for other converters / generators.
- 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.
- Maybe a progress bar instead of printing for every file being processed.
(https://www.geeksforgeeks.org/progress-bars-in-python/)
- Maybe a progress bar instead of printing for every file being processed
(https://www.geeksforgeeks.org/progress-bars-in-python/).
## Bugs
@ -89,4 +89,4 @@ path somewhere?).
## Links
- [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.

View file

@ -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
# commit there are new features. 0.2.0 will be ready for generating a full book. then i will use the
# pythonic version scheme.
__version__ = '0.1.1'
MANPAGE_PATH = '/usr/share/man/'
__version__ = '0.1.2'
def main():
@ -62,13 +60,16 @@ def main():
'each manpage! e.g. df.1. it is not very '
'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 '
'1,2,3')
parser.add_argument('target_directory', metavar='TARGET_DIRECTORY',
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 '
'final processing result (out).')
'one is the directory for temporary file output (tmp/) and one for '
'the final processing result (out).')
parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + str(__version__))
@ -77,6 +78,10 @@ def main():
args = parser.parse_args()
manpage_path = '/usr/share/man/'
if args.path:
manpage_path = args.path
output_dir = args.target_directory + 'out/'
sections = ['1', '2', '3', '4', '5', '6', '7', '8']
tmp_dir = args.target_directory + 'tmp/'
@ -110,7 +115,7 @@ def main():
if args.debug:
print('manpage_files: ' + str(manpage_files))
else:
manpage_files = os.listdir(MANPAGE_PATH + 'man' + section + '/')
manpage_files = os.listdir(manpage_path + 'man' + section + '/')
args_limit = len(args_manpages)
if args.limit:

0
template/cover.html Normal file
View file

0
template/foot.html Normal file
View file

3
template/head.html Normal file
View file

@ -0,0 +1,3 @@
<head>
<title>$TITLE</title>
</head>

5
template/index.html Normal file
View 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>