Skip to content

Commit

Permalink
l3doc: add an l3packages/l3doc subdir
Browse files Browse the repository at this point in the history
I haven't moved over the .dtx file from l3kernel but I'm not against the idea.

The main reason was to allow for some standalone test files and "example" files for testing purposes.
  • Loading branch information
wspr committed Nov 12, 2017
1 parent 56d5a48 commit b79aa4e
Show file tree
Hide file tree
Showing 5 changed files with 260 additions and 0 deletions.
26 changes: 26 additions & 0 deletions l3packages/l3doc/build.lua
@@ -0,0 +1,26 @@
#!/usr/bin/env texlua

-- Build script for LaTeX3 "l3doc" files

-- Identify the bundle and module: the module may be empty in the case where
-- there is no subdivision
bundle = "l3packages"
module = "l3doc"

-- Location of main directory: use Unix-style path separators
maindir = "../.."

-- Load the common build code
dofile(maindir .. "/build-config.lua")

installfiles = "*.cls"

checkdeps = {maindir .. "/l3packages/xparse"}

checkruns = 2
checksearch = true
recordstatus = true

-- Find and run the build system
kpse.set_program_name("kpsewhich")
dofile(kpse.lookup("l3build.lua"))
113 changes: 113 additions & 0 deletions l3packages/l3doc/examples/basics.dtx
@@ -0,0 +1,113 @@

% \iffalse
%<*driver>
\documentclass[full]{l3doc}
\begin{document}
\DocInput{\jobname.dtx}
\clearpage
\PrintIndex
\end{document}
%</driver>
% \fi
%
% \title{Example l3doc document}
% \author{The \LaTeX3 Project}
%
% \maketitle
%
% \begin{documentation}
%
% \section{Documentation}
%
% \begin{function}{\ProcessKeysOptions}
% \begin{syntax}
% \cs{ProcessKeysOptions} \Arg{module}
% \end{syntax}
% This function is used to check the current
% option list against the keys defined for \Arg{module}. Global (class)
% options and local (package) options are checked when this function
% is called in a package. Each option which does match a key name is
% then used to attempt to set the appropriate key using
% \cs{keys_set:nn}. For example, the option defined earlier would be
% processed by the line
% \begin{verbatim}
% \ProcessKeysOptions { module }
% \end{verbatim}
% \end{function}
%
% \begin{function}{\l_@@_latexe_options_clist}
% An internal variable.
% Here is a reference to \cs{bool_set_false:N}.
% \end{function}
%
%\end{documentation}
%
% \clearpage
%
%\begin{implementation}
%
%\section{Implementation}
%
% \begin{macrocode}
%<*package>
% \end{macrocode}
%
% \begin{macrocode}
\ProvidesExplPackage{l3keys2e}{2017/09/18}{}
{LaTeX2e option processing using LaTeX3 keys}
% \end{macrocode}
%
% Non-standard variants.
% \begin{macrocode}
\cs_generate_variant:Nn \clist_put_right:Nn { Nv }
\cs_generate_variant:Nn \keys_if_exist:nnT { nx }
\cs_generate_variant:Nn \keys_if_exist:nnTF { nx }
% \end{macrocode}
%
% \begin{macro}{\l_@@_latexe_options_clist}
% A single list is used for all options, into which they are collected
% before processing.
% \begin{macrocode}
\clist_new:N \l_@@_latexe_options_clist
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\l_@@_process_class_bool}
% A flag to indicate that class options should be processed for
% packages.
% \begin{macrocode}
\bool_new:N \l_@@_process_class_bool
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ProcessKeysOptions}
% \begin{macro}{\ProcessKeysPackageOptions}
% The user macro are simply wrappers around the internal process. In
% contrast to other similar packages, the module name is always required
% here.
% \begin{macrocode}
\cs_new_protected:Npn \ProcessKeysOptions #1
{
\bool_set_true:N \l_@@_process_class_bool
\@@_latexe_options:n {#1}
}
\cs_new_protected:Npn \ProcessKeysPackageOptions #1
{
\bool_set_false:N \l_@@_process_class_bool
\@@_latexe_options:n {#1}
}
\@onlypreamble \ProcessKeysOptions
\@onlypreamble \ProcessKeysPackageOptions
% \end{macrocode}
%\end{macro}
%\end{macro}
%
%
% \begin{macrocode}
%</package>
% \end{macrocode}
%
% \end{implementation}
%
%
\endinput
9 changes: 9 additions & 0 deletions l3packages/l3doc/examples/build.lua
@@ -0,0 +1,9 @@
#!/usr/bin/env texlua

-- Build script for LaTeX3 "l3doc" example files

module = "l3doc-examples"

-- Find and run the build system
kpse.set_program_name("kpsewhich")
dofile(kpse.lookup("l3build.lua"))
107 changes: 107 additions & 0 deletions l3packages/l3doc/testfiles/basics.lvt
@@ -0,0 +1,107 @@

% \iffalse
%<*driver>
\input{regression-test}
\START\OMIT
\documentclass[full]{l3doc}
\begin{document}
\DocInput{\jobname.lvt}
\PrintIndex
\TIMO
\TYPE{Test loading and basic functionality. No logging output expected.}
\END
\end{document}
%</driver>
% \fi
%
% \title{Example l3doc document}
% \author{The \LaTeX3 Project}
%
% \maketitle
%
% \begin{documentation}
%
% \section{Documentation}
%
% \begin{function}{\ProcessKeysOptions}
% \begin{syntax}
% \cs{ProcessKeysOptions} \Arg{module}
% \end{syntax}
% The \cs{ProcessKeysOptions} function is used to check the current
% option list against the keys defined for \Arg{module}. Global (class)
% options and local (package) options are checked when this function
% is called in a package. Each option which does match a key name is
% then used to attempt to set the appropriate key using
% \cs{keys_set:nn}. For example, the option defined earlier would be
% processed by the line
% \begin{verbatim}
% \ProcessKeysOptions { module }
% \end{verbatim}
% \end{function}
%
%\end{documentation}
%
%\begin{implementation}
%
%\section{Implementation}
%
% \begin{macrocode}
%<*package>
% \end{macrocode}
%
% \begin{macrocode}
\ProvidesExplPackage{l3keys2e}{2017/09/18}{}
{LaTeX2e option processing using LaTeX3 keys}
% \end{macrocode}
%
% Non-standard variants.
% \begin{macrocode}
\cs_generate_variant:Nn \clist_put_right:Nn { Nv }
\cs_generate_variant:Nn \keys_if_exist:nnT { nx }
\cs_generate_variant:Nn \keys_if_exist:nnTF { nx }
% \end{macrocode}
%
% \begin{macro}{\l_@@_latexe_options_clist}
% A single list is used for all options, into which they are collected
% before processing.
% \begin{macrocode}
\clist_new:N \l_@@_latexe_options_clist
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\l_@@_process_class_bool}
% A flag to indicate that class options should be processed for
% packages.
% \begin{macrocode}
\bool_new:N \l_@@_process_class_bool
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ProcessKeysOptions}
% \begin{macro}{\ProcessKeysPackageOptions}
% The user macro are simply wrappers around the internal process. In
% contrast to other similar packages, the module name is always required
% here.
% \begin{macrocode}
\cs_new_protected:Npn \ProcessKeysOptions #1
{
\bool_set_true:N \l_@@_process_class_bool
\@@_latexe_options:n {#1}
}
\cs_new_protected:Npn \ProcessKeysPackageOptions #1
{
\bool_set_false:N \l_@@_process_class_bool
\@@_latexe_options:n {#1}
}
\@onlypreamble \ProcessKeysOptions
\@onlypreamble \ProcessKeysPackageOptions
% \end{macrocode}
%\end{macro}
%\end{macro}
%
%
% \begin{macrocode}
%</package>
% \end{macrocode}
%
% \end{implementation}
5 changes: 5 additions & 0 deletions l3packages/l3doc/testfiles/basics.tlg
@@ -0,0 +1,5 @@
This is a generated file for the LaTeX (2e + expl3) validation system.
Don't change this file in any respect.
Test loading and basic functionality. No logging output expected.
***************
Compilation 1 of test file completed with exit status 0Compilation 2 of test file completed with exit status 0

4 comments on commit b79aa4e

@wspr
Copy link
Contributor Author

@wspr wspr commented on b79aa4e Nov 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does anyone have any thoughts about moving l3doc into a l3packages subdirectory completely?

I think it's been a part of l3kernel so long that we can't "unrelease" it. But having a separate package might send the wrong message about its general use. Although, maybe we just need more of an incentive to develop it further.

It would also be nice to clean up the l3kernel directory a little by getting l3doc out of there!

@FrankMittelbach
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is indeed a big danger that even more people consider this a general use class. On the other hand that's already the case more or less.

Are we prepared to do more work on it in the near future? If not it might be better to leave where it is for the moment.

@josephwright
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still have the entire issue about classes and LaTeX3: ideally they'd be about design, with all new functionality in a package (and then we have 'families' of classes ...). Probably leave where it is for the moment, but perhaps look to work out l3doc2 to address this properly? (The aim being to get the 'new' class to the point where it can be swapped in.)

@wspr
Copy link
Contributor Author

@wspr wspr commented on b79aa4e Nov 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you know I prefer to program iteratively rather than come up with drop-in replacements :) But in the case of l3doc there's probably a good argument for a complete re-write.

I think we agree to leave it all as-is for now, and if we get around to a major improvement or re-write bring it out as its own CTAN package.

Please sign in to comment.