aboutsummaryrefslogtreecommitdiff
path: root/gemini-to-web/src/gemini_to_web/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'gemini-to-web/src/gemini_to_web/__init__.py')
-rw-r--r--gemini-to-web/src/gemini_to_web/__init__.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/gemini-to-web/src/gemini_to_web/__init__.py b/gemini-to-web/src/gemini_to_web/__init__.py
new file mode 100644
index 0000000..0b2b70e
--- /dev/null
+++ b/gemini-to-web/src/gemini_to_web/__init__.py
@@ -0,0 +1,25 @@
+import argparse
+import pathlib
+import shutil
+
+import htmlgenerator
+
+from gemini_to_web import html
+
+def converter():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("source", type=pathlib.Path)
+ parser.add_argument("target", type=pathlib.Path)
+ args = parser.parse_args()
+
+ shutil.copytree(args.source, args.target)
+ for gmi in args.target.glob("**/*.gmi"):
+ html_path = gmi.with_suffix(".html")
+ html_path.write_text(
+ html.pretty(
+ htmlgenerator.render(
+ html.to_html(gmi.read_text()),
+ {}
+ )
+ )
+ )