commit 7383b8f05bf9e26f51e0448b07ca2516d4b8253b Author: Erick Ruiz de Chavez Date: Sun Jan 12 08:45:48 2025 -0500 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d02dd57 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.venv +__pycache__ +build +*.egg-info +dist diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a7e20ad --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.13-alpine + +WORKDIR /opt/stargem +COPY . . +ENV PATH=$PATH:/root/.local/bin +RUN pip install pipx \ + && pipx install poetry \ + && poetry build \ + && pipx install dist/stargem*.whl +WORKDIR /capsule +ENTRYPOINT [ "stargem" ] diff --git a/README.md b/README.md new file mode 100644 index 0000000..8f967f1 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# 💎 Stargem: Static Capsule Generator diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..ed27e42 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,329 @@ +# This file is automatically @generated by Poetry 2.0.1 and should not be changed by hand. + +[[package]] +name = "click" +version = "8.1.8" +description = "Composable command line interface toolkit" +optional = false +python-versions = ">=3.7" +groups = ["main"] +files = [ + {file = "click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2"}, + {file = "click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +groups = ["main"] +markers = "platform_system == \"Windows\"" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "jinja2" +version = "3.1.5" +description = "A very fast and expressive template engine." +optional = false +python-versions = ">=3.7" +groups = ["main"] +files = [ + {file = "jinja2-3.1.5-py3-none-any.whl", hash = "sha256:aba0f4dc9ed8013c424088f68a5c226f7d6097ed89b246d7749c2ec4175c6adb"}, + {file = "jinja2-3.1.5.tar.gz", hash = "sha256:8fefff8dc3034e27bb80d67c671eb8a9bc424c0ef4c0826edbff304cceff43bb"}, +] + +[package.dependencies] +MarkupSafe = ">=2.0" + +[package.extras] +i18n = ["Babel (>=2.7)"] + +[[package]] +name = "markdown-it-py" +version = "3.0.0" +description = "Python port of markdown-it. Markdown parsing, done right!" +optional = false +python-versions = ">=3.8" +groups = ["main"] +files = [ + {file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"}, + {file = "markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"}, +] + +[package.dependencies] +mdurl = ">=0.1,<1.0" + +[package.extras] +benchmarking = ["psutil", "pytest", "pytest-benchmark"] +code-style = ["pre-commit (>=3.0,<4.0)"] +compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"] +linkify = ["linkify-it-py (>=1,<3)"] +plugins = ["mdit-py-plugins"] +profiling = ["gprof2dot"] +rtd = ["jupyter_sphinx", "mdit-py-plugins", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] +testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] + +[[package]] +name = "markupsafe" +version = "3.0.2" +description = "Safely add untrusted strings to HTML/XML markup." +optional = false +python-versions = ">=3.9" +groups = ["main"] +files = [ + {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9e2d922824181480953426608b81967de705c3cef4d1af983af849d7bd619158"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:38a9ef736c01fccdd6600705b09dc574584b89bea478200c5fbf112a6b0d5579"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bbcb445fa71794da8f178f0f6d66789a28d7319071af7a496d4d507ed566270d"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:57cb5a3cf367aeb1d316576250f65edec5bb3be939e9247ae594b4bcbc317dfb"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:3809ede931876f5b2ec92eef964286840ed3540dadf803dd570c3b7e13141a3b"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e07c3764494e3776c602c1e78e298937c3315ccc9043ead7e685b7f2b8d47b3c"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:b424c77b206d63d500bcb69fa55ed8d0e6a3774056bdc4839fc9298a7edca171"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-win32.whl", hash = "sha256:fcabf5ff6eea076f859677f5f0b6b5c1a51e70a376b0579e0eadef8db48c6b50"}, + {file = "MarkupSafe-3.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:6af100e168aa82a50e186c82875a5893c5597a0c1ccdb0d8b40240b1f28b969a"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:9025b4018f3a1314059769c7bf15441064b2207cb3f065e6ea1e7359cb46db9d"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:93335ca3812df2f366e80509ae119189886b0f3c2b81325d39efdb84a1e2ae93"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2cb8438c3cbb25e220c2ab33bb226559e7afb3baec11c4f218ffa7308603c832"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a123e330ef0853c6e822384873bef7507557d8e4a082961e1defa947aa59ba84"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1e084f686b92e5b83186b07e8a17fc09e38fff551f3602b249881fec658d3eca"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d8213e09c917a951de9d09ecee036d5c7d36cb6cb7dbaece4c71a60d79fb9798"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:5b02fb34468b6aaa40dfc198d813a641e3a63b98c2b05a16b9f80b7ec314185e"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-win32.whl", hash = "sha256:6c89876f41da747c8d3677a2b540fb32ef5715f97b66eeb0c6b66f5e3ef6f59d"}, + {file = "MarkupSafe-3.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:70a87b411535ccad5ef2f1df5136506a10775d267e197e4cf531ced10537bd6b"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:9778bd8ab0a994ebf6f84c2b949e65736d5575320a17ae8984a77fab08db94cf"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:846ade7b71e3536c4e56b386c2a47adf5741d2d8b94ec9dc3e92e5e1ee1e2225"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1c99d261bd2d5f6b59325c92c73df481e05e57f19837bdca8413b9eac4bd8028"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e17c96c14e19278594aa4841ec148115f9c7615a47382ecb6b82bd8fea3ab0c8"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:88416bd1e65dcea10bc7569faacb2c20ce071dd1f87539ca2ab364bf6231393c"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:2181e67807fc2fa785d0592dc2d6206c019b9502410671cc905d132a92866557"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:52305740fe773d09cffb16f8ed0427942901f00adedac82ec8b67752f58a1b22"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ad10d3ded218f1039f11a75f8091880239651b52e9bb592ca27de44eed242a48"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-win32.whl", hash = "sha256:0f4ca02bea9a23221c0182836703cbf8930c5e9454bacce27e767509fa286a30"}, + {file = "MarkupSafe-3.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:8e06879fc22a25ca47312fbe7c8264eb0b662f6db27cb2d3bbbc74b1df4b9b87"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ba9527cdd4c926ed0760bc301f6728ef34d841f405abf9d4f959c478421e4efd"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:569511d3b58c8791ab4c2e1285575265991e6d8f8700c7be0e88f86cb0672094"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15ab75ef81add55874e7ab7055e9c397312385bd9ced94920f2802310c930396"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f3818cb119498c0678015754eba762e0d61e5b52d34c8b13d770f0719f7b1d79"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:cdb82a876c47801bb54a690c5ae105a46b392ac6099881cdfb9f6e95e4014c6a"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:cabc348d87e913db6ab4aa100f01b08f481097838bdddf7c7a84b7575b7309ca"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:444dcda765c8a838eaae23112db52f1efaf750daddb2d9ca300bcae1039adc5c"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-win32.whl", hash = "sha256:bcf3e58998965654fdaff38e58584d8937aa3096ab5354d493c77d1fdd66d7a1"}, + {file = "MarkupSafe-3.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:e6a2a455bd412959b57a172ce6328d2dd1f01cb2135efda2e4576e8a23fa3b0f"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:b5a6b3ada725cea8a5e634536b1b01c30bcdcd7f9c6fff4151548d5bf6b3a36c"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:a904af0a6162c73e3edcb969eeeb53a63ceeb5d8cf642fade7d39e7963a22ddb"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4aa4e5faecf353ed117801a068ebab7b7e09ffb6e1d5e412dc852e0da018126c"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c0ef13eaeee5b615fb07c9a7dadb38eac06a0608b41570d8ade51c56539e509d"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d16a81a06776313e817c951135cf7340a3e91e8c1ff2fac444cfd75fffa04afe"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:6381026f158fdb7c72a168278597a5e3a5222e83ea18f543112b2662a9b699c5"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:3d79d162e7be8f996986c064d1c7c817f6df3a77fe3d6859f6f9e7be4b8c213a"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:131a3c7689c85f5ad20f9f6fb1b866f402c445b220c19fe4308c0b147ccd2ad9"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-win32.whl", hash = "sha256:ba8062ed2cf21c07a9e295d5b8a2a5ce678b913b45fdf68c32d95d6c1291e0b6"}, + {file = "MarkupSafe-3.0.2-cp313-cp313t-win_amd64.whl", hash = "sha256:e444a31f8db13eb18ada366ab3cf45fd4b31e4db1236a4448f68778c1d1a5a2f"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:eaa0a10b7f72326f1372a713e73c3f739b524b3af41feb43e4921cb529f5929a"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:48032821bbdf20f5799ff537c7ac3d1fba0ba032cfc06194faffa8cda8b560ff"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1a9d3f5f0901fdec14d8d2f66ef7d035f2157240a433441719ac9a3fba440b13"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:88b49a3b9ff31e19998750c38e030fc7bb937398b1f78cfa599aaef92d693144"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cfad01eed2c2e0c01fd0ecd2ef42c492f7f93902e39a42fc9ee1692961443a29"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:1225beacc926f536dc82e45f8a4d68502949dc67eea90eab715dea3a21c1b5f0"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:3169b1eefae027567d1ce6ee7cae382c57fe26e82775f460f0b2778beaad66c0"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:eb7972a85c54febfb25b5c4b4f3af4dcc731994c7da0d8a0b4a6eb0640e1d178"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-win32.whl", hash = "sha256:8c4e8c3ce11e1f92f6536ff07154f9d49677ebaaafc32db9db4620bc11ed480f"}, + {file = "MarkupSafe-3.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:6e296a513ca3d94054c2c881cc913116e90fd030ad1c656b3869762b754f5f8a"}, + {file = "markupsafe-3.0.2.tar.gz", hash = "sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0"}, +] + +[[package]] +name = "mdurl" +version = "0.1.2" +description = "Markdown URL utilities" +optional = false +python-versions = ">=3.7" +groups = ["main"] +files = [ + {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, + {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, +] + +[[package]] +name = "pygments" +version = "2.19.1" +description = "Pygments is a syntax highlighting package written in Python." +optional = false +python-versions = ">=3.8" +groups = ["main"] +files = [ + {file = "pygments-2.19.1-py3-none-any.whl", hash = "sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c"}, + {file = "pygments-2.19.1.tar.gz", hash = "sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f"}, +] + +[package.extras] +windows-terminal = ["colorama (>=0.4.6)"] + +[[package]] +name = "python-slugify" +version = "8.0.4" +description = "A Python slugify application that also handles Unicode" +optional = false +python-versions = ">=3.7" +groups = ["main"] +files = [ + {file = "python-slugify-8.0.4.tar.gz", hash = "sha256:59202371d1d05b54a9e7720c5e038f928f45daaffe41dd10822f3907b937c856"}, + {file = "python_slugify-8.0.4-py2.py3-none-any.whl", hash = "sha256:276540b79961052b66b7d116620b36518847f52d5fd9e3a70164fc8c50faa6b8"}, +] + +[package.dependencies] +text-unidecode = ">=1.3" + +[package.extras] +unidecode = ["Unidecode (>=1.1.1)"] + +[[package]] +name = "pyyaml" +version = "6.0.2" +description = "YAML parser and emitter for Python" +optional = false +python-versions = ">=3.8" +groups = ["main"] +files = [ + {file = "PyYAML-6.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0a9a2848a5b7feac301353437eb7d5957887edbf81d56e903999a75a3d743086"}, + {file = "PyYAML-6.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:29717114e51c84ddfba879543fb232a6ed60086602313ca38cce623c1d62cfbf"}, + {file = "PyYAML-6.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8824b5a04a04a047e72eea5cec3bc266db09e35de6bdfe34c9436ac5ee27d237"}, + {file = "PyYAML-6.0.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7c36280e6fb8385e520936c3cb3b8042851904eba0e58d277dca80a5cfed590b"}, + {file = "PyYAML-6.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ec031d5d2feb36d1d1a24380e4db6d43695f3748343d99434e6f5f9156aaa2ed"}, + {file = "PyYAML-6.0.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:936d68689298c36b53b29f23c6dbb74de12b4ac12ca6cfe0e047bedceea56180"}, + {file = "PyYAML-6.0.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:23502f431948090f597378482b4812b0caae32c22213aecf3b55325e049a6c68"}, + {file = "PyYAML-6.0.2-cp310-cp310-win32.whl", hash = "sha256:2e99c6826ffa974fe6e27cdb5ed0021786b03fc98e5ee3c5bfe1fd5015f42b99"}, + {file = "PyYAML-6.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:a4d3091415f010369ae4ed1fc6b79def9416358877534caf6a0fdd2146c87a3e"}, + {file = "PyYAML-6.0.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cc1c1159b3d456576af7a3e4d1ba7e6924cb39de8f67111c735f6fc832082774"}, + {file = "PyYAML-6.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1e2120ef853f59c7419231f3bf4e7021f1b936f6ebd222406c3b60212205d2ee"}, + {file = "PyYAML-6.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5d225db5a45f21e78dd9358e58a98702a0302f2659a3c6cd320564b75b86f47c"}, + {file = "PyYAML-6.0.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5ac9328ec4831237bec75defaf839f7d4564be1e6b25ac710bd1a96321cc8317"}, + {file = "PyYAML-6.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3ad2a3decf9aaba3d29c8f537ac4b243e36bef957511b4766cb0057d32b0be85"}, + {file = "PyYAML-6.0.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:ff3824dc5261f50c9b0dfb3be22b4567a6f938ccce4587b38952d85fd9e9afe4"}, + {file = "PyYAML-6.0.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:797b4f722ffa07cc8d62053e4cff1486fa6dc094105d13fea7b1de7d8bf71c9e"}, + {file = "PyYAML-6.0.2-cp311-cp311-win32.whl", hash = "sha256:11d8f3dd2b9c1207dcaf2ee0bbbfd5991f571186ec9cc78427ba5bd32afae4b5"}, + {file = "PyYAML-6.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:e10ce637b18caea04431ce14fabcf5c64a1c61ec9c56b071a4b7ca131ca52d44"}, + {file = "PyYAML-6.0.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:c70c95198c015b85feafc136515252a261a84561b7b1d51e3384e0655ddf25ab"}, + {file = "PyYAML-6.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ce826d6ef20b1bc864f0a68340c8b3287705cae2f8b4b1d932177dcc76721725"}, + {file = "PyYAML-6.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f71ea527786de97d1a0cc0eacd1defc0985dcf6b3f17bb77dcfc8c34bec4dc5"}, + {file = "PyYAML-6.0.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9b22676e8097e9e22e36d6b7bda33190d0d400f345f23d4065d48f4ca7ae0425"}, + {file = "PyYAML-6.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:80bab7bfc629882493af4aa31a4cfa43a4c57c83813253626916b8c7ada83476"}, + {file = "PyYAML-6.0.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:0833f8694549e586547b576dcfaba4a6b55b9e96098b36cdc7ebefe667dfed48"}, + {file = "PyYAML-6.0.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8b9c7197f7cb2738065c481a0461e50ad02f18c78cd75775628afb4d7137fb3b"}, + {file = "PyYAML-6.0.2-cp312-cp312-win32.whl", hash = "sha256:ef6107725bd54b262d6dedcc2af448a266975032bc85ef0172c5f059da6325b4"}, + {file = "PyYAML-6.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:7e7401d0de89a9a855c839bc697c079a4af81cf878373abd7dc625847d25cbd8"}, + {file = "PyYAML-6.0.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:efdca5630322a10774e8e98e1af481aad470dd62c3170801852d752aa7a783ba"}, + {file = "PyYAML-6.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:50187695423ffe49e2deacb8cd10510bc361faac997de9efef88badc3bb9e2d1"}, + {file = "PyYAML-6.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0ffe8360bab4910ef1b9e87fb812d8bc0a308b0d0eef8c8f44e0254ab3b07133"}, + {file = "PyYAML-6.0.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:17e311b6c678207928d649faa7cb0d7b4c26a0ba73d41e99c4fff6b6c3276484"}, + {file = "PyYAML-6.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70b189594dbe54f75ab3a1acec5f1e3faa7e8cf2f1e08d9b561cb41b845f69d5"}, + {file = "PyYAML-6.0.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:41e4e3953a79407c794916fa277a82531dd93aad34e29c2a514c2c0c5fe971cc"}, + {file = "PyYAML-6.0.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:68ccc6023a3400877818152ad9a1033e3db8625d899c72eacb5a668902e4d652"}, + {file = "PyYAML-6.0.2-cp313-cp313-win32.whl", hash = "sha256:bc2fa7c6b47d6bc618dd7fb02ef6fdedb1090ec036abab80d4681424b84c1183"}, + {file = "PyYAML-6.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:8388ee1976c416731879ac16da0aff3f63b286ffdd57cdeb95f3f2e085687563"}, + {file = "PyYAML-6.0.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:24471b829b3bf607e04e88d79542a9d48bb037c2267d7927a874e6c205ca7e9a"}, + {file = "PyYAML-6.0.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d7fded462629cfa4b685c5416b949ebad6cec74af5e2d42905d41e257e0869f5"}, + {file = "PyYAML-6.0.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d84a1718ee396f54f3a086ea0a66d8e552b2ab2017ef8b420e92edbc841c352d"}, + {file = "PyYAML-6.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9056c1ecd25795207ad294bcf39f2db3d845767be0ea6e6a34d856f006006083"}, + {file = "PyYAML-6.0.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:82d09873e40955485746739bcb8b4586983670466c23382c19cffecbf1fd8706"}, + {file = "PyYAML-6.0.2-cp38-cp38-win32.whl", hash = "sha256:43fa96a3ca0d6b1812e01ced1044a003533c47f6ee8aca31724f78e93ccc089a"}, + {file = "PyYAML-6.0.2-cp38-cp38-win_amd64.whl", hash = "sha256:01179a4a8559ab5de078078f37e5c1a30d76bb88519906844fd7bdea1b7729ff"}, + {file = "PyYAML-6.0.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:688ba32a1cffef67fd2e9398a2efebaea461578b0923624778664cc1c914db5d"}, + {file = "PyYAML-6.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a8786accb172bd8afb8be14490a16625cbc387036876ab6ba70912730faf8e1f"}, + {file = "PyYAML-6.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d8e03406cac8513435335dbab54c0d385e4a49e4945d2909a581c83647ca0290"}, + {file = "PyYAML-6.0.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f753120cb8181e736c57ef7636e83f31b9c0d1722c516f7e86cf15b7aa57ff12"}, + {file = "PyYAML-6.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3b1fdb9dc17f5a7677423d508ab4f243a726dea51fa5e70992e59a7411c89d19"}, + {file = "PyYAML-6.0.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:0b69e4ce7a131fe56b7e4d770c67429700908fc0752af059838b1cfb41960e4e"}, + {file = "PyYAML-6.0.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a9f8c2e67970f13b16084e04f134610fd1d374bf477b17ec1599185cf611d725"}, + {file = "PyYAML-6.0.2-cp39-cp39-win32.whl", hash = "sha256:6395c297d42274772abc367baaa79683958044e5d3835486c16da75d2a694631"}, + {file = "PyYAML-6.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:39693e1f8320ae4f43943590b49779ffb98acb81f788220ea932a6b6c51004d8"}, + {file = "pyyaml-6.0.2.tar.gz", hash = "sha256:d584d9ec91ad65861cc08d42e834324ef890a082e591037abe114850ff7bbc3e"}, +] + +[[package]] +name = "rich" +version = "13.9.4" +description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" +optional = false +python-versions = ">=3.8.0" +groups = ["main"] +files = [ + {file = "rich-13.9.4-py3-none-any.whl", hash = "sha256:6049d5e6ec054bf2779ab3358186963bac2ea89175919d699e378b99738c2a90"}, + {file = "rich-13.9.4.tar.gz", hash = "sha256:439594978a49a09530cff7ebc4b5c7103ef57baf48d5ea3184f21d9a2befa098"}, +] + +[package.dependencies] +markdown-it-py = ">=2.2.0" +pygments = ">=2.13.0,<3.0.0" + +[package.extras] +jupyter = ["ipywidgets (>=7.5.1,<9)"] + +[[package]] +name = "shellingham" +version = "1.5.4" +description = "Tool to Detect Surrounding Shell" +optional = false +python-versions = ">=3.7" +groups = ["main"] +files = [ + {file = "shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686"}, + {file = "shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de"}, +] + +[[package]] +name = "text-unidecode" +version = "1.3" +description = "The most basic Text::Unidecode port" +optional = false +python-versions = "*" +groups = ["main"] +files = [ + {file = "text-unidecode-1.3.tar.gz", hash = "sha256:bad6603bb14d279193107714b288be206cac565dfa49aa5b105294dd5c4aab93"}, + {file = "text_unidecode-1.3-py2.py3-none-any.whl", hash = "sha256:1311f10e8b895935241623731c2ba64f4c455287888b18189350b67134a822e8"}, +] + +[[package]] +name = "typer" +version = "0.15.1" +description = "Typer, build great CLIs. Easy to code. Based on Python type hints." +optional = false +python-versions = ">=3.7" +groups = ["main"] +files = [ + {file = "typer-0.15.1-py3-none-any.whl", hash = "sha256:7994fb7b8155b64d3402518560648446072864beefd44aa2dc36972a5972e847"}, + {file = "typer-0.15.1.tar.gz", hash = "sha256:a0588c0a7fa68a1978a069818657778f86abe6ff5ea6abf472f940a08bfe4f0a"}, +] + +[package.dependencies] +click = ">=8.0.0" +rich = ">=10.11.0" +shellingham = ">=1.3.0" +typing-extensions = ">=3.7.4.3" + +[[package]] +name = "typing-extensions" +version = "4.12.2" +description = "Backported and Experimental Type Hints for Python 3.8+" +optional = false +python-versions = ">=3.8" +groups = ["main"] +files = [ + {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, + {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, +] + +[metadata] +lock-version = "2.1" +python-versions = ">=3.12" +content-hash = "8c51ac6af3caa33c4c9dae3bb8d7361d946599195401f4f00b6b976f7d595b09" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..87853cf --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[project] +name = "stargem" +version = "1.0.0" +description = "" +authors = [ + {name = "Erick Ruiz de Chavez",email = "erick@fastmail.net"} +] +readme = "README.md" +requires-python = ">=3.12" +dependencies = [ + "jinja2 (>=3.1.5,<4.0.0)", + "python-slugify (>=8.0.4,<9.0.0)", + "pyyaml (>=6.0.2,<7.0.0)", + "typer (>=0.15.1,<0.16.0)" +] + +[project.scripts] +stargem = "stargem.main:app" + +[build-system] +requires = ["poetry-core>=2.0.0,<3.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/stargem/__init__.py b/stargem/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/stargem/__main__.py b/stargem/__main__.py new file mode 100644 index 0000000..3653282 --- /dev/null +++ b/stargem/__main__.py @@ -0,0 +1,4 @@ +if __name__ == "__main__": + from stargem.main import app + + app() diff --git a/stargem/commands/__init__.py b/stargem/commands/__init__.py new file mode 100644 index 0000000..15b053c --- /dev/null +++ b/stargem/commands/__init__.py @@ -0,0 +1,15 @@ +import typer + +from .build import app as build_app +from .draft import app as draft_app +from .new import app as new_app +from .publish import app as publish_app +from .unpublish import app as unpublish_app + +app = typer.Typer() + +app.add_typer(new_app) +app.add_typer(draft_app) +app.add_typer(publish_app) +app.add_typer(unpublish_app) +app.add_typer(build_app) diff --git a/stargem/commands/build.py b/stargem/commands/build.py new file mode 100644 index 0000000..1f22b39 --- /dev/null +++ b/stargem/commands/build.py @@ -0,0 +1,56 @@ +import glob +from datetime import datetime +from os import makedirs +from os.path import dirname, join +from shutil import copytree, rmtree + +import typer +from jinja2 import Environment, FileSystemLoader +from typing_extensions import Annotated + +from . import utils + +app = typer.Typer() + + +def load(path: str, template: str = "post"): + item = utils.load(path) + item.frontmatter["template"] = ( + item.frontmatter.get("template", template) + ) + ".jinja" + return item + + +@app.command(help="Build your site.") +def build(with_drafts: Annotated[bool, typer.Option(help="Include drafts.")] = False): + env = Environment(loader=FileSystemLoader("templates")) + + rmtree("dist", ignore_errors=True) + copytree("static", "dist", dirs_exist_ok=True) + + pages = [load(page, "page") for page in glob.glob("*.gmi")] + posts = [load(post, "post") for post in glob.glob(join("posts", "*.gmi"))] + drafts = [] + + all_items = pages + posts + + if with_drafts: + drafts = [load(draft, "post") for draft in glob.glob(join("drafts", "*.gmi"))] + all_items += drafts + + template_globals = { + "now": datetime.now(), + "stargem": { + "pages": pages, + "posts": posts, + "drafts": drafts, + }, + } + + for item in all_items: + template = env.get_template( + item.frontmatter.get("template"), globals=template_globals + ) + + makedirs(join("dist", dirname(item.path)), exist_ok=True) + template.stream(**item.__dict__).dump(join("dist", item.path), encoding="utf-8") diff --git a/stargem/commands/draft.py b/stargem/commands/draft.py new file mode 100644 index 0000000..b60cf56 --- /dev/null +++ b/stargem/commands/draft.py @@ -0,0 +1,37 @@ +from os.path import exists, join + +import typer +from slugify import slugify +from typing_extensions import Annotated + +from . import utils + +app = typer.Typer() + + +@app.command(help="Create a draft.") +def draft( + title: Annotated[str | None, typer.Argument(help="Draft Title")] = None, + template: Annotated[str | None, typer.Argument(help="Custom Template")] = None, +): + if title is None: + title = typer.prompt("Enter draft's title") + + slug = slugify(title) + file_name = join("drafts", f"{slug}.gmi") + + if exists(file_name): + typer.confirm( + f"File {file_name} already exists. Are you sure you want to overwrite it?", + abort=True, + ) + + fm = utils.loads("---\n---\n") + fm.frontmatter["title"] = title + if template: + fm.frontmatter["template"] = template + + with open(file_name, mode="w", encoding="utf8") as file: + file.write(utils.dumps(fm)) + + print(f"\nNew draft created at {file_name}") diff --git a/stargem/commands/new.py b/stargem/commands/new.py new file mode 100644 index 0000000..978ad1c --- /dev/null +++ b/stargem/commands/new.py @@ -0,0 +1,34 @@ +from os.path import dirname, join, realpath +from pathlib import Path +from shutil import copytree + +import typer +from typing_extensions import Annotated + +app = typer.Typer() + + +@app.command(help="Initialize a new 💎 Stargem project.") +def new( + path: Annotated[ + Path, + typer.Argument( + file_okay=False, + dir_okay=True, + writable=True, + readable=True, + resolve_path=True, + ), + ] +): + if path.exists(): + typer.confirm( + "Directory already exists. Content might be overwritten! Are you sure you want to continue?", + abort=True, + ) + else: + path.mkdir() + + stargem_path = realpath(join(dirname(__file__), "..")) + + copytree(join(stargem_path, "templates"), path, dirs_exist_ok=True) diff --git a/stargem/commands/publish.py b/stargem/commands/publish.py new file mode 100644 index 0000000..79ac477 --- /dev/null +++ b/stargem/commands/publish.py @@ -0,0 +1,65 @@ +from datetime import UTC, datetime +from os import remove +from os.path import exists, join, split +from pathlib import Path + +import typer +from typing_extensions import Annotated + +from . import utils + +app = typer.Typer() + + +@app.command(help="Publish a draft.") +def publish( + draft: Annotated[ + Path | None, + typer.Argument( + exists=True, + file_okay=True, + dir_okay=False, + readable=True, + resolve_path=True, + ), + ] = None +): + if draft is None: + draft = utils.file_chooser( + file_label="drafts", + glob_pattern=join("drafts", "*.gmi"), + ) + + now = datetime.now(UTC) + file_date = now.strftime("%F") + frontmatter_date = now.strftime("%F %H:%m %z") + + fm = utils.load(draft) + fm.frontmatter["date"] = frontmatter_date + + draft_name = split(draft)[1] + file_name = join("posts", f"{file_date}-{draft_name}") + + if exists(file_name): + typer.confirm( + f"Loos like a post named {file_name} already exists. Are you sure you want to overwrite it?", + abort=True, + ) + + with open( + file_name, + mode="w", + encoding="utf8", + ) as file: + file.write(utils.dumps(fm)) + + print(f"\nPost published at {file_name}") + + try: + remove(draft) + except PermissionError: + print(f"Unable to delete '{draft}'.") + raise typer.Exit(code=1) + except Exception as e: + print(f"An error occurred: {e}") + raise typer.Exit(code=1) diff --git a/stargem/commands/unpublish.py b/stargem/commands/unpublish.py new file mode 100644 index 0000000..6e3de50 --- /dev/null +++ b/stargem/commands/unpublish.py @@ -0,0 +1,65 @@ +from datetime import datetime +from os import remove +from os.path import exists, join, split +from pathlib import Path + +import typer +from typing_extensions import Annotated + +from . import utils + +app = typer.Typer() + + +@app.command(help="Unublish a post.") +def unpublish( + post: Annotated[ + Path | None, + typer.Argument( + exists=True, + file_okay=True, + dir_okay=False, + readable=True, + resolve_path=True, + ), + ] = None +): + if post is None: + post = utils.file_chooser( + file_label="posts", + glob_pattern=join("posts", "*.gmi"), + reverse=True, + ) + + fm = utils.load(post) + file_date = fm.frontmatter["date"].strftime("%Y-%m-%d") + del fm.frontmatter["date"] + + post_name = split(post)[1] + post_name = post_name.replace(f"{file_date}-", "") + + file_name = join("drafts", post_name) + + if exists(file_name): + typer.confirm( + f"Loos like a draft named {file_name} already exists. Are you sure you want to overwrite it?", + abort=True, + ) + + with open( + file_name, + mode="w", + encoding="utf8", + ) as file: + file.write(utils.dumps(fm)) + + print(f"\nPost reverted to draft at {file_name}") + + try: + remove(post) + except PermissionError: + print(f"Unable to delete '{post}'.") + raise typer.Exit(code=1) + except Exception as e: + print(f"An error occurred: {e}") + raise typer.Exit(code=1) diff --git a/stargem/commands/utils.py b/stargem/commands/utils.py new file mode 100644 index 0000000..ab6a0d5 --- /dev/null +++ b/stargem/commands/utils.py @@ -0,0 +1,105 @@ +import glob +from dataclasses import dataclass, field +from datetime import datetime + +import typer +import yaml + + +@dataclass +class Post: + frontmatter: dict = field(default_factory=dict) + content: str = "" + path: str = "" + template: str = "" + + +def load(file_name) -> Post: + content = "" + with open(file=file_name, mode="r", encoding="utf8") as file: + content = file.read() + + post = loads(content) + post.path = file_name + + return post + + +def loads(content: str) -> Post: + lines = content.splitlines() + + start = -1 + end = -1 + + for index, line in enumerate(lines): + if line.startswith("---"): + if start == -1: + start = index + elif end == -1: + end = index + break + + if start == -1 or end == -1: + frontmatter = "" + else: + frontmatter = lines[start + 1 : end] + + content = lines[end + 1 :] + + frontmatter = yaml.safe_load("\n".join(frontmatter)) + if not frontmatter: + frontmatter = {} + + if "date" in frontmatter: + frontmatter["date"] = datetime.fromisoformat(frontmatter["date"]) + + return Post( + frontmatter=frontmatter, + content="\n".join(content), + ) + + +def dumps(article: Post) -> str: + return f"---\n{yaml.dump(article.frontmatter)}---\n{article.content}" + + +def file_chooser( + file_label: str = "file", + glob_pattern: str = "*", + reverse: bool = False, +) -> str: + files = glob.glob(glob_pattern) + files.sort(reverse=reverse) + titles = [] + + if len(files) == 0: + print(f"No {file_label} found.") + raise typer.Exit(code=1) + + for file in files: + fm = load(file) + titles.append(fm.frontmatter["title"]) + + print(f"\nAvailable {file_label}:\n") + + for index, title in enumerate(titles): + print(f"\t[{index + 1}] {title}") + + print("") + + selection = "" + index = -1 + + while index < 0 or index > len(files): + try: + index = int(selection) - 1 + + if index == -1: + raise typer.Exit() + + file = files[index] + + except (ValueError, IndexError): + selection = typer.prompt("Enter a number (0 to exit)") + + return file diff --git a/stargem/main.py b/stargem/main.py new file mode 100755 index 0000000..83d7124 --- /dev/null +++ b/stargem/main.py @@ -0,0 +1,14 @@ +import typer + +from .commands import app as commands + +app = typer.Typer( + no_args_is_help=True, + name="stargem", + rich_markup_mode=None, +) + +app.add_typer(commands) + +if __name__ == "__main__": + app() diff --git a/stargem/templates/.gitignore b/stargem/templates/.gitignore new file mode 100644 index 0000000..1521c8b --- /dev/null +++ b/stargem/templates/.gitignore @@ -0,0 +1 @@ +dist diff --git a/stargem/templates/drafts/.gitkeep b/stargem/templates/drafts/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/stargem/templates/drafts/this-is-a-draft.gmi b/stargem/templates/drafts/this-is-a-draft.gmi new file mode 100644 index 0000000..25c4cbc --- /dev/null +++ b/stargem/templates/drafts/this-is-a-draft.gmi @@ -0,0 +1,8 @@ +--- +title: This is a draft +--- +This is a draft post. It will not be included on your site unless you explicitly ask for them when running the build command. + +``` +$ stargem build --with-drafts +``` diff --git a/stargem/templates/gemlog.gmi b/stargem/templates/gemlog.gmi new file mode 100644 index 0000000..6e59b6a --- /dev/null +++ b/stargem/templates/gemlog.gmi @@ -0,0 +1,3 @@ +--- +template: gemlog +--- diff --git a/stargem/templates/index.gmi b/stargem/templates/index.gmi new file mode 100644 index 0000000..623700a --- /dev/null +++ b/stargem/templates/index.gmi @@ -0,0 +1,10 @@ +--- +template: home +--- +Welcome 👋 and thank you for using 💎 Stargem! + +Don't forget to see the help to learn more! + +``` +$ stargem --help +``` diff --git a/stargem/templates/posts/.gitkeep b/stargem/templates/posts/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/stargem/templates/posts/2025-01-01-its-me.gmi b/stargem/templates/posts/2025-01-01-its-me.gmi new file mode 100644 index 0000000..32d841f --- /dev/null +++ b/stargem/templates/posts/2025-01-01-its-me.gmi @@ -0,0 +1,72 @@ +--- +title: Intro to Stargem Static Capsule Generator +date: 2025-01-01 00:00 +0000 +--- +Here are some of the 💎 Stargem commands you might want to use: + +To create a post draft: + +``` +$ stargem draft +Enter draft's title: This is my new post! + +New draft createt at drafts/this-is-my-new-post.gmi +``` + +Or if you prefer one-liners: + +``` +$ stargem draft "This is my new post" + +New draft createt at drafts/this-is-my-new-post.gmi +``` + +When you are ready to publish your draft, you can do: + +``` +$ stargem publish + +Available drafts: + + [1] This is my new post + +Enter a number (0 to exit): 1 + +Post published at posts/2025-01-12-this-is-my-new-post.gmi +``` + +And again, if you prefer a one-liner: + +``` +$ stargem publish drafts/this-is-my-new-post.gmi + +Post published at posts/2025-01-12-this-is-my-new-post.gmi +``` + +Made a mistake? Changed your mind about that published post? No worries, just unpublish it! + +``` +$ stargem unpublish + +Available posts: + + [1] This is my new post + +Enter a number (0 to exit): 1 + +Post reverted to draft at drafts/this-is-my-new-post.gmi +``` + +Or, as usual, with a one-liner: + +``` +$ stargem unpublish posts/2025-01-12-this-is-my-new-post.gmi + +Post reverted to draft at drafts/this-is-my-new-post.gmi +``` + +Finally, when you are ready to generate your site you just need to do: + +``` +$ stargem build +``` diff --git a/stargem/templates/static/.gitkeep b/stargem/templates/static/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/stargem/templates/templates/footer.jinja b/stargem/templates/templates/footer.jinja new file mode 100644 index 0000000..37c4d18 --- /dev/null +++ b/stargem/templates/templates/footer.jinja @@ -0,0 +1,3 @@ +## Links +=> gemini://geminiprotocol.net/ Project Gemini +=> https://code.palmiers.xyz/erick/stargem 💎 Stargem: Static Capsule Generator diff --git a/stargem/templates/templates/gemlog.jinja b/stargem/templates/templates/gemlog.jinja new file mode 100644 index 0000000..c4d59b1 --- /dev/null +++ b/stargem/templates/templates/gemlog.jinja @@ -0,0 +1,18 @@ +{% include "header.jinja" %} +{{ content }} + +{% if stargem.posts -%} +## Posts +{% for post in stargem.posts -%} +=> {{ post.path }} {{ post.frontmatter.date.strftime('%F') }} {{ post.frontmatter.title }} +{% endfor -%} +{% endif -%} + +{% if stargem.drafts %} +## Drafts +{% for draft in stargem.drafts -%} +=> {{ draft.path }} {{ draft.frontmatter.title }} +{% endfor -%} +{% endif %} + +{% include "footer.jinja" %} diff --git a/stargem/templates/templates/header.jinja b/stargem/templates/templates/header.jinja new file mode 100644 index 0000000..67a7c6d --- /dev/null +++ b/stargem/templates/templates/header.jinja @@ -0,0 +1 @@ +# My Gemini Capsule diff --git a/stargem/templates/templates/home.jinja b/stargem/templates/templates/home.jinja new file mode 100644 index 0000000..80d3db9 --- /dev/null +++ b/stargem/templates/templates/home.jinja @@ -0,0 +1,21 @@ +{% include "header.jinja" %} +{{ content }} + +{% if stargem.posts -%} +## Latests Posts +{% for post in stargem.posts[:5] -%} +=> {{ post.path }} {{ post.frontmatter.date.strftime('%F') }} {{ post.frontmatter.title }} +{% endfor %} +{%- if stargem.posts | length > 5 %} +=> gemlog.gmi See All Posts +{% endif -%} +{% endif -%} + +{% if stargem.drafts %} +## Drafts +{% for draft in stargem.drafts -%} +=> {{ draft.path }} {{ draft.frontmatter.title }} +{% endfor -%} +{% endif %} + +{% include "footer.jinja" %} diff --git a/stargem/templates/templates/page.jinja b/stargem/templates/templates/page.jinja new file mode 100644 index 0000000..1532434 --- /dev/null +++ b/stargem/templates/templates/page.jinja @@ -0,0 +1,8 @@ +{% include "header.jinja" %} +## {{ frontmatter.title }} + +=> / Front page + +{{ content }} + +{% include "footer.jinja" %} diff --git a/stargem/templates/templates/post.jinja b/stargem/templates/templates/post.jinja new file mode 100644 index 0000000..693df80 --- /dev/null +++ b/stargem/templates/templates/post.jinja @@ -0,0 +1,10 @@ +{% include "header.jinja" %} +## {{ frontmatter.title }} + +=> / Front page + +> Published: {% if frontmatter.date %}{{ frontmatter.date.strftime('%F') }}{%else%}TBD{% endif %} + +{{ content }} + +{% include "footer.jinja" %}