experimenting with md generation...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2021-12-13 00:57:15 +03:00
parent dea3046a24
commit 03c3561f2c
2 changed files with 60 additions and 10 deletions

View File

@ -3,7 +3,8 @@
# #
# #
# Main targets: # Main targets:
# doc - build class documentation # pdf - build class pdf documentation...
# md - build class markdown documentation (XXX EXPERIMENTAL)...
# #
# Distribution and install: # Distribution and install:
# dist - build a distributable zip # dist - build a distributable zip
@ -79,7 +80,6 @@ COMMIT = $(strip $(shell git rev-parse HEAD))
# - link vs. copy/strip # - link vs. copy/strip
# - $(LN) vs. $(INSTALL) in the install target... # - $(LN) vs. $(INSTALL) in the install target...
CODE_INSTALL ?= strip CODE_INSTALL ?= strip
ifeq ($(CODE_INSTALL),strip) ifeq ($(CODE_INSTALL),strip)
MODULE_CODE := $(MODULE)-stripped MODULE_CODE := $(MODULE)-stripped
else else
@ -87,6 +87,24 @@ else
endif endif
# markdown dialect...
#
# XXX still needs some tweaking...
MD_FORMAT ?= markdown_github
# debug output...
#
# $DEBUG can either be empty or anything else...
DEBUG ?=
ifeq ($(DEBUG),)
STDERR := > /dev/null
else
STDERR :=
endif
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Paths and files... # Paths and files...
@ -139,11 +157,39 @@ LN := cp -l
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# Rules... # Rules...
# docs (pdf)...
#
%.pdf: %.tex %.pdf: %.tex
$(TEX) $< > /dev/null $(TEX) $< $(STDERR)
# docs (markdown)...
#
# XXX this still needs some tweaking...
# - |..| - verbatim does not work...
# - || - parts of doc omitted...
# - verbatim blocks get merged sometimes...
# - ...
#%.md: %.tex
# pandoc -t $(MD_FORMAT) -s $< -o $@
# XXX STUB/HACK...
# ...need to call $(TEX) on the result...
# ...need to install the internet class...
# https://github.com/loopspace/latex-to-internet
# XXX revise:
# ...for this to work we need to replace:
# \documentclass{ltxdoc}
# to:
# \documentclass[markdownextra]{internet}
%.md: %.tex
cat $< \
| sed 's/documentclass{ltxdoc}/documentclass[markdownextra]{internet}/' \
> $<.tmp
mv $<{.tmp,}
$(TEX) $< $(STDERR)
# docs... # meta-section...
# #
# NOTE: .sty and .cls are essentially the same in terms of documentation # NOTE: .sty and .cls are essentially the same in terms of documentation
# generation... # generation...
@ -197,8 +243,12 @@ version:
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# Main targets... # Main targets...
.PHONY: doc .PHONY: pdf
doc: $(MODULE).pdf pdf: $(MODULE).pdf
.PHONY: md
md: $(MODULE).md
# XXX STUB -- not sure how to approach this yet... # XXX STUB -- not sure how to approach this yet...
@ -218,7 +268,7 @@ dist: $(DIST_FILES)
.PHONY: all .PHONY: all
all: doc all: pdf
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -233,7 +283,7 @@ all: doc
# user install... # user install...
.PHONY: install .PHONY: install
install: doc $(MODULE_CODE).cls install: pdf $(MODULE_CODE).cls
$(MD) $(INSTALL_PATH)/{tex,source,doc}/latex/$(MODULE) $(MD) $(INSTALL_PATH)/{tex,source,doc}/latex/$(MODULE)
$(INSTALL) "$(MODULE).pdf" $(INSTALL_PATH)/doc/latex/$(MODULE) $(INSTALL) "$(MODULE).pdf" $(INSTALL_PATH)/doc/latex/$(MODULE)
$(INSTALL) "$(MODULE_CODE).cls" $(INSTALL_PATH)/tex/latex/$(MODULE)/$(MODULE).cls $(INSTALL) "$(MODULE_CODE).cls" $(INSTALL_PATH)/tex/latex/$(MODULE)/$(MODULE).cls
@ -300,7 +350,7 @@ sweep:
.PHONY: clean .PHONY: clean
clean: sweep clean: sweep
rm -rf $(DIST_DIR) $(BUILD_DIR) *.pdf rm -rf $(DIST_DIR) $(BUILD_DIR) $(MODULE).md *.pdf

View File

@ -3,7 +3,7 @@
LaTeX class for making photo books. LaTeX class for making photo books.
## Build requirements ## Build requirements for docs
- LaTeX tool chain (including: `lualatex`, `latexmk`, ..) - LaTeX tool chain (including: `lualatex`, `latexmk`, ..)
The simplest way to get started is [TeX Live](https://www.tug.org/texlive/), The simplest way to get started is [TeX Live](https://www.tug.org/texlive/),