This reverts commit a2ab577848
.
This commit is contained in:

committed by
GitHub

parent
a2ab577848
commit
b333d3d3a5
@@ -17,7 +17,7 @@ from datetime import datetime
|
||||
from weasyprint import HTML
|
||||
|
||||
|
||||
def main(loc, colorscheme, output_filename):
|
||||
def main(loc, colorscheme):
|
||||
# Checking correctness of path
|
||||
if not os.path.isdir(loc):
|
||||
print("Invalid directory. Please try again!", file=sys.stderr)
|
||||
@@ -31,13 +31,11 @@ def main(loc, colorscheme, output_filename):
|
||||
# A string that stores all pages in HTML format
|
||||
html = (
|
||||
'<!doctype html><html><head><meta charset="utf-8"></head>'
|
||||
+ "<body><h1 class=title-main>tldr pages book</h1>"
|
||||
+ "<body><h1 class=title-main>tldr pages</h1>"
|
||||
+ "<div class=title-sub>Simplified and community-driven man pages</div>"
|
||||
+ "<div class=title-sub><em><small>Generated on "
|
||||
+ datetime.now().strftime("%c")
|
||||
+ "</small></em></div><br><br>"
|
||||
+ "<div class=title-sub>Website: <a href=https://tldr.sh>https://tldr.sh</a></div><br>"
|
||||
+ "<div class=title-sub>GitHub: <a href=https://github.com/tldr-pages/tldr>https://github.com/tldr-pages/tldr</a></div><br>"
|
||||
+ "</small></em></div>"
|
||||
+ '<p style="page-break-before: always" ></p>'
|
||||
)
|
||||
|
||||
@@ -71,10 +69,10 @@ def main(loc, colorscheme, output_filename):
|
||||
|
||||
# Writing the PDF to disk
|
||||
print("\nConverting all pages to PDF...")
|
||||
HTML(string=html).write_pdf(output_filename, stylesheets=csslist)
|
||||
HTML(string=html).write_pdf("tldr-pages.pdf", stylesheets=csslist)
|
||||
|
||||
if os.path.exists(output_filename):
|
||||
print(f"\nCreated {output_filename} in the current directory!\n")
|
||||
if os.path.exists("tldr-pages.pdf"):
|
||||
print("\nCreated tldr-pages.pdf in the current directory!\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
@@ -91,12 +89,6 @@ if __name__ == "__main__":
|
||||
default="basic",
|
||||
help="Color scheme of the PDF",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-o",
|
||||
"--output",
|
||||
default="tldr-book.pdf",
|
||||
help="Custom filename for the output PDF (default is 'tldr-pages.pdf')",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
main(args.dir_path, args.color, args.output)
|
||||
main(args.dir_path, args.color)
|
||||
|
Reference in New Issue
Block a user