diff --git a/autogen.sh b/autogen.sh index 6af32ce4..804354f2 100755 --- a/autogen.sh +++ b/autogen.sh @@ -4,7 +4,7 @@ set -e app_root_dir="diagrams" # NOTE: azure icon set is not latest version -providers=("onprem" "aws" "azure" "gcp" "firebase" "k8s" "alibabacloud" "oci" "programming" "saas" "elastic" "generic" "openstack" "outscale") +providers=("onprem" "aws" "azure" "gcp" "firebase" "k8s" "alibabacloud" "oci" "programming" "saas" "elastic" "generic" "openstack" "outscale" "custom" ) if ! [ -x "$(command -v round)" ]; then echo 'round is not installed' diff --git a/config.py b/config.py index 12fec10c..bebe10ca 100644 --- a/config.py +++ b/config.py @@ -13,7 +13,7 @@ DIR_TEMPLATE = "templates" PROVIDERS = ( "base", "onprem", "aws", "azure", "gcp", "firebase", "k8s", "alibabacloud", "oci", "programming", "saas", "elastic", - "generic", "openstack", "outscale") + "generic", "openstack", "outscale", "custom") ######################### # Resource Processing # diff --git a/diagrams/saas/chat.py b/diagrams/saas/chat.py index 2eb52540..e48587ab 100644 --- a/diagrams/saas/chat.py +++ b/diagrams/saas/chat.py @@ -8,7 +8,6 @@ class _Chat(_Saas): _icon_dir = "resources/saas/chat" - class Discord(_Chat): _icon = "discord.png" diff --git a/docs/nodes/custom.md b/docs/nodes/custom.md new file mode 100644 index 00000000..be0e3169 --- /dev/null +++ b/docs/nodes/custom.md @@ -0,0 +1,6 @@ +--- +id: custom +title: Custom +--- + +For a full example check: https://diagrams.mingrammer.com/docs/getting-started/examples#rabbitmq-consumers-with-custom-nodes \ No newline at end of file diff --git a/scripts/generate.py b/scripts/generate.py index f1568d24..d757b9cf 100644 --- a/scripts/generate.py +++ b/scripts/generate.py @@ -2,7 +2,7 @@ import os import sys from typing import Iterable -from jinja2 import Environment, FileSystemLoader, Template +from jinja2 import Environment, FileSystemLoader, Template, exceptions import config as cfg from . import app_root_dir, doc_root_dir, resource_dir, template_dir @@ -41,7 +41,12 @@ def gen_classes(pvd: str, typ: str, paths: Iterable[str]) -> str: def gen_apidoc(pvd: str, typ_paths: dict) -> str: - tmpl = load_tmpl(cfg.TMPL_APIDOC) + try: + default_tmp = cfg.TMPL_APIDOC.split('.') + tmpl_file = f"{default_tmp[0]}_{pvd}.{default_tmp[1]}" + tmpl = load_tmpl(tmpl_file) + except exceptions.TemplateNotFound: + tmpl = load_tmpl(cfg.TMPL_APIDOC) # TODO: remove def _gen_class_name(path: str) -> str: diff --git a/templates/apidoc_custom.tmpl b/templates/apidoc_custom.tmpl new file mode 100644 index 00000000..af42dcc2 --- /dev/null +++ b/templates/apidoc_custom.tmpl @@ -0,0 +1,6 @@ +--- +id: {{ pvd }} +title: {{ pvd|up_or_title(pvd) }} +--- + +For a full example check: https://diagrams.mingrammer.com/docs/getting-started/examples#rabbitmq-consumers-with-custom-nodes