Skip to content

Commit 1716120

Browse files
committed
Update equation recipes
1 parent 7464f4a commit 1716120

File tree

3 files changed

+53
-25
lines changed

3 files changed

+53
-25
lines changed

tools/make/lib/docs/Makefile

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
include $(TOOLS_MAKE_LIB_DIR)/docs/src.mk
55
include $(TOOLS_MAKE_LIB_DIR)/docs/eqns.mk
66

7+
78
# TARGETS #
89

910
# Generate documentation.
@@ -22,12 +23,3 @@ docs: src-docs
2223
clean-docs: clean-src-docs
2324

2425
.PHONY: clean-docs
25-
26-
27-
# Generate equations.
28-
#
29-
# This target inserts DIVs and generates SVG files for all equations in Markdown file.
30-
31-
equations: generate-equations
32-
33-
.PHONY: equations

tools/make/lib/docs/eqns.mk

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,73 @@
1+
12
# VARIABLES #
23

3-
REMARK_RUNNER ?= $(BIN_DIR)/remark
4+
# Define the path to the [remark][1] executable.
5+
#
6+
# To install remark:
7+
# $ npm install remark-cli
8+
#
9+
# [1]: https://github.com/wooorm/remark/
10+
11+
REMARK ?= $(BIN_DIR)/remark
412

513
# Define the path to the remark ignore file:
614
REMARK_IGNORE ?= $(CONFIG_DIR)/.remarkignore
715

8-
# Define plugins:
16+
# Define the path to the local remark plugins directory:
17+
REMARK_LOCAL_PLUGINS_DIR ?= $(TOOLS_DIR)/remark/plugins
918

10-
PLUGIN_FOLDER ?= $(TOOLS_DIR)/remark/plugins
11-
REMARK_HTML_EQUATIONS_PLUGIN ?= $(PLUGIN_FOLDER)/remark-html-equations
12-
REMARK_SVG_EQUATIONS_PLUGIN ?= $(PLUGIN_FOLDER)/remark-svg-equations
19+
# Define paths to local plugins:
20+
REMARK_HTML_EQUATIONS_PLUGIN ?= $(REMARK_LOCAL_PLUGINS_DIR)/remark-html-equations
21+
REMARK_SVG_EQUATIONS_PLUGIN ?= $(REMARK_LOCAL_PLUGINS_DIR)/remark-svg-equations
1322

1423
# Define Markdown extensions:
1524
REMARK_EXT ?= md
1625

1726
# Define the command-line options when invoking the remark executable:
18-
GENERATE_EQUATIONS_FLAGS ?= \
27+
REMARK_FLAGS ?= \
1928
--ext $(REMARK_EXT) \
20-
--ignore-path $(REMARK_IGNORE) \
21-
--use $(REMARK_HTML_EQUATIONS_PLUGIN) \
22-
--use $(REMARK_SVG_EQUATIONS_PLUGIN)
29+
--ignore-path $(REMARK_IGNORE)
2330

2431
# Define output option:
25-
OUTPUT ?= --output
32+
REMARK_OUTPUT_FLAG ?= --output
33+
2634

2735
# TARGETS #
2836

29-
# Generate equations.
37+
# Generate HTML equation elements.
38+
#
39+
# This target transforms Markdown files containing equation comment markup to include HTML equation elements.
40+
41+
markdown-html-equations: $(NODE_MODULES)
42+
$(REMARK) $(MARKDOWN_FILES) \
43+
$(REMARK_FLAGS) \
44+
--use $(REMARK_HTML_EQUATIONS_PLUGIN) \
45+
$(REMARK_OUTPUT_FLAG)
46+
47+
.PHONY: markdown-html-equations
48+
49+
50+
# Generate SVG equation files.
51+
#
52+
# This target generates SVG equations files from Markdown equation elements.
53+
54+
markdown-svg-equations: $(NODE_MODULES)
55+
$(REMARK) $(MARKDOWN_FILES) \
56+
$(REMARK_FLAGS) \
57+
--use $(REMARK_SVG_EQUATIONS_PLUGIN)
58+
59+
.PHONY: markdown-svg-equations
60+
61+
62+
# Processes Markdown files containing equations.
3063
#
31-
# This target generates SVG files for all equations in Markdown file.
64+
# This target processes Markdown files in search for Markdown equation elements. Files containing equation elements are transformed to include HTML equation elements. SVG files are also generated for each equation.
3265

33-
generate-equations: $(NODE_MODULES)
34-
$(REMARK_RUNNER) $(GENERATE_EQUATIONS_FLAGS) $(MARKDOWN_FILES) $(OUTPUT)
66+
markdown-equations: $(NODE_MODULES)
67+
$(REMARK) $(MARKDOWN_FILES) \
68+
$(REMARK_FLAGS) \
69+
--use $(REMARK_HTML_EQUATIONS_PLUGIN) \
70+
--use $(REMARK_SVG_EQUATIONS_PLUGIN) \
71+
$(REMARK_OUTPUT_FLAG)
3572

36-
.PHONY: generate-equations
73+
.PHONY: markdown-equations

tools/make/usage.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,3 @@ Usage: make <cmd>
3232
make clean Run all cleanup tasks.
3333
make clean-node Remove Node dependencies.
3434
make inspect.VARIABLE Print the runtime value of a VARIABLE.
35-
make equations Generate SVGs for equations in Markdown files.

0 commit comments

Comments
 (0)