Compare commits
5 commits
e35bc3852b
...
b05610cae3
Author | SHA1 | Date | |
---|---|---|---|
b05610cae3 | |||
ae3ee28ab4 | |||
8a9ae16ad3 | |||
cc9206306a | |||
3e3de7ea59 |
5 changed files with 43 additions and 21 deletions
15
.woodpecker/containers.yaml
Normal file
15
.woodpecker/containers.yaml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
when:
|
||||||
|
- event: push
|
||||||
|
branch: main
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: publish
|
||||||
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
|
settings:
|
||||||
|
platforms: linux/amd64,linux/arm64/v8
|
||||||
|
repo: git.comfy.city/emi/comfy-recipes
|
||||||
|
registry: git.comfy.city
|
||||||
|
tags: latest
|
||||||
|
username: ${CI_REPO_OWNER}
|
||||||
|
password:
|
||||||
|
from_secret: registry_token
|
|
@ -8,4 +8,4 @@ FROM python:3.13-alpine
|
||||||
COPY --from=build /build/dist/ /mnt
|
COPY --from=build /build/dist/ /mnt
|
||||||
RUN pip install /mnt/comfy_recipes-*-py3-none-any.whl && \
|
RUN pip install /mnt/comfy_recipes-*-py3-none-any.whl && \
|
||||||
rm -r /mnt
|
rm -r /mnt
|
||||||
ENTRYPOINT ["/usr/bin/recipes-cli"]
|
ENTRYPOINT ["/usr/local/bin/recipes-cli"]
|
||||||
|
|
14
README.md
14
README.md
|
@ -4,7 +4,13 @@ Comfy Recipes is a simple application that renders your recipes into HTML.
|
||||||
|
|
||||||
Documentation is available at <https://comfy.city/comfy-recipes/docs>
|
Documentation is available at <https://comfy.city/comfy-recipes/docs>
|
||||||
|
|
||||||
## Building the python package
|
## Running
|
||||||
|
```sh
|
||||||
|
docker run -v ./recipes:/recipes git.comfy.city/Emi/comfy-recipes:latest build /recipes
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building
|
||||||
|
### Building the python package
|
||||||
Make sure you have hatchling and build modules installed.
|
Make sure you have hatchling and build modules installed.
|
||||||
```sh
|
```sh
|
||||||
python3 -m build
|
python3 -m build
|
||||||
|
@ -15,17 +21,17 @@ The package can now be installed with
|
||||||
pip install dist/comfy-recipes-*-py3-none-any.whl
|
pip install dist/comfy-recipes-*-py3-none-any.whl
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building the docker container
|
### Building the docker container
|
||||||
```sh
|
```sh
|
||||||
docker buildx build -t git.comfy.city/Emi/comfy-recipes:local .
|
docker buildx build -t git.comfy.city/Emi/comfy-recipes:local .
|
||||||
```
|
```
|
||||||
|
|
||||||
The container can now be ran
|
The container can now be ran
|
||||||
```sh
|
```sh
|
||||||
docker run --rm git.comfy.city/Emi/comfy-recipes:local
|
docker run -v ./recipes:/recipes git.comfy.city/Emi/comfy-recipes:local build /recipes
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building the documentation
|
### Building the documentation
|
||||||
```sh
|
```sh
|
||||||
cd docs
|
cd docs
|
||||||
mdbook build
|
mdbook build
|
||||||
|
|
|
@ -197,23 +197,24 @@ class IngredientInstance(Element):
|
||||||
def from_dict(cls, ctx: Context, dct: str | Dict[str, Any]) -> Self:
|
def from_dict(cls, ctx: Context, dct: str | Dict[str, Any]) -> Self:
|
||||||
if isinstance(dct, str):
|
if isinstance(dct, str):
|
||||||
string = dct.strip()
|
string = dct.strip()
|
||||||
p = re.compile(r"^(?:([0-9\.]+) ([a-zA-Z]+) )?([\w ]+)(?: \((.*)\))?$")
|
p = re.compile(r"^(?:([0-9\.]+) ([a-zA-Z]+) )+([\w ]+)(?: \((.*)\))?$")
|
||||||
match = p.match(string)
|
match = p.match(string)
|
||||||
if match is None:
|
|
||||||
raise RuntimeError(
|
amount = float(1)
|
||||||
"ingredient {string} regex not matched, it should be in the format [amount(num) unit(string, one word)] name(string, any number of words) [(note(string))]"
|
|
||||||
)
|
|
||||||
amount = float(match.group(1))
|
|
||||||
unitstr = match.group(2)
|
|
||||||
unit = ctx.default_unit
|
unit = ctx.default_unit
|
||||||
if unit is not None:
|
name = string
|
||||||
unitx = ctx.units.get(unitstr)
|
note = None
|
||||||
if unitx is None:
|
if match is not None:
|
||||||
ctx.issues.error(issues.ISSUE_UNKNOWN_UNIT, "unknown unit {unitstr}")
|
amount = float(match.group(1))
|
||||||
else:
|
unitstr = match.group(2)
|
||||||
unit = unitx
|
if unit is not None:
|
||||||
name = match.group(3)
|
unitx = ctx.units.get(unitstr)
|
||||||
note = match.group(4)
|
if unitx is None:
|
||||||
|
ctx.issues.error(issues.ISSUE_UNKNOWN_UNIT, f"unknown unit {unitstr}")
|
||||||
|
else:
|
||||||
|
unit = unitx
|
||||||
|
name = match.group(3)
|
||||||
|
note = match.group(4)
|
||||||
if note is None:
|
if note is None:
|
||||||
note = ""
|
note = ""
|
||||||
return cls(
|
return cls(
|
||||||
|
|
|
@ -9,7 +9,7 @@ description = "Smart recipe static site generator"
|
||||||
authors = [{ name = "Emi Vasilek", email = "emi.vasilek@gmail.com" }]
|
authors = [{ name = "Emi Vasilek", email = "emi.vasilek@gmail.com" }]
|
||||||
keywords = ["recipes", "recipe", "static site generator"]
|
keywords = ["recipes", "recipe", "static site generator"]
|
||||||
requires-python = ">= 3.8"
|
requires-python = ">= 3.8"
|
||||||
dependencies = ["jsonschema", "jinja2", "PyYAML", "mistune", "lxml"]
|
dependencies = ["jsonschema", "jinja2", "PyYAML", "mistune", "lxml", "lxml_html_clean"]
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Development Status :: 3 - Alpha",
|
"Development Status :: 3 - Alpha",
|
||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue