Skip to content

Commit

Permalink
Typeset TF of internal conditionals in current color
Browse files Browse the repository at this point in the history
Fixes #730
  • Loading branch information
muzimuzhi authored and josephwright committed Feb 27, 2024
1 parent 46c6191 commit 27ae326
Show file tree
Hide file tree
Showing 5 changed files with 1,440 additions and 255 deletions.
3 changes: 3 additions & 0 deletions l3kernel/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ this project uses date-based 'snapshot' version identifiers.

## [Unreleased]

### Fixed
- Typeset `TF` of internal conditionals in current color (issue \#730)

## [2024-02-20]

### Changed
Expand Down
19 changes: 11 additions & 8 deletions l3kernel/l3doc.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -2127,7 +2127,6 @@ and all files in that bundle must be distributed together.
{ \hyperlink { explTF } }
{ \mbox }
{
\color{black}
\itshape TF
\makebox[0pt][r]
{
Expand Down Expand Up @@ -3206,18 +3205,22 @@ and all files in that bundle must be distributed together.
\tl_set:Nn \l_@@_tmpa_tl {#1}
\tl_replace_all:NnV \l_@@_tmpa_tl
{ ~ } \c_catcode_other_space_tl
\@@_macroname_prefix:o \l_@@_tmpa_tl
\@@_macroname_suffix:N #2
\@@_print_macroname_aux:on
\l_@@_tmpa_tl { \bool_if:NT #2 { \@@_typeset_TF: } }
}
}
\cs_new_protected:Npn \@@_macroname_prefix:n #1
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_print_macroname_aux:nn}
% |#1| is prefix, |#2| is optional |TF| suffix.
% \begin{macrocode}
\cs_new_protected:Npn \@@_print_macroname_aux:nn #1#2
{
\@@_if_macro_internal:nTF {#1}
{ \@@_typeset_aux:n {#1} } {#1}
{ \@@_typeset_aux:n { #1 #2 } } { #1 #2 }
}
\cs_generate_variant:Nn \@@_macroname_prefix:n { o }
\cs_new_protected:Npn \@@_macroname_suffix:N #1
{ \bool_if:NTF #1 { \@@_typeset_TF: } { } }
\cs_generate_variant:Nn \@@_print_macroname_aux:nn { o }
% \end{macrocode}
% \end{macro}
%
Expand Down
20 changes: 0 additions & 20 deletions l3kernel/testfiles-l3doc/github-1398.tlg
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ Completed box being shipped out [1]
............\T1/lmtt/m/n/9 N
............\T1/lmtt/m/n/9 N
............\hbox(5.39143+1.9999)x9.44998
.............\pdfcolorstack 0 push {0 g 0 G}
.............\T1/lmtt/m/it/9 T
.............\T1/lmtt/m/it/9 F
.............\hbox(5.39143+1.9999)x0.0, glue set - 8.50493fil
Expand All @@ -127,7 +126,6 @@ Completed box being shipped out [1]
...............\kern1.19994
...............\rule(0.39998+0.0)x*
..............\mathoff
............\pdfcolorstack 0 pop
............\glue 0.0 plus 1.0fill
...........\glue(\tabskip) 0.0
...........\hbox(7.69997+3.30003)x0.0
Expand Down Expand Up @@ -254,7 +252,6 @@ Completed box being shipped out [1]
............\T1/lmtt/m/n/9 N
............\T1/lmtt/m/n/9 N
............\hbox(5.39143+1.9999)x9.44998
.............\pdfcolorstack 0 push {0 g 0 G}
.............\T1/lmtt/m/it/9 T
.............\T1/lmtt/m/it/9 F
.............\hbox(5.39143+1.9999)x0.0, glue set - 8.50493fil
Expand All @@ -267,7 +264,6 @@ Completed box being shipped out [1]
...............\kern1.19994
...............\rule(0.39998+0.0)x*
..............\mathoff
............\pdfcolorstack 0 pop
............\glue 0.0 plus 1.0fill
...........\glue(\tabskip) 0.0
...........\hbox(7.69997+3.30003)x0.0
Expand All @@ -293,7 +289,6 @@ Completed box being shipped out [1]
............\T1/lmtt/m/n/9 c
............\T1/lmtt/m/n/9 N
............\hbox(5.39143+1.9999)x9.44998
.............\pdfcolorstack 0 push {0 g 0 G}
.............\T1/lmtt/m/it/9 T
.............\T1/lmtt/m/it/9 F
.............\hbox(5.39143+1.9999)x0.0, glue set - 8.50493fil
Expand All @@ -306,7 +301,6 @@ Completed box being shipped out [1]
...............\kern1.19994
...............\rule(0.39998+0.0)x*
..............\mathoff
............\pdfcolorstack 0 pop
............\glue 0.0 plus 1.0fill
...........\glue(\tabskip) 0.0
...........\hbox(7.69997+3.30003)x0.0
Expand Down Expand Up @@ -445,7 +439,6 @@ Completed box being shipped out [1]
............\T1/lmtt/m/n/9 N
............\T1/lmtt/m/n/9 N
............\hbox(5.39143+1.9999)x9.44998
.............\pdfcolorstack 0 push {0 g 0 G}
.............\T1/lmtt/m/it/9 T
.............\T1/lmtt/m/it/9 F
.............\hbox(5.39143+1.9999)x0.0, glue set - 8.50493fil
Expand All @@ -458,7 +451,6 @@ Completed box being shipped out [1]
...............\kern1.19994
...............\rule(0.39998+0.0)x*
..............\mathoff
............\pdfcolorstack 0 pop
............\glue 0.0 plus 1.0fill
...........\glue(\tabskip) 0.0
...........\hbox(7.69997+3.30003)x0.0
Expand Down Expand Up @@ -496,7 +488,6 @@ Completed box being shipped out [1]
............\T1/lmr/m/n/9 )
............\kern 0.0
............\hbox(5.39143+1.9999)x9.44998
.............\pdfcolorstack 0 push {0 g 0 G}
.............\T1/lmtt/m/it/9 T
.............\T1/lmtt/m/it/9 F
.............\hbox(5.39143+1.9999)x0.0, glue set - 8.50493fil
Expand All @@ -509,7 +500,6 @@ Completed box being shipped out [1]
...............\kern1.19994
...............\rule(0.39998+0.0)x*
..............\mathoff
............\pdfcolorstack 0 pop
............\glue 0.0 plus 1.0fill
...........\glue(\tabskip) 0.0
...........\hbox(7.69997+3.30003)x0.0
Expand Down Expand Up @@ -586,7 +576,6 @@ Completed box being shipped out [1]
............\T1/lmtt/m/n/9 N
............\T1/lmtt/m/n/9 N
............\hbox(5.39143+1.9999)x9.44998
.............\pdfcolorstack 0 push {0 g 0 G}
.............\T1/lmtt/m/it/9 T
.............\T1/lmtt/m/it/9 F
.............\hbox(5.39143+1.9999)x0.0, glue set - 8.50493fil
Expand All @@ -599,7 +588,6 @@ Completed box being shipped out [1]
...............\kern1.19994
...............\rule(0.39998+0.0)x*
..............\mathoff
............\pdfcolorstack 0 pop
............\glue 0.0 plus 1.0fill
...........\glue(\tabskip) 0.0
...........\hbox(7.69997+3.30003)x0.0
Expand Down Expand Up @@ -678,7 +666,6 @@ Completed box being shipped out [1]
............\T1/lmtt/m/n/9 N
............\T1/lmtt/m/n/9 N
............\hbox(5.39143+1.9999)x9.44998
.............\pdfcolorstack 0 push {0 g 0 G}
.............\T1/lmtt/m/it/9 T
.............\T1/lmtt/m/it/9 F
.............\hbox(5.39143+1.9999)x0.0, glue set - 8.50493fil
Expand All @@ -691,7 +678,6 @@ Completed box being shipped out [1]
...............\kern1.19994
...............\rule(0.39998+0.0)x*
..............\mathoff
............\pdfcolorstack 0 pop
............\glue 0.0 plus 1.0fill
...........\glue(\tabskip) 0.0
...........\hbox(7.69997+3.30003)x0.0
Expand All @@ -717,7 +703,6 @@ Completed box being shipped out [1]
............\T1/lmtt/m/n/9 c
............\T1/lmtt/m/n/9 N
............\hbox(5.39143+1.9999)x9.44998
.............\pdfcolorstack 0 push {0 g 0 G}
.............\T1/lmtt/m/it/9 T
.............\T1/lmtt/m/it/9 F
.............\hbox(5.39143+1.9999)x0.0, glue set - 8.50493fil
Expand All @@ -730,7 +715,6 @@ Completed box being shipped out [1]
...............\kern1.19994
...............\rule(0.39998+0.0)x*
..............\mathoff
............\pdfcolorstack 0 pop
............\glue 0.0 plus 1.0fill
...........\glue(\tabskip) 0.0
...........\hbox(7.69997+3.30003)x0.0
Expand Down Expand Up @@ -809,7 +793,6 @@ Completed box being shipped out [1]
............\T1/lmtt/m/n/9 N
............\T1/lmtt/m/n/9 N
............\hbox(5.39143+1.9999)x9.44998
.............\pdfcolorstack 0 push {0 g 0 G}
.............\T1/lmtt/m/it/9 T
.............\T1/lmtt/m/it/9 F
.............\hbox(5.39143+1.9999)x0.0, glue set - 8.50493fil
Expand All @@ -822,7 +805,6 @@ Completed box being shipped out [1]
...............\kern1.19994
...............\rule(0.39998+0.0)x*
..............\mathoff
............\pdfcolorstack 0 pop
............\glue 0.0 plus 1.0fill
...........\glue(\tabskip) 0.0
...........\hbox(7.69997+3.30003)x0.0
Expand Down Expand Up @@ -860,7 +842,6 @@ Completed box being shipped out [1]
............\T1/lmr/m/n/9 )
............\kern 0.0
............\hbox(5.39143+1.9999)x9.44998
.............\pdfcolorstack 0 push {0 g 0 G}
.............\T1/lmtt/m/it/9 T
.............\T1/lmtt/m/it/9 F
.............\hbox(5.39143+1.9999)x0.0, glue set - 8.50493fil
Expand All @@ -873,7 +854,6 @@ Completed box being shipped out [1]
...............\kern1.19994
...............\rule(0.39998+0.0)x*
..............\mathoff
............\pdfcolorstack 0 pop
............\glue 0.0 plus 1.0fill
...........\glue(\tabskip) 0.0
...........\hbox(7.69997+3.30003)x0.0
Expand Down
19 changes: 19 additions & 0 deletions l3kernel/testfiles-l3doc/test.lvt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
\documentclass{l3doc}
\CodelineIndex
\begin{document}
\ExplSyntaxOn
\tl_gset:Nn \g__codedoc_module_name_tl {foo}
\ExplSyntaxOff

\START
\begin{function}{\foo}
This is a test.
Expand All @@ -19,6 +23,10 @@ And \cs{foo} again.
Argument \meta{arg}.
\end{function}

\begin{function}[TF]{\foo_if:n}
doc
\end{function}

\begin{macro}{\foo}
\begin{macrocode}
test
Expand All @@ -28,6 +36,17 @@ test
% \end{macrocode}
\cs{bar}
\end{macro}

% #730, https://github.com/latex3/latex3/issues/730
\begin{macro}[TF]{\foo_if:n, \__foo_if:n}
\begin{macrocode}
\prg_new_conditional:Nnn \foo_if:n { p , T , F , TF }
{ \prg_return_true: }
\prg_new_conditional:Nnn \__foo_if:n { p , T , F , TF }
{ \prg_return_true: }
% \end{macrocode}
\end{macro}

\PrintIndex
\showoutput
\clearpage
Expand Down

0 comments on commit 27ae326

Please sign in to comment.