Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable LuaMetaTeX in ConTeXt tests and examples #557

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ CTANARCHIVE=markdown.ctan.zip
DISTARCHIVE=markdown.zip
ARCHIVES=$(TDSARCHIVE) $(CTANARCHIVE) $(DISTARCHIVE)
EXAMPLES_RESOURCES=examples/example.md examples/scientists.csv
EXAMPLES_SOURCES=examples/context-mkiv.tex \
EXAMPLES_SOURCES=examples/context-mkiv.tex examples/context-lmtx.tex \
examples/latex-pdftex.tex examples/latex-xetex.tex examples/latex-luatex.tex \
examples/optex.tex
EXAMPLES=examples/context-mkiv.pdf \
EXAMPLES=examples/context-mkiv.pdf examples/context-lmtx.pdf \
examples/latex-pdftex.pdf examples/latex-xetex.pdf examples/latex-luatex.pdf \
examples/latex-tex4ht.html examples/latex-tex4ht.css \
examples/optex.pdf
Expand Down
6 changes: 5 additions & 1 deletion examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ OUTPUT=\
all: $(OUTPUT)
$(MAKE) clean

# This target typesets the ConTeXt example using the Mark IV format.
# This target typesets the ConTeXt example using the MkIV format.
context-mkiv.pdf: context-mkiv.tex example.tex
context --luatex context-mkiv.tex

# This target typesets the ConTeXt example using the LMTX format.
context-lmtx.pdf: context-lmtx.tex example.tex
context context-lmtx.tex

# This target typesets the LaTeX example using the pdfTeX engine.
latex-pdftex.pdf: latex-pdftex.tex example.tex
pdflatex --shell-escape $<
Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This directory contains example LaTeX and ConTeXt documents. These documents
can be typeset by running the GNU `make` program in this directory. It is
expected that your TeX installation contains the `pdflatex`, `xelatex`,
`lualatex`, `texexec`, and `context` executables.
`lualatex`, and `context` executables.

The `markdown.dtx` file in the root directory contains documentation in the
markdown language and can also serve as an example LaTeX document.
1 change: 1 addition & 0 deletions examples/context-lmtx.tex
118 changes: 0 additions & 118 deletions examples/context-mkiv.tex

This file was deleted.

1 change: 1 addition & 0 deletions examples/context-mkiv.tex
118 changes: 118 additions & 0 deletions examples/context.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
\enableregime[utf]
\usetypescript[modern][ec]
\setupbodyfont[10pt,rm]
\setupexternalfigures[location={local,global,default}]

% Load the Markdown module.
\startluacode
local kpse = require("kpse")
kpse.set_program_name("luatex")
\stopluacode
\usemodule[t][markdown]

% Set options of the Markdown module.
\setupmarkdown
[
contentBlocks = yes,
debugExtensions = yes,
definitionLists = yes,
fancy_lists = yes,
fencedCode = yes,
hashEnumerators = yes,
inlineNotes = yes,
lineBlocks = yes,
notes = yes,
pipeTables = yes,
rawAttribute = yes,
smartEllipses = yes,
strikethrough = yes,
subscripts = yes,
superscripts = yes,
tableCaptions = yes,
taskLists = yes,
texMathDollars = yes,
texMathDoubleBackslash = yes,
texMathSingleBackslash = yes,
]

% Set renderers of the Markdown module.
\definehighlight
[markdownRendererEmphasis]
[style=\em]

\definehighlight
[markdownRendererStrongEmphasis]
[style=bold]

\definehighlight
[markdownRendererCodeSpan]
[style=mono]

\definetyping
[latex]

\setuptyping
[latex]
[option=TEX]

\starttext

% Set and typeset the document metadata using a YAML metadata block.
\setupyaml
[
jekyllDataRenderers = {
title = {\gdef\doctitle{#1}},
author = {\gdef\author{#1}},
date = {\gdef\date{#1}},
},
renderers = {
jekyllDataEnd = {%
\startalignment[center]
\blank[force,2*big]
{\tfd \doctitle}
\blank[3*medium]
{\tfa \author}
\blank[2*medium]
{\tfa \date}
\blank[3*medium]
\stopalignment
},
},
]

\startyaml

title: An Example *Markdown* Document
author: Vít Starý Novotný
date: `\currentdate`{=tex}

\stopyaml

% Typeset the document `example.md` by letting the Markdown package handle
% the conversion internally. Optionally, we can specify additional options
% between the square brackets similarly to the command `\setupmarkdown`.
% Unlike `\setupmarkdown`, the options will only apply for this document.
\inputmarkdown[smart_ellipses = yes]{./example.md}

% Typeset the document `example.tex` that we prepared separately using the
% Lua command-line interface and that contains a plain TeX representation
% of the document `example.md`.
\catcode`\%=12\relax
\catcode`\#=12\relax
\doiffileelse{./example.tex}{\input example}{}
\catcode`\%=14\relax
\catcode`\#=6\relax

% Besides inputting external files, Markdown text can we written directly
% into a LaTeX document. Markdown text and LaTeX code can be freely combined.
\startmarkdown

This is a paragraph of *Markdown text* with inline `\LaTeX`{=tex} code.

``` {=tex}
This is a paragraph of \LaTeX{} code with inline \markinline{*Markdown text*}.
```

\stopmarkdown

\stoptext
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
context --result=OUTPUT_DIRECTORY`___'TEST_BASENAME --once --luatex --nonstopmode TEST_FILENAME && rename 's/___/\//' OUTPUT_DIRECTORY`___'TEST_BASENAME*
context --result=OUTPUT_DIRECTORY`___'TEST_BASENAME --once --nonstopmode TEST_FILENAME && rename 's/___/\//' OUTPUT_DIRECTORY`___'TEST_BASENAME*
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
This directory contains TeX source code templates for the ConTeXt Mark II format.
This directory contains TeX source code templates for the ConTeXt MkIV and LMTX
formats.
2 changes: 1 addition & 1 deletion tests/testfiles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ currently only process the `if` key that can be used to specify for which
TeX formats and templates the testfile should run using Python syntax:

``` yaml
if: format == 'context-mkiv' or template == 'verbatim'
if: format == 'context' or template == 'verbatim'
```

If no YAML metadata are specified, the `---` delimiter may also be omitted.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if: format == 'context-mkiv' or template == 'input'
if: format == 'context' or template == 'input'
---
\markdownSetup{fancyLists=true}
<<<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if: format == 'context-mkiv' or template == 'input'
if: format == 'context' or template == 'input'
---
<<<
- foo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if: format == 'context-mkiv' or template == 'input'
if: format == 'context' or template == 'input'
---

% ---RESULT--- "example": 633,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if: format == 'context-mkiv' or template == 'input'
if: format == 'context' or template == 'input'
---

% ---RESULT--- "example": 635,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if: format == 'context-mkiv' or template == 'input'
if: format == 'context' or template == 'input'
---

% ---RESULT--- "example": 636,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if: format == 'context-mkiv' or template == 'input'
if: format == 'context' or template == 'input'
---

% ---RESULT--- "example": 638,
Expand Down
2 changes: 1 addition & 1 deletion tests/testfiles/unit/CommonMark_0.30/paragraphs/008.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if: format == 'context-mkiv' or template == 'input'
if: format == 'context' or template == 'input'
---

% ---RESULT--- "example": 226,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if: format == 'context-mkiv' or template == 'input'
if: format == 'context' or template == 'input'
---
<<<
This test ensures that two and more trailing spaces or tabs produce a
Expand Down
Loading