mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-24 22:50:39 +01:00
tex.mk: Add support for parsing source code labels
Add support for parsing source code labels to tex.mk (not a beauty, yet).
This commit is contained in:
parent
e271a88ae8
commit
13d62992ff
1 changed files with 38 additions and 4 deletions
42
make/tex.mk
42
make/tex.mk
|
|
@ -16,7 +16,12 @@ FMT_OUT = $(patsubst %,$(OUT).%.zip,$(FMT))
|
||||||
FMT_OFFLINE_OUT = $(patsubst %,$(OUT).%.zip,$(FMT_OFFLINE))
|
FMT_OFFLINE_OUT = $(patsubst %,$(OUT).%.zip,$(FMT_OFFLINE))
|
||||||
ALL = $(FMT_OUT) html_install
|
ALL = $(FMT_OUT) html_install
|
||||||
PRE_HTML = $(patsubst %.tmpl,%,$(wildcard *.html.tmpl))
|
PRE_HTML = $(patsubst %.tmpl,%,$(wildcard *.html.tmpl))
|
||||||
PRE_TEX = $(patsubst %.ger,%.tex,$(patsubst %.tmpl,%,$(wildcard *.tex.tmpl *.ger) $(LOCAL_IMPORTED_TEMPLATES)))
|
LINETMPL=$(wildcard *.linetmpl)
|
||||||
|
TEXFROMGER=$(patsubst %.ger,%.tex,$(wildcard *.ger))
|
||||||
|
#GERFROMLINETMPL=$(patsubst %.linetmpl,%,$(wildcard *.linetmpl))
|
||||||
|
PRE_TEX = $(patsubst %.ger,%.tex,\
|
||||||
|
$(patsubst %.tmpl,%,$(wildcard *.tex.tmpl *.ger.tmpl) $(LOCAL_IMPORTED_TEMPLATES)) \
|
||||||
|
$(GERFROMLINETMPL)) $(TEXFROMGER)
|
||||||
TEXSRC = $(wildcard *.tex) $(IMAGES) $(LOCAL_SRC) $(PRE_TEX)
|
TEXSRC = $(wildcard *.tex) $(IMAGES) $(LOCAL_SRC) $(PRE_TEX)
|
||||||
DATE := $(shell date +'%b, %d, %Y')
|
DATE := $(shell date +'%b, %d, %Y')
|
||||||
TEX_WARN_DONT_EDIT = "\
|
TEX_WARN_DONT_EDIT = "\
|
||||||
|
|
@ -28,6 +33,21 @@ TEX_WARN_DONT_EDIT = "\
|
||||||
WD = `pwd`
|
WD = `pwd`
|
||||||
NEWDIRS = $(DISTDIR) $(HTMLDIR) $(DVIDIR)
|
NEWDIRS = $(DISTDIR) $(HTMLDIR) $(DVIDIR)
|
||||||
|
|
||||||
|
define replace_linenumbers
|
||||||
|
@echo replacing line numbers in templates
|
||||||
|
cat $< | awk ' \
|
||||||
|
BEGIN { FS=":" } { \
|
||||||
|
if ($$0 ~ /SUBST_LINE_NUM/) { \
|
||||||
|
start=$$1; patt=$$2; file=$$3; \
|
||||||
|
regex=$$4; offset=$$5; rest=$$6; \
|
||||||
|
grepcmd="grep -n \042" regex "\042 " file; \
|
||||||
|
grepcmd | getline; \
|
||||||
|
linenum=$$1; \
|
||||||
|
print start linenum rest \
|
||||||
|
} else { print $$0 } } \
|
||||||
|
' >> $@
|
||||||
|
endef
|
||||||
|
|
||||||
define replace_macros
|
define replace_macros
|
||||||
@echo replacing macros in templates
|
@echo replacing macros in templates
|
||||||
TMPIMAGEDIR="`echo $(IMAGEDIR) | sed -e 's/\//\\\\\//g;'`" ;\
|
TMPIMAGEDIR="`echo $(IMAGEDIR) | sed -e 's/\//\\\\\//g;'`" ;\
|
||||||
|
|
@ -46,7 +66,17 @@ define replace_macros
|
||||||
s/__ICON_CONTENTS__/$(ICON_CONTENTS)/g; \
|
s/__ICON_CONTENTS__/$(ICON_CONTENTS)/g; \
|
||||||
s/__ICON_PREV__/$(ICON_PREV)/g; \
|
s/__ICON_PREV__/$(ICON_PREV)/g; \
|
||||||
s/__ICON_NEXT__/$(ICON_NEXT)/g; \
|
s/__ICON_NEXT__/$(ICON_NEXT)/g; \
|
||||||
" >> $@
|
" | awk ' \
|
||||||
|
BEGIN { FS=":" } { \
|
||||||
|
if ($$0 ~ /SUBST_LINE_NUM/) { \
|
||||||
|
start=$$1; patt=$$2; file=$$3; \
|
||||||
|
regex=$$4; offset=$$5; rest=$$6; \
|
||||||
|
grepcmd="grep -n \042" regex "\042 " file; \
|
||||||
|
grepcmd | getline; \
|
||||||
|
linenum=$$1; \
|
||||||
|
print start linenum rest \
|
||||||
|
} else { print $$0 } } \
|
||||||
|
' >> $@
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define replace_umlauts
|
define replace_umlauts
|
||||||
|
|
@ -75,6 +105,9 @@ pdf: dirs $(OUT).pdf.zip
|
||||||
%.eps: %.fig
|
%.eps: %.fig
|
||||||
fig2dev -L eps $< $@
|
fig2dev -L eps $< $@
|
||||||
|
|
||||||
|
#%.ger: %.ger.linetmpl
|
||||||
|
# $(replace_linenumbers)
|
||||||
|
#
|
||||||
%.tex: %.ger
|
%.tex: %.ger
|
||||||
$(replace_umlauts)
|
$(replace_umlauts)
|
||||||
|
|
||||||
|
|
@ -140,7 +173,7 @@ $(OUTPUT).dvi: $(TEXSRC)
|
||||||
latex $(MAIN).tex; latex $(MAIN).tex; latex $(MAIN).tex;
|
latex $(MAIN).tex; latex $(MAIN).tex; latex $(MAIN).tex;
|
||||||
cp $(MAIN).dvi $@
|
cp $(MAIN).dvi $@
|
||||||
|
|
||||||
$(OUT).dvi.zip: $(OUTPUT).dvi $(wildcard *.eps)
|
$(OUT).dvi.zip: $(OUTPUT).dvi $(IMAGES)
|
||||||
zip $@ $^
|
zip $@ $^
|
||||||
|
|
||||||
$(OUTPUT).txt: $(OUTPUT).dvi
|
$(OUTPUT).txt: $(OUTPUT).dvi
|
||||||
|
|
@ -202,5 +235,6 @@ clean:
|
||||||
rm -rf *.aux *.toc *.dvi *.pdf *.ps *~ *.log *.done *.rep \
|
rm -rf *.aux *.toc *.dvi *.pdf *.ps *~ *.log *.done *.rep \
|
||||||
*.lol \
|
*.lol \
|
||||||
$(NEWDIRS) $(PRE_TEX) $(PRE_HTML) $(OUTPUT).txt \
|
$(NEWDIRS) $(PRE_TEX) $(PRE_HTML) $(OUTPUT).txt \
|
||||||
$(LOCAL_IMPORTED_TEMPLATES)
|
$(LOCAL_IMPORTED_TEMPLATES) \
|
||||||
|
$(GERFROMLINETMPL) $(TEXFROMGER) $(EPSFROMFIG)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue