Skip to content

Commit

Permalink
#14 docshots and \textnormal
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Oct 30, 2022
1 parent 8bb1eeb commit e89a5fb
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 138 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/l3build.yml
Expand Up @@ -6,11 +6,23 @@ on:
branches: master
jobs:
l3build:
runs-on: ubuntu-20.04
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-12]
steps:
- uses: actions/checkout@v3
- run: sudo apt-get -y install ghostscript
if: matrix.os == 'ubuntu-20.04'
- uses: teatimeguest/setup-texlive-action@v2.5.0
with:
update-all-packages: true
package-file: DEPENDS.txt
packages: scheme-basic xetex libertine l3build
- run: l3build check -q --show-log-on-error
- run: l3build ctan --show-log-on-error --halt-on-error
- uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
branch: gh-pages
folder: build/distrib/tds/tex/latex
clean: true
if: github.ref == 'refs/heads/master' && matrix.os == 'ubuntu-20.04'
2 changes: 1 addition & 1 deletion build.lua
Expand Up @@ -4,7 +4,7 @@ typesetopts = "-interaction=batchmode -shell-escape -halt-on-error"
checkopts = "-interaction=batchmode -shell-escape -halt-on-error"
tagfiles = {"build.lua", "ffcode.dtx"}
dynamicfiles = {"_minted-*"}
checkengines = {"pdftex"}
checkengines = {"pdftex", "luatex", "xetex"}

uploadconfig = {
pkg = "ffcode",
Expand Down
179 changes: 54 additions & 125 deletions ffcode.dtx
Expand Up @@ -63,6 +63,7 @@
\usepackage{amsmath}
\usepackage{multicol}
\usepackage{xcolor}
\usepackage[dtx,runs=2]{docshots}
\PageIndex
\EnableCrossrefs
\CodelineIndex
Expand All @@ -87,55 +88,25 @@
% and make sure it looks nice. Install it from CTAN and then
% use like this (pay attention to |\ff| command
% and |ffcode| environment):
% \begin{multicols}{2}
% \setlength{\parskip}{0pt}
% \raggedcolumns
%\iffalse
%<*verb>
%\fi
\begin{verbatim}
\documentclass{article}
\usepackage{ffcode}
\begin{document}
The function \ff{fibo()}
is recursive:
\begin{ffcode}
int fibo(int n) {
if (n < 2) {
return n; |$\label{ln:ret}$|
}
return fibo(n-1)+fibo(n-2);
}
\end{ffcode}
The line no.~\ref{ln:ret}
terminates it.
\end{document}
\end{verbatim}
%\iffalse
%</verb>
%\fi
%
% \columnbreak
%
% The function \ff{fibo()} is recursive:
%
%\iffalse
%<*verb>
%\fi
\begin{ffcode}
int fibo(int n) {
if (n < 2) {
return n; |$\label{ln:ret}$|
}
return fibo(n-1)+fibo(n-2);
}
\end{ffcode}
%\iffalse
%</verb>
%\fi
%
% The line no.~\ref{ln:ret} terminates it.
% \end{multicols}
% \begin{docshot}
% \documentclass{article}
% \usepackage{ffcode}
% \pagestyle{empty}
% \begin{document}
% The function \ff{fibo()}
% is recursive:
% \begin{ffcode}
% int fibo(int n) {
% if (n < 2) {
% return n; |$\label{ln:ret}$|
% }
% return fibo(n-1)+fibo(n-2);
% }
% \end{ffcode}
% The line no.~\ref{ln:ret}
% terminates it.
% \end{document}
% \end{docshot}

% \section{Package Options}

Expand Down Expand Up @@ -174,86 +145,40 @@ int fibo(int n) {

% The command |\ff| behaves differently in math mode --- it doesn't
% add gray frames:
% \begin{multicols}{2}
% \setlength{\parskip}{0pt}
% \raggedcolumns
%\iffalse
%<*verb>
%\fi
\begin{verbatim}
\documentclass{article}
\usepackage{ffcode}
\begin{document}
\begin{equation}
x = \int_\ff{home}^N f(x).
\end{equation}
\end{document}
\end{verbatim}
%\iffalse
%</verb>
%\fi
%
% \columnbreak
%
%\iffalse
%<*verb>
%\fi
% \begin{equation}
% \begin{docshot}
% \documentclass{article}
% \usepackage{ffcode}
% \usepackage{mathtools}
% \pagestyle{empty}
% \begin{document}
% \begin{equation*}
% x = \int_\ff{home}^N f(x).
% \end{equation}
%\iffalse
%</verb>
%\fi
% \end{multicols}
% \end{equation*}
% \end{document}
% \end{docshot}

% \section{Line Highlighting}

% You can highlight some lines in your |ffcode| environment,
% or can use any other additional configuration parameters from
% |minted| package:

% \begin{multicols}{2}
% \setlength{\parskip}{0pt}
% \raggedcolumns
%\iffalse
%<*verb>
%\fi
\begin{verbatim}
\documentclass{article}
\usepackage{ffcode}
\begin{document}
\begin{ffcode*}
{highlightlines={1,4-5}}
while (true) {
print("Hello!")
print("Enter your name:")
scan(x)
print("You name is " + x)
}
\end{ffcode*}
\end{document}
\end{verbatim}
%\iffalse
%</verb>
%\fi
%
% \columnbreak
%
%\iffalse
%<*verb>
%\fi
\begin{ffcode*}{highlightlines={7,10-11}}
while (true) {
print("Hello!")
print("Enter your name:")
scan(x)
print("You name is " + x)
}
\end{ffcode*}
%\iffalse
%</verb>
%\fi
% \end{multicols}
% \begin{docshot}
% \documentclass{article}
% \usepackage[paperwidth=3in]{geometry}
% \usepackage{ffcode}
% \pagestyle{empty}
% \begin{document}
% \begin{ffcode*}
% {highlightlines={1,4-5}}
% while (true) {
% print("Hello!")
% print("Enter your name:")
% scan(x)
% print("You name is " + x)
% }
% \end{ffcode*}
% \end{document}
% \end{docshot}

% Using this second argument of |ffcode*| (with the trailing asterisk),
% you can provide any other options from |minted| package to the
Expand All @@ -262,8 +187,7 @@ while (true) {
% \StopEventually{}

% \section{Implementation}

% \changes{v0.2.0}{2021/07/10}{Initial version}
% \changes{v0.1.0}{2021/06/10}{Initial version}

% First, we parse package options:
% \begin{macrocode}
Expand All @@ -272,10 +196,14 @@ while (true) {
\DeclareOptionX{nopygments}{\PassOptionsToPackage{draft=true}{minted}}
\newif\ifff@noframes
\DeclareOptionX{noframes}{\ff@noframestrue}
% \changes{v0.4.0}{2022/01/09}{Package option "nobars" added.}
\newif\ifff@nobars
\DeclareOptionX{nobars}{\ff@nobarstrue}
% \changes{v0.2.0}{2021/06/13}{Package options "nonumbers"
% and "noframes" added.}
\newif\ifff@nonumbers
\DeclareOptionX{nonumbers}{\ff@nonumberstrue}
% \changes{v0.3.0}{2021/09/07}{Package option "nocn" added.}
\newif\ifff@nocn
\DeclareOptionX{nocn}{\ff@nocntrue}
\ProcessOptionsX\relax
Expand Down Expand Up @@ -333,10 +261,11 @@ while (true) {

% \begin{macro}{\ff@print}
% Then, we define supplementary commands |\ff@print| and |\ff@printx|:
% \changes{v0.5.1}{2022/10/39}{Now, the command "ff" ignores italic and bold and always prints "texttt" as it should be.}
% \begin{macrocode}
\makeatletter
\newcommand\ff@print{\begingroup\obeyspaces\ff@printx}
\newcommand\ff@printx[1]{\texttt{#1}\endgroup}
\newcommand\ff@printx[1]{\textnormal{\texttt{#1}}\endgroup}
\makeatother
% \end{macrocode}
% \end{macro}
Expand Down
16 changes: 16 additions & 0 deletions testfiles/simple.luatex.tlg
@@ -0,0 +1,16 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
runsystem(pygmentize -S bw -f latex -P commandprefix=PYG > _minted-simple-lua/bw
.pygstyle)...executed
(_minted-simple-lua/bw.pygstyle)
runsystem(pygmentize -l text -f latex -P commandprefix=PYG -F tokenmerge -P stri
pnl=False -P "escapeinside=||" -P mathescape=True -o _minted-simple-lua/677FC047
998CC2207A0E8277AD9968455692097DB28EF3AEF3DCEC2A69D71E30.pygtex simple.pyg)...ex
ecuted
(_minted-simple-lua/677FC047998CC2207A0E8277AD9968455692097DB28EF3AEF3DCEC2A69D71E30.pygtex
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <7> on input line ....
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line ....
)
LaTeX Warning: Reference `ln:ret' on page 1 undefined on input line ....
3 changes: 3 additions & 0 deletions testfiles/simple.lvt
@@ -1,5 +1,8 @@
\input{regression-test.tex}
\documentclass{article}
\usepackage{ifluatex}
\usepackage{ifxetex}
\usepackage[cachedir=_minted-\jobname\ifxetex-xe\else\ifluatex-lua\fi\fi]{minted}
\usepackage[nocn,nonumbers,noframes]{ffcode}
\begin{document}
\START
Expand Down
13 changes: 13 additions & 0 deletions testfiles/simple.xetex.tlg
@@ -0,0 +1,13 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
runsystem(pygmentize -S bw -f latex -P commandprefix=PYG > _minted-simple-xe/bw.pygstyle)...executed.
(_minted-simple-xe/bw.pygstyle)
runsystem(pygmentize -l text -f latex -P commandprefix=PYG -F tokenmerge -P stripnl=False -P "escapeinside=||" -P mathescape=True -o _minted-simple-xe/677FC047998CC2207A0E8277AD9968455692097DB28EF3AEF3DCEC2A69D71E30.pygtex simple.pyg)...
executed.
(_minted-simple-xe/677FC047998CC2207A0E8277AD9968455692097DB28EF3AEF3DCEC2A69D71E30.pygtex
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <7> on input line ....
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line ....
)
LaTeX Warning: Reference `ln:ret' on page 1 undefined on input line ....
11 changes: 11 additions & 0 deletions testfiles/without-bars.luatex.tlg
@@ -0,0 +1,11 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
runsystem(pygmentize -S bw -f latex -P commandprefix=PYG > _minted-without-bars-
lua/bw.pygstyle)...executed
(_minted-without-bars-lua/bw.pygstyle)
runsystem(pygmentize -l text -f latex -P commandprefix=PYG -F tokenmerge -P stri
pnl=False -P "escapeinside=||" -P mathescape=True -o _minted-without-bars-lua/74
6308829575E17C3331BBCB00C0898BBD956004AB40852B66625BDC789905E4.pygtex without-ba
rs.pyg)...executed
(_minted-without-bars-lua/746308829575E17C3331BBCB00C0898BBD956004AB40852B66625BDC789905E4.pygtex
LaTeX Font Info: Trying to load font information for TS1+lmtt on input line ....
3 changes: 3 additions & 0 deletions testfiles/without-bars.lvt
@@ -1,5 +1,8 @@
\input{regression-test.tex}
\documentclass{article}
\usepackage{ifluatex}
\usepackage{ifxetex}
\usepackage[cachedir=_minted-\jobname\ifxetex-xe\else\ifluatex-lua\fi\fi]{minted}
\usepackage[nobars]{ffcode}
\begin{document}
\START
Expand Down
7 changes: 7 additions & 0 deletions testfiles/without-bars.xetex.tlg
@@ -0,0 +1,7 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
runsystem(pygmentize -S bw -f latex -P commandprefix=PYG > _minted-without-bars-xe/bw.pygstyle)...executed.
(_minted-without-bars-xe/bw.pygstyle)
runsystem(pygmentize -l text -f latex -P commandprefix=PYG -F tokenmerge -P stripnl=False -P "escapeinside=||" -P mathescape=True -o _minted-without-bars-xe/746308829575E17C3331BBCB00C0898BBD956004AB40852B66625BDC789905E4.pygtex without-bars.pyg)...executed.
(_minted-without-bars-xe/746308829575E17C3331BBCB00C0898BBD956004AB40852B66625BDC789905E4.pygtex
LaTeX Font Info: Trying to load font information for TS1+lmtt on input line ....
3 changes: 3 additions & 0 deletions testfiles/without-pygments.luatex.tlg
@@ -0,0 +1,3 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
LaTeX Font Info: Trying to load font information for TS1+lmtt on input line ....
1 change: 0 additions & 1 deletion testfiles/without-pygments.lvt
Expand Up @@ -4,7 +4,6 @@
\begin{document}
\START

\begin{document}
Here is some code:
\begin{ffcode}
Hello, world!
Expand Down
9 changes: 0 additions & 9 deletions testfiles/without-pygments.tlg
@@ -1,12 +1,3 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
! LaTeX Error: Can be used only in preamble.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l. ...\begin{document}
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
LaTeX Font Info: Trying to load font information for TS1+cmtt on input line ....
Bad grouping: 2!
3 changes: 3 additions & 0 deletions testfiles/without-pygments.xetex.tlg
@@ -0,0 +1,3 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
LaTeX Font Info: Trying to load font information for TS1+lmtt on input line ....

0 comments on commit e89a5fb

Please sign in to comment.