Skip to content

Commit

Permalink
Generation of verbatim and plaintext output from ddoc
Browse files Browse the repository at this point in the history
  • Loading branch information
andralex committed Jan 1, 2015
1 parent 8681836 commit 72c3703
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 3 deletions.
84 changes: 84 additions & 0 deletions plaintext.ddoc
@@ -0,0 +1,84 @@
_=******************************************************************************
_=Macros that generate a plain text document without any formatting. These are
_=useful for e.g. indexing, summarization, extracting word counts etc.
_=******************************************************************************

B = $0
BIG = $0
BLACK = $0
BLUE = $0
BR =
$0
DD = $0
DL = $0
DT = $0
GREEN = $0
I = $0
LI = $0
LINK = $0
LINK2 = $+
LPAREN = (
OL = $0
P = $0
RPAREN = )
RED = $0
SMALL = $0
TABLE = $0
TD = $0
TH = $0
TR = $0
U = $0
UL = $0
WHITE = $0
YELLOW = $0

D_CODE = $0
D_COMMENT = $0
D_STRING = $0
D_KEYWORD = $0
D_PSYMBOL = $0
D_PARAM = $0

DDOC = $(BODY)
DDOC_ANCHOR = $0
DDOC_AUTHORS = $0
DDOC_BLANKLINE = $(BR)
DDOC_BUGS = $0
DDOC_CLASS_MEMBERS = $0
DDOC_COMMENT = $0
DDOC_COPYRIGHT = $0
DDOC_DATE = $0
DDOC_DECL = $0
DDOC_DECL_DD = $0
DDOC_DEPRECATED = $0
DDOC_DESCRIPTION = $0
DDOC_DITTO = $0
DDOC_ENUM_MEMBERS = $0
DDOC_EXAMPLES = $0
DDOC_HISTORY = $0
DDOC_KEYWORD = $0
DDOC_LICENSE = $0
DDOC_MEMBERS = $0
DDOC_MODULE_MEMBERS = $0
DDOC_PARAM_DESC = $0
DDOC_PARAM = $0
DDOC_PARAM_ID = $0
DDOC_PARAM_ROW = $0
DDOC_PARAMS = $0
DDOC_PSYMBOL = $0
DDOC_RETURNS = $0
DDOC_SECTION = $0
DDOC_SECTION_H = $0
DDOC_SECTIONS = $0
DDOC_SEE_ALSO = $0
DDOC_STRUCT_MEMBERS = $0
DDOC_SUMMARY = $0
DDOC_STANDARDS = $0
DDOC_TEMPLATE_MEMBERS = $0
DDOC_THROWS = $0
DDOC_UNDEFINED_MACRO = $(NOCOMMAS $+)
DDOC_VERSION = $0

NOCOMMAS=$1 $(NOCOMMAS $+)

_ =
16 changes: 13 additions & 3 deletions posix.mak
Expand Up @@ -181,7 +181,7 @@ ${LATEST}.ddoc :

clean:
rm -rf $(DOC_OUTPUT_DIR) ${LATEST}.ddoc
rm -rf auto dlangspec-tex.d $(addprefix dlangspec,.aux .d .dvi .fdb_latexmk .fls .log .out .pdf .tex)
rm -rf auto dlangspec-consolidated.d $(addprefix dlangspec,.aux .d .dvi .fdb_latexmk .fls .log .out .pdf .tex .txt .verbatim.txt)
rm -f docs.json docs-prerelease.json
@echo You should issue manually: rm -rf ${DMD_DIR}-${LATEST} ${DRUNTIME_DIR}-${LATEST} ${PHOBOS_DIR}-${LATEST} ${STABLE_DMD_ROOT}

Expand Down Expand Up @@ -216,10 +216,10 @@ $(DOC_OUTPUT_DIR)/dlangspec.mobi : \
# LaTeX
################################################################################

dlangspec-tex.d : $(addsuffix .dd,$(SPEC_ROOT))
dlangspec-consolidated.d : $(addsuffix .dd,$(SPEC_ROOT))
$(RDMD) --force ../tools/catdoc.d -o$@ $^

dlangspec.tex : $(DDOC) latex.ddoc dlangspec-tex.d
dlangspec.tex : $(DDOC) latex.ddoc dlangspec-consolidated.d
$(DMD) -Df$@ $^

# Run twice to fix multipage tables and \ref uses
Expand All @@ -230,6 +230,16 @@ dlangspec.dvi : dlangspec.tex
$(DOC_OUTPUT_DIR)/dlangspec.pdf : dlangspec.dvi
dvipdf $^ $@

################################################################################
# Plaintext/verbatim generation - not part of the build, demo purposes only
################################################################################

dlangspec.txt : macros.ddoc plaintext.ddoc dlangspec-consolidated.d
$(DMD) -Df$@ $^

dlangspec.verbatim.txt : macros.ddoc verbatim.ddoc dlangspec-consolidated.d
$(DMD) -Df$@ $^

################################################################################
# Git clone rules
################################################################################
Expand Down

0 comments on commit 72c3703

Please sign in to comment.