Skip to content

Commit

Permalink
Move theme witiko/tilde from LaTeX to plain TeX
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed Dec 14, 2023
1 parent ef923d5 commit 7e132cd
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 94 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ mkdir -p ${INSTALL_DIR}/scripts/ma
cp ${BUILD_DIR}/markdown-cli.lua ${INSTALL_DIR}/scripts/markdown/
mkdir -p ${INSTALL_DIR}/tex/generic/markdown/
cp ${BUILD_DIR}/markdown.tex ${INSTALL_DIR}/tex/generic/markdown/
cp ${BUILD_DIR}/markdownthemewitiko_tilde.tex ${INSTALL_DIR}/tex/generic/markdown/
mkdir -p ${INSTALL_DIR}/tex/latex/markdown/
cp ${BUILD_DIR}/markdown.sty ${INSTALL_DIR}/tex/latex/markdown/
cp ${BUILD_DIR}/markdownthemewitiko_dot.sty ${INSTALL_DIR}/tex/latex/markdown/
cp ${BUILD_DIR}/markdownthemewitiko_graphicx_http.sty ${INSTALL_DIR}/tex/latex/markdown/
cp ${BUILD_DIR}/markdownthemewitiko_tilde.sty ${INSTALL_DIR}/tex/latex/markdown/
mkdir -p ${INSTALL_DIR}/tex/context/third/markdown/
cp ${BUILD_DIR}/t-markdown.tex ${INSTALL_DIR}/tex/context/third/markdown/

Expand Down
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ DOCUMENTATION=$(TECHNICAL_DOCUMENTATION) $(HTML_USER_MANUAL) $(ROOT_README) $(VE
LIBRARIES=libraries/markdown-tinyyaml.lua
INSTALLABLES=markdown.lua markdown-cli.lua markdown.tex markdown.sty t-markdown.tex \
markdownthemewitiko_dot.sty markdownthemewitiko_graphicx_http.sty \
markdownthemewitiko_tilde.sty
markdownthemewitiko_tilde.tex
EXTRACTABLES=$(INSTALLABLES) $(MARKDOWN_USER_MANUAL) $(TECHNICAL_DOCUMENTATION_RESOURCES)
MAKEABLES=$(TECHNICAL_DOCUMENTATION) $(USER_MANUAL) $(INSTALLABLES) $(EXAMPLES)
RESOURCES=$(DOCUMENTATION) $(EXAMPLES_RESOURCES) $(EXAMPLES_SOURCES) $(EXAMPLES) \
Expand Down Expand Up @@ -142,6 +142,8 @@ $(TECHNICAL_DOCUMENTATION): $(DTXARCHIVE) $(TECHNICAL_DOCUMENTATION_RESOURCES)

# This pseudotarget continuously typesets the manual.
preview: $(DTXARCHIVE) $(TECHNICAL_DOCUMENTATION_RESOURCES)
-mkdir markdown/
-ln -s ../markdown.tex markdown/markdown.tex
latexmk -silent -pvc $<

# These targets typeset the examples.
Expand Down Expand Up @@ -209,9 +211,9 @@ $(TDSARCHIVE): $(DTXARCHIVE) $(INSTALLER) $(INSTALLABLES) $(DOCUMENTATION) $(EXA
tex/context/third/markdown scripts/markdown
cp markdown.lua $(LIBRARIES) tex/luatex/markdown/
cp markdown-cli.lua scripts/markdown/
cp markdown.sty markdownthemewitiko_dot.sty markdownthemewitiko_graphicx_http.sty \
markdownthemewitiko_tilde.sty tex/latex/markdown/
cp markdown.tex tex/generic/markdown/
cp markdown.sty markdownthemewitiko_graphicx_http.sty markdownthemewitiko_dot.sty \
tex/latex/markdown/
cp markdown.tex markdownthemewitiko_tilde.tex tex/generic/markdown/
cp t-markdown.tex tex/context/third/markdown/
@# Installing the documentation.
mkdir -p doc/generic/markdown doc/latex/markdown/examples \
Expand Down
182 changes: 97 additions & 85 deletions markdown.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ abbr {
doi = {10.1109/ICPC.2010.41}}
%</techdoc-bibliography>
%<@@=markdown>
%<*latex-themes-witiko-markdown-techdoc>
%<*themes-witiko-markdown-techdoc>
\ProvidesPackage{markdownthemewitiko_markdown_techdoc}[2022/12/13]
\RequirePackage{etoolbox}
\markdownSetup{
Expand Down Expand Up @@ -862,7 +862,7 @@ abbr {
dlEnd = {\end{optionlist}},
}
}
%</latex-themes-witiko-markdown-techdoc>
%</themes-witiko-markdown-techdoc>
%<*manual>

---
Expand Down Expand Up @@ -979,7 +979,7 @@ This should produce the following files:
* `markdown.sty`, the \LaTeX{} package,
* `markdownthemewitiko_dot.sty`, the `witiko/dot` \LaTeX{} theme,
* `markdownthemewitiko_graphicx_http.sty`, the `witiko/graphicx/http` \LaTeX{} theme,
* `markdownthemewitiko_tilde.sty`, the `witiko/tilde` \LaTeX{} theme, and
* `markdownthemewitiko_tilde.tex`, the `witiko/tilde` \LaTeX{} theme, and
* `t-markdown.tex`, the \Hologo{ConTeXt} module.

### Local Installation
Expand All @@ -995,7 +995,7 @@ placed:
* `⟨TEXMF⟩/tex/latex/markdown/markdown.sty`
* `⟨TEXMF⟩/tex/latex/markdown/markdownthemewitiko_dot.sty`
* `⟨TEXMF⟩/tex/latex/markdown/markdownthemewitiko_graphicx_http.sty`
* `⟨TEXMF⟩/tex/latex/markdown/markdownthemewitiko_tilde.sty`
* `⟨TEXMF⟩/tex/latex/markdown/markdownthemewitiko_tilde.tex`
* `⟨TEXMF⟩/tex/context/third/markdown/t-markdown.tex`

where `⟨TEXMF⟩` corresponds to a root of your \TeX{} distribution, such as
Expand All @@ -1018,7 +1018,7 @@ This is where the individual files should be placed:
* `./markdown.sty`
* `./markdownthemewitiko_dot.sty`
* `./markdownthemewitiko_graphicx_http.sty`
* `./markdownthemewitiko_tilde.sty`
* `./markdownthemewitiko_tilde.tex`
* `./t-markdown.tex`

%</manual>
Expand Down Expand Up @@ -1215,13 +1215,13 @@ local uni_algos = require("lua-uni-algos")
% loaded,
% \end{markdown}
% \iffalse
%<*latex-themes-witiko-dot,latex-themes-witiko-graphicx-http,latex-themes-witiko-tilde>
%<*themes-witiko-dot,latex-themes-witiko-graphicx-http>
% \fi
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}%
% \end{macrocode}
% \iffalse
%</latex-themes-witiko-dot,latex-themes-witiko-graphicx-http,latex-themes-witiko-tilde>
%</themes-witiko-dot,latex-themes-witiko-graphicx-http>
% \fi
% \begin{markdown}
% a \TeX{} engine that extends \Hologo{eTeX}, and all the plain \TeX{}
Expand Down Expand Up @@ -12070,11 +12070,66 @@ a specific look and other high-level goals without low-level programming.
{ NnV }
\ExplSyntaxOff
% \end{macrocode}
% \end{macrocode}
% \iffalse
%</tex>
%<*manual-tokens>
%<*manual-options>
% \fi
% \par
% \begin{markdown}

Example themes provided with the Markdown package include:

\pkg{witiko/tilde}

: A theme that makes tilde (`~`) always typeset the non-breaking space even
when the \Opt{hybrid} Lua option is disabled.
% ``` tex
% \input markdown
% \markdownSetup{import=witiko/tilde}
% \markdownBegin
% Bartel~Leendert van~der~Waerden
% \markdownEnd
% \bye
% ```````
% Typesetting the above document produces the following text:
% “Bartel~Leendert van~der~Waerden”.
%
% \end{markdown}
% \iffalse

##### Plain \TeX{} Example {.unnumbered}

Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\input markdown
\markdownSetup{import=witiko/tilde}
\markdownBegin
Bartel~Leendert van~der~Waerden
\markdownEnd
\bye
```````
Next, invoke LuaTeX from the terminal:
``` sh
luatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
following text, where the middot (`·`) denotes a non-breaking space:

> Bartel·Leendert van·der·Waerden

% \fi
% \par
% \begin{markdown}
%
% Please, see Section <#sec:themes-implementation> for implementation
% details of the example themes.
%
% \end{markdown}
% \iffalse
%</manual-options>
%<*manual-tokens>

## Markdown Tokens

Expand All @@ -12083,6 +12138,9 @@ tokens, such as headings, emphasized text, links, and lists, in \TeX{}. Instead
of reducing \TeX{} to a PDF document producer, the Markdown package allows the
user to specify how every markdown token should be processed and rendered.

% \fi
% \begin{markdown}

### Token Renderers {#texrenderersuser}

% \end{markdown}
Expand Down Expand Up @@ -20570,7 +20628,7 @@ exists and a \TeX{} document named `markdowntheme`\meta{munged theme
name}`.tex` otherwise.

Having the Markdown package automatically load either the generic `.tex`
*theme file* or the \LaTeX-specific `.sty` theme file allows developers
*theme file* or the \LaTeX{}-specific `.sty` theme file allows developers
to have a single *theme file*, when the theme is small or the difference
between \TeX{} formats is unimportant, and scale up to separate theme files
native to different \TeX{} formats for large multi-format themes, where
Expand Down Expand Up @@ -20775,13 +20833,13 @@ conference article:
> <http://ceur-ws.org/Vol-2696/paper_235.pdf>

%</manual-options>
%<*latex-themes-witiko-dot>
%<*themes-witiko-dot>
% \fi
% \begin{macrocode}
\ProvidesPackage{markdownthemewitiko_dot}[2021/03/09]%
% \end{macrocode}
% \iffalse
%</latex-themes-witiko-dot>
%</themes-witiko-dot>
%<*manual-options>
% \fi
% \par
Expand Down Expand Up @@ -20837,67 +20895,13 @@ following image:
> ![img](https://github.com/witiko/markdown/raw/main/markdown.png "The banner of the Markdown package")

%</manual-options>
%<*latex-themes-witiko-graphicx-http>
%<*themes-witiko-graphicx-http>
% \fi
% \begin{macrocode}
\ProvidesPackage{markdownthemewitiko_graphicx_http}[2021/03/22]%
% \end{macrocode}
% \iffalse
%</latex-themes-witiko-graphicx-http>
%<*manual-options>
% \fi
% \par
% \markdownBegin

\pkg{witiko/tilde}

: A theme that makes tilde (`~`) always typeset the non-breaking space even
when the \Opt{hybrid} Lua option is disabled.
% ``` tex
% \documentclass{article}
% \usepackage[import=witiko/tilde]{markdown}
% \begin{document}
% \begin{markdown}
% Bartel~Leendert van~der~Waerden
% \end{markdown}
% \end{document}
% ```````
% Typesetting the above document produces the following text:
% “Bartel~Leendert van~der~Waerden”.
%
% \markdownEnd
% \iffalse

##### \LaTeX{} Example {.unnumbered}

Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
\usepackage[import=witiko/tilde]{markdown}
\begin{document}
\begin{markdown}
Bartel~Leendert van~der~Waerden
\end{markdown}
\end{document}
```````
Next, invoke LuaTeX from the terminal:
``` sh
lualatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
following text, where the middot (`·`) denotes a non-breaking space:

> Bartel·Leendert van·der·Waerden

%</manual-options>
%<*latex-themes-witiko-tilde>
% \fi
% \begin{macrocode}
\ProvidesPackage{markdownthemewitiko_tilde}[2021/03/22]%
% \end{macrocode}
% \iffalse
%</latex-themes-witiko-tilde>
%</themes-witiko-graphicx-http>
%<*manual-options>
% \fi
% \par
Expand Down Expand Up @@ -31949,6 +31953,28 @@ end
{ nV }
\ExplSyntaxOff
% \end{macrocode}
% \iffalse
%</tex>
%<*themes-witiko-tilde>
% \fi
% \par
% \begin{markdown}
%
% The `witiko/tilde` theme redefines the tilde token renderer prototype,
% so that it expands to a non-breaking space:
%
% \end{markdown}
% \begin{macrocode}
\markdownSetup {
rendererPrototypes = {
tilde = {~},
},
}
% \end{macrocode}
% \iffalse
%</themes-witiko-tilde>
%<*tex>
% \fi
% \begin{markdown}
%
%### Token Renderer Prototypes {#tex-token-renderer-prototypes}
Expand Down Expand Up @@ -33134,7 +33160,7 @@ end
% \end{markdown}
% \iffalse
%</latex>
%<*latex-themes-witiko-dot>
%<*themes-witiko-dot>
% \fi
% \begin{macrocode}
\markdownSetup{fencedCode}%
Expand Down Expand Up @@ -33199,8 +33225,8 @@ end
\next#2 \relax}%
% \end{macrocode}
% \iffalse
%</latex-themes-witiko-dot>
%<*latex-themes-witiko-graphicx-http>
%</themes-witiko-dot>
%<*themes-witiko-graphicx-http>
% \fi
% \par
% \begin{markdown}
Expand Down Expand Up @@ -33336,21 +33362,7 @@ end
\endgroup
% \end{macrocode}
% \iffalse
%</latex-themes-witiko-graphicx-http>
%<*latex-themes-witiko-tilde>
% \fi
% \par
% \begin{markdown}
%
% The `witiko/tilde` theme redefines the tilde token renderer prototype,
% so that it expands to a non-breaking space:
%
% \end{markdown}
% \begin{macrocode}
\renewcommand\markdownRendererTildePrototype{~}%
% \end{macrocode}
% \iffalse
%</latex-themes-witiko-tilde>
%</themes-witiko-graphicx-http>
%<*latex>
% \fi
% \par
Expand Down
8 changes: 4 additions & 4 deletions markdown.ins
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
\file{markdown.tex}{\from{markdown.dtx}{tex}}
\file{markdown.sty}{\from{markdown.dtx}{latex}}
\file{t-markdown.tex}{\from{markdown.dtx}{context}}
\file{markdownthemewitiko_dot.sty}{\from{markdown.dtx}{latex-themes-witiko-dot}}
\file{markdownthemewitiko_graphicx_http.sty}{\from{markdown.dtx}{latex-themes-witiko-graphicx-http}}
\file{markdownthemewitiko_tilde.sty}{\from{markdown.dtx}{latex-themes-witiko-tilde}}
\file{markdownthemewitiko_markdown_techdoc.sty}{\from{markdown.dtx}{latex-themes-witiko-markdown-techdoc}}
\file{markdownthemewitiko_dot.sty}{\from{markdown.dtx}{themes-witiko-dot}}
\file{markdownthemewitiko_graphicx_http.sty}{\from{markdown.dtx}{themes-witiko-graphicx-http}}
\file{markdownthemewitiko_tilde.tex}{\from{markdown.dtx}{themes-witiko-tilde}}
\file{markdownthemewitiko_markdown_techdoc.sty}{\from{markdown.dtx}{themes-witiko-markdown-techdoc}}
\usepreamble\empty
\usepostamble\empty
\file{markdown.md}{\from{markdown.dtx}{manual}}
Expand Down

0 comments on commit 7e132cd

Please sign in to comment.