Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix make vars and improve docs gen #123

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions {{cookiecutter.project_name}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SHELL := bash
ifdef LINKML_ENVIRONMENT_FILENAME
include ${LINKML_ENVIRONMENT_FILENAME}
else
include .env.public
include config.public.mk
endif

RUN = poetry run
Expand All @@ -22,35 +22,37 @@ SRC = src
DEST = project
PYMODEL = $(SRC)/$(SCHEMA_NAME)/datamodel
DOCDIR = docs
DOCTEMPLATES = $(SRC)/docs/templates
EXAMPLEDIR = examples
SHEET_MODULE = {{cookiecutter.__google_sheet_module}}
SHEET_ID = $(LINKML_SCHEMA_GOOGLE_SHEET_ID)
SHEET_TABS = $(LINKML_SCHEMA_GOOGLE_SHEET_TABS)
SHEET_MODULE_PATH = $(SOURCE_SCHEMA_DIR)/$(SHEET_MODULE).yaml

# Use += to append variables from the variables file
CONFIG_YAML =
ifdef LINKML_GENERATORS_CONFIG_YAML
CONFIG_YAML = ${LINKML_GENERATORS_CONFIG_YAML}
CONFIG_YAML += ${LINKML_GENERATORS_CONFIG_YAML}
endif

GEN_DOC_ARGS =
ifdef LINKML_GENERATORS_DOC_ARGS
GEN_DOC_ARGS = ${LINKML_GENERATORS_DOC_ARGS}
GEN_DOC_ARGS += ${LINKML_GENERATORS_DOC_ARGS}
endif

GEN_OWL_ARGS =
ifdef LINKML_GENERATORS_OWL_ARGS
GEN_OWL_ARGS = ${LINKML_GENERATORS_OWL_ARGS}
GEN_OWL_ARGS += ${LINKML_GENERATORS_OWL_ARGS}
endif

GEN_JAVA_ARGS =
ifdef LINKML_GENERATORS_JAVA_ARGS
GEN_JAVA_ARGS = ${LINKML_GENERATORS_JAVA_ARGS}
GEN_JAVA_ARGS += ${LINKML_GENERATORS_JAVA_ARGS}
endif

GEN_TS_ARGS =
ifdef LINKML_GENERATORS_TYPESCRIPT_ARGS
GEN_TS_ARGS = ${LINKML_GENERATORS_TYPESCRIPT_ARGS}
GEN_TS_ARGS += ${LINKML_GENERATORS_TYPESCRIPT_ARGS}
endif


Expand Down Expand Up @@ -195,7 +197,7 @@ $(DOCDIR):
mkdir -p $@

gendoc: $(DOCDIR)
cp -rf $(SRC)/docs/* $(DOCDIR) ; \
cp -rf $(SRC)/docs/files/* $(DOCDIR) ; \
$(RUN) gen-doc ${GEN_DOC_ARGS} -d $(DOCDIR) $(SOURCE_SCHEMA_PATH)

testdoc: gendoc serve
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# config.public.mk

# This file is public in git. No sensitive info allowed.
# These variables are sourced in Makefile, following make-file conventions.
# Be aware that this file does not follow python or bash conventions, so may appear a little unfamiliar.

###### schema definition variables, used by makefile

LINKML_SCHEMA_NAME="{{cookiecutter.__project_slug}}"
LINKML_SCHEMA_AUTHOR="{{cookiecutter.__author}}"
LINKML_SCHEMA_DESCRIPTION="{{cookiecutter.project_description}}"
LINKML_SCHEMA_SOURCE_PATH="{{cookiecutter.__source_path}}"
LINKML_SCHEMA_GOOGLE_SHEET_ID="{{cookiecutter.google_sheet_id}}"
LINKML_SCHEMA_GOOGLE_SHEET_TABS="{{cookiecutter.google_sheet_tabs}}"
# Note: makefile variables should not be quoted, as makefile handles quoting differently than bash
LINKML_SCHEMA_NAME={{cookiecutter.__project_slug}}
LINKML_SCHEMA_AUTHOR={{cookiecutter.__author}}
LINKML_SCHEMA_DESCRIPTION={{cookiecutter.project_description}}
LINKML_SCHEMA_SOURCE_PATH={{cookiecutter.__source_path}}
LINKML_SCHEMA_GOOGLE_SHEET_ID={{cookiecutter.google_sheet_id}}
LINKML_SCHEMA_GOOGLE_SHEET_TABS={{cookiecutter.google_sheet_tabs}}

###### linkml generator variables, used by makefile

Expand Down
3 changes: 3 additions & 0 deletions {{cookiecutter.project_name}}/src/docs/templates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Use this folder to store templates to modify the generated documentation. The templates are written in Jinja2 and are used to generate the HTML documentation for the schema.

The default templates are stored in the linkml repository at https://github.com/linkml/linkml/tree/main/linkml/generators/docgen. If you want to use these as a starting point, you can copy them into this folder and modify them as needed.
Loading