aboutsummaryrefslogtreecommitdiff
path: root/gemini-to-web/src/gemini_to_web/__init__.py
diff options
context:
space:
mode:
authoralex <alex@pdp7.net>2026-02-14 21:23:16 +0100
committeralex <alex@pdp7.net>2026-02-14 21:23:16 +0100
commit7f5e2cdc0b81d46fd6255ebae8cf4f6c92c2030d (patch)
treecf5d3339fab9d48b2bb6aff1662202298658f03f /gemini-to-web/src/gemini_to_web/__init__.py
parent59af6b390f997b20b68452ded884f523dfdc0ec9 (diff)
Import initial gemini-to-web
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()),
+ {}
+ )
+ )
+ )