diff options
author | Norbert Preining <norbert@preining.info> | 2024-02-13 03:01:44 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-02-13 03:01:44 +0000 |
commit | ff59efb1f42e705d74a6d50a1f8dbd7988ccf380 (patch) | |
tree | 5da1e898aa276a82243afc394d373a15170d43d0 /macros | |
parent | 275a181f003d2af5b7d9ca34f2b15f6511b3ea29 (diff) |
CTAN sync 202402130301
Diffstat (limited to 'macros')
21 files changed, 200 insertions, 122 deletions
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index 8124d21bad..16f5b792c0 100644 --- a/macros/latex/contrib/easybook/easybook.dtx +++ b/macros/latex/contrib/easybook/easybook.dtx @@ -15,7 +15,7 @@ %<*class> \NeedsTeXFormat{LaTeX2e}[2021/11/15] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2024/02/11}{2024ab} +\ProvidesExplClass{easybook}{2024/02/12}{2024ac} {Easily typesetting Chinese theses or books} \bool_set_false:N \l__eb_compile_draft_bool @@ -297,7 +297,7 @@ %<*package> \NeedsTeXFormat{LaTeX2e}[2021/11/15] \RequirePackage{l3keys2e,etoolbox} -\ProvidesExplPackage{easybase}{2024/02/11}{2024ab} +\ProvidesExplPackage{easybase}{2024/02/12}{2024ac} {Easily typesetting Chinese theses or books} \cs_generate_variant:Nn \dim_set:Nn { NV } @@ -334,21 +334,6 @@ } \cs_new_protected:Npn \eb_at_end_preamble:n { \BeforeBeginEnvironment{document} } -\cs_new_protected:Npn \eb_match_load_package:n #1 - { - \regex_match:nnTF { \[ } {#1} - { - \seq_set_split:Nnn \l_tmpa_seq { [ } {#1} - \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl - \seq_pop_right:NN \l_tmpa_seq \l_tmpb_tl - \IfFileExists{\l_tmpa_tl.sty} - { - \exp_last_unbraced:Nx \RequirePackage - { [\l_tmpb_tl }{\l_tmpa_tl} - }{} - } - { \IfFileExists{#1.sty}{\RequirePackage{#1}}{} } - } \cs_new_protected:Npn \eb_if_package_loaded:nnF #1#2#3 { \IfPackageLoadedTF{#1} @@ -376,13 +361,26 @@ { \eb@usepackage@save{##1}[#3] } } } -\NewDocumentCommand{\LoadPackage}{O{}m} +\cs_new_protected:Npn \eb_match_load_package:n #1 { - \seq_set_split:Nnn \l_tmpb_seq { + } {#2} - \int_compare:nNnT { \seq_count:N \l_tmpb_seq } = { 1 } - { \PassOptionsToPackage{#1}{#2} } - \seq_map_function:NN - \l_tmpb_seq \eb_match_load_package:n + \regex_match:nnTF { \[.*\] } {#1} + { \eb@case@load@package #1 } + { \eb@case@load@package{#1} } + } +\NewDocumentCommand{\eb@case@load@package}{omO{}} + { + \IfNoValueTF{#1} + {\IfFileExists{#2.sty}{\RequirePackage{#2}[#3]}{}} + {\IfFileExists{#2.sty}{\RequirePackage[#1]{#2}[#3]}{}} + } +\cs_new_protected:Npn \LoadPackage #1 + { + \int_compare:nTF { \clist_count:n {#1} <= 1 } + { \RequirePackage } + { + \eb_seq_map_inline:nn {#1} + { \eb_match_load_package:n {##1} } + } } \bool_set_true:N \l__eb_class_mode_book_bool @@ -485,14 +483,14 @@ \LoadPackage { - spbmark[text]+ - ulem[normalem]+ - enumitem[shortlabels,inline]+ - chemformula+siunitx+pifont+ - geometry+marginnote+ - pdfpages+multicol+ - fancyhdr+titletoc+caption+ - tabularray+ + [text]{spbmark}, + [normalem]{ulem}, + [{shortlabels,inline}]{enumitem}, + chemformula,siunitx,pifont, + geometry,marginnote, + pdfpages,multicol, + fancyhdr,titletoc,caption, + tabularray, listings } \cs_new_protected:Npn \eb_package_date_check:nn #1#2 @@ -605,7 +603,7 @@ {\tl_set:cn { eb@mark@#1@label } {##1##2}} \cs_new_protected:cpn { eb_mark_#1_name_parse:n } ##1 { - \regex_match:nnTF { \[ } {##1} + \regex_match:nnTF { \[.*\] } {##1} { \use:c { eb@mark@#1@label@layout }##1 } { \use:c { eb@mark@#1@label@layout }{##1} } } @@ -2343,7 +2341,7 @@ } %</package> %<*tcolorbox> -\ProvidesExplFile{eb-tcolorbox.cfg}{2024/02/11}{2024ab} +\ProvidesExplFile{eb-tcolorbox.cfg}{2024/02/12}{2024ac} {Customization of tcolorbox for easybook} \cs_set_protected:Npn \addtotcbstyle #1#2 diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf Binary files differindex 06127742ca..1cb2868c87 100644 --- a/macros/latex/contrib/easybook/easybook.pdf +++ b/macros/latex/contrib/easybook/easybook.pdf diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex index 0d4867eaa7..a1ddad3ca6 100644 --- a/macros/latex/contrib/easybook/easybook.tex +++ b/macros/latex/contrib/easybook/easybook.tex @@ -23,8 +23,8 @@ name = easybook, color-scheme = blue, title = EASYBOOK使用手册, - version = v2024ab, - date = 2024/02/11, + version = v2024ac, + date = 2024/02/12, authors = 瞿毅, info = 简便地排版中文学位论文或书籍, email = toquyi@163.com, @@ -618,10 +618,10 @@ \begin{options}\noitemsep \keyval{headruleskip}{页眉线间距}\Default*{0pt} \keyval{footruleskip}{页脚线间距}\Default*{3.5pt} - \kvsplit{hdivide}{左边距,页面文本宽度,右边距}\default{} + \kvsplit{hdivide}{左边距,版心文本宽度,右边距}\default{} \kvsplit{hmargin}{左边距,右边距}\default{} - \keyval{textheight}{页面文本高度}\default{} - \keychoice{nofoot}{true,\fbox{false}} + \keyval{textheight}{版心文本高度}\default{} + \keychoice{nofoot}{true,\fbox{false}}\default{} \begin{ctexexam} \ebgeoset { @@ -726,7 +726,7 @@ \begin{commands}\noitemsep \command{SetFntSymbsList}[\marg{符号表名}\marg{符号数量}\marg{符号列表}]\default{} \command{UseFntSymbsList}[\marg{符号表名}]\newtag[Chg]% - 这两个命令用于在脚注短编号标记为 \code{s} 自定义符号型时设置符号列表。\cs{SetFntSymbsList} 命令用于定义名为 \meta{符号表名} 的符号列表,\cs{UseFntSymbsList} 命令用于启用已定义的符号列表。默认的脚注符号列表是空的,注意使用符号型脚注时计数器 \code{footnote} 的值仍然是递增的,以及定义新列表时 \meta{符号列表} 的写法和命令顺序: + 这两个命令用于在脚注短编号标记为 \code{s} 自定义符号型时设置符号列表。\cs{SetFntSymbsList} 命令用于定义名为 \meta{符号表名} 的符号列表,\cs{UseFntSymbsList} 命令用于启用已定义的符号列表。默认的脚注符号列表是空的,注意使用符号型标记的脚注时计数器 \code{footnote} 的值仍然递增,以及定义新列表时 \meta{符号列表} 的写法和命令顺序: \begin{ctexexam} \SetFntSymbsList{fancy}{2}{{1}{*}{2}{\P}} \UseFntSymbsList{fancy} @@ -1352,7 +1352,7 @@ \shortversion{v = 1.638,date = 2022/03/04,changes = 增加目录条目样式选项注册命令 \cs{RegisterTocName}。} \shortversion{v = 1.644,date = 2022/03/10,changes = 增加浮动环境目录声明命令 \cs{DeclareFloatList} 配合 \pkg*{caption} 宏包。} \shortversion{v = 1.682,date = 2022/05/01,changes = 将迷你页判断命令 \cs{notminipage} 改为被保护命令兼容 \pkg*{circledtext} 宏包。} - \begin{version}[v = 2024ab,date = 2024/02/11,simple] + \begin{version}[v = 2024ac,date = 2024/02/12,simple] \item 核对依赖宏包的更新改动,优化使用手册的内容细节。 \item 修复图表等浮动环境题注目录中条目标签编号的计数器值显示错误问题。 \item 修复附录命令 \cs{appendix} 的可选参数设置英文目录中条目名字和编号失效的问题。 diff --git a/macros/luatex/latex/gitinfo-lua/README.md b/macros/luatex/latex/gitinfo-lua/README.md index 383cf2df33..1abafbdc06 100644 --- a/macros/luatex/latex/gitinfo-lua/README.md +++ b/macros/luatex/latex/gitinfo-lua/README.md @@ -1,4 +1,5 @@ -# Git LaTeX +# Gitinfo Lua +![CTAN Version](https://img.shields.io/ctan/v/gitinfo-lua) A LaTeX package which provides macros integrated with LuaTeX and the commandline tool `git`. @@ -17,8 +18,8 @@ makeindex -s gind.ist gitinfo-lua.idx lualatex -shell-escape gitinfo-lua.tex ``` -Read [gitinfo-lua.pdf](gitinfo-lua.pdf) for more information about this package. +See the [releases section](https://github.com/Xerdi/gitinfo-lua/releases) for getting the latest manual. ## License This project is licensed under the LPPL version 1.3c and maintained by Erik Nijenhuis. -See [LICENSE.pdf](LICENSE.pdf) for more information. +See [LICENSE.txt](LICENSE.txt) for more information. diff --git a/macros/luatex/latex/gitinfo-lua/doc/git-scenario.sh b/macros/luatex/latex/gitinfo-lua/doc/git-scenario.sh index a3cfd179e9..a3cfd179e9 100644..100755 --- a/macros/luatex/latex/gitinfo-lua/doc/git-scenario.sh +++ b/macros/luatex/latex/gitinfo-lua/doc/git-scenario.sh diff --git a/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.pdf b/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.pdf Binary files differindex ad1db4e0b1..da85914b1b 100644 --- a/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.pdf +++ b/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.pdf diff --git a/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.tex b/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.tex index 1587f72d80..438f235b00 100644 --- a/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.tex +++ b/macros/luatex/latex/gitinfo-lua/doc/gitinfo-lua.tex @@ -17,10 +17,15 @@ % gitinfo-cmd.lua and gitinfo-lua.lua \documentclass{ltxdoc} \usepackage[english]{babel} -\usepackage[titlepage]{gitinfo-lua} +\usepackage[titlepage,authors]{../tex/gitinfo-lua} \usepackage{listings} - +\lstset{ + basicstyle=\ttfamily, + columns=fullflexible, + breaklines=true, + breakatwhitespace=false +} \usepackage{calc} \usepackage{multicol} \usepackage{tabularx} @@ -285,7 +290,7 @@ latexmk -pvc -lualatex -shell-escape main The \meta{csname} takes exactly three arguments, namely, the \meta{current}, \meta{next tag} and \meta{rev spec}. The last iteration gives an empty value for \meta{next tag} and the \meta{rev spec} is identical to \meta{current}. - Afterward tag info get be fetched using the \DescribeMacro{\gittag} \cmd{\gittag}\oarg{format}\marg{csname}\marg{tag}. + Afterward tag info can be fetched using the \DescribeMacro{\gittag} \cmd{\gittag}\oarg{format}\marg{csname}\marg{tag}. This macro takes the same formatting specification as \cmd{\fotgittag}. Beware of using \cmd{\gittag} for the \meta{next tag} parameter in \cmd{\forgittagseq}. diff --git a/macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua.lua b/macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua.lua index 4cb0f0f467..a1c2a6988b 100644 --- a/macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua.lua +++ b/macros/luatex/latex/gitinfo-lua/scripts/gitinfo-lua.lua @@ -23,9 +23,10 @@ end local module = { name = 'gitinfo-lua', info = { - version = 1.0, + version = '1.0.1', --TAGVERSION + date = '2024/02/12', --TAGDATE comment = "Git info Lua — Git integration with LaTeX", - author = "Erik Nijenhuis", + author = "Erik Nijenhuis", license = "free" } } @@ -43,8 +44,8 @@ local api = { ['_'] = '\\_', ['{'] = '\\{', ['}'] = '\\}', - ['~'] = '\\textasciitilde', - ['%^'] = '\\textasciicircum' + ['~'] = '\\textasciitilde ', + ['%^'] = '\\textasciicircum ' } } local mt = { @@ -55,11 +56,11 @@ local gitinfo = {} setmetatable(gitinfo, mt) function api.trim(s) - return (s:gsub("^%s*(.-)%s*$", "%1")) + return s and (s:gsub("^%s*(.-)%s*$", "%1")) or 'nil' end function api:set_date() - local date, err = self.cmd:log('cs', '-1', {'max-count=1'}) + local date, err = self.cmd:log('cs', '-1', { 'max-count=1' }) if date and #date == 1 then local _, _, year, month, day = date[1][1]:find('(%d+)[-/](%d+)[-/](%d+)') tex.year = tonumber(year) @@ -71,7 +72,7 @@ function api:set_date() end function api:escape_str(value) - local buf = string.gsub(value, '\\', '\\textbackslash') + local buf = string.gsub(value, '\\', '\\textbackslash ') for search, replace in pairs(self.escape_chars) do buf = string.gsub(buf, search, replace) end @@ -223,7 +224,7 @@ end function api:cs_commit(csname, rev, format) if token.is_defined(csname) then local tok = token.create(csname) - local log, err = self.cmd:log(format, rev, {'max-count=1'}) + local log, err = self.cmd:log(format, rev, { 'max-count=1' }) if log then if #log == 1 then tex.print(tok) @@ -266,7 +267,7 @@ end function api:tag_info(format_spec, tag, target_dir) local err, info - info, err = self.cmd:for_each_ref(format_spec, 'refs/tags', {'count=1', 'contains=' .. tag}, target_dir) + info, err = self.cmd:for_each_ref(format_spec, 'refs/tags', { 'count=1', 'contains=' .. tag }, target_dir) if info and #info == 1 then return info[1] else @@ -305,7 +306,7 @@ end function api:cs_for_tag(csname, format_spec, target_dir) if token.is_defined(csname) then local tok = token.create(csname) - local tags, err = self.cmd:for_each_ref(format_spec, 'refs/tags', {'sort=-authordate'}, target_dir) + local tags, err = self.cmd:for_each_ref(format_spec, 'refs/tags', { 'sort=-authordate' }, target_dir) if tags then for _, info in ipairs(tags) do tex.print(tok) diff --git a/macros/luatex/latex/gitinfo-lua/tex/gitinfo-lua.sty b/macros/luatex/latex/gitinfo-lua/tex/gitinfo-lua.sty index 405c668901..33fe5066c9 100644 --- a/macros/luatex/latex/gitinfo-lua/tex/gitinfo-lua.sty +++ b/macros/luatex/latex/gitinfo-lua/tex/gitinfo-lua.sty @@ -16,7 +16,7 @@ % This work consists of the files gitinfo-lua.sty gitinfo-lua.pdf % gitinfo-cmd.lua and gitinfo-lua.lua \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{gitinfo-lua}[2023/11/10 Xerdi's Git Package] +\ProvidesPackage{gitinfo-lua}[2024/02/12 1.0.1 Xerdi's Git Package] \RequirePackage{luacode} diff --git a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-deps.bib b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-deps.bib index c5ecf4484c..ac44186259 100644 --- a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-deps.bib +++ b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-deps.bib @@ -1,8 +1,12 @@ -@misc{tiny, - title = {lua-tinyyaml}, - note = {Accessed: 23 January, 2024}, - howpublished = {\url{https://ctan.org/pkg/lua-tinyyaml} and \url{https://github.com/api7/lua-tinyyaml}}, +@manual{lua-tinyyaml, + title = {The lua-tinyyaml package}, + subtitle = {A tiny YAML (subset) parser for pure Lua}, + author = {Lee, Zeping}, + url = {https://ctan.org/pkg/lua-tinyyaml}, + urldate = {2024-02-12}, + date = {}, + version = {0.4.3}, } @misc{lyaml, @@ -17,3 +21,13 @@ note = {Accessed: 6 January, 2024}, howpublished = {\url{https://pyyaml.org/wiki/LibYAML} and \url{https://packages.msys2.org/package/mingw-w64-x86_64-libyaml}}, } + +@manual{numprint, + title = {The numprint package}, + subtitle = {Print numbers with separators and exponent if necessary}, + author = {Harders, Harald}, + url = {https://ctan.org/pkg/numprint}, + urldate = {2024-02-12}, + date = {2012}, + version = {1.39}, +} diff --git a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example-specification.yaml b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example-specification.yaml index 2d00cecaf3..fb9e34c296 100644 --- a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example-specification.yaml +++ b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example-specification.yaml @@ -6,7 +6,7 @@ string example: placeholder: A string number example: type: number - default: -1 + default: -1.21 list example: type: list item type: string @@ -22,6 +22,9 @@ object example: email: type: string placeholder: Your email + grade: + type: number + default: 5.5 table example: type: table columns: diff --git a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.json b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.json deleted file mode 100644 index e65389b1aa..0000000000 --- a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "bool example": true, - "string example": "PeelInc.", - "number example": 1, - "list example": ["Tomatoes", "Potatoes"], - "object example": { - "name": "John Doe", - "email": "j.doe@example.com" - }, - "table example": [ - { - "description": "Peeling tomatoes", - "price": 50.00 - }, { - "description": "Peeling potatoes", - "price": 25.00 - } - ] -} diff --git a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.pdf b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.pdf Binary files differindex 1b9ff4a52f..35fd39899f 100644 --- a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.pdf +++ b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.pdf diff --git a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.tex b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.tex index 805dd2469c..12d60b796d 100644 --- a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.tex +++ b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.tex @@ -19,10 +19,12 @@ \documentclass{article} \usepackage{gitinfo-lua} -\usepackage{lua-placeholders} +\usepackage{../../tex/lua-placeholders} \usepackage{listings} \usepackage{amsmath} \usepackage{calc} +\usepackage[dutch,english]{babel} +\usepackage[autolanguage]{numprint} \loadrecipe[\jobname]{example-specification.yaml} @@ -66,10 +68,24 @@ Number example:\\ + \lstinline[style=TeX,morekeywords={rawparam}]|\rawparam{\jobname}{number example}| + $\implies$ + \rawparam{\jobname}{number example}\\ + \lstinline[style=TeX,morekeywords={param}]|\param{number example}| $\implies$ + \lstinline[style=TeX,morekeywords={numprint}]|\numprint{|\rawparam{\jobname}{number example}\verb|}| + $\implies$ \param{number example}\\ + \clearpage + + Number in foreign language:\\ + + \lstinline[style=TeX,morekeywords={param,selectlanguage}]|\selectlanguage{dutch}\param{number example}|\\ + $\implies$ + \begingroup\selectlanguage{dutch}\param{number example}\endgroup\\ + List example:\\ \lstinline[style=TeX,morekeywords={param}]|\param{list example}| @@ -92,14 +108,16 @@ \lstinline[style=TeX,morekeywords={paramfield}]|\paramfield{object example}{name}|\\ \lstinline[style=TeX,morekeywords={paramfield}]|\paramfield{object example}{email}|\\ + \lstinline[style=TeX,morekeywords={paramfield}]|\paramfield{object example}{grade}|\\ $\implies$ \paramfield{object example}{name} - \paramfield{object example}{email}\\ + \paramfield{object example}{email} + \paramfield{object example}{grade}\\ - \begin{lstlisting}[style=TeX,morekeywords={name,email}] + \begin{lstlisting}[style=TeX,morekeywords={name,email,grade}] \newcommand\name{...} \begin{paramobject}{object example} - \name \email + \name \email \grade \end{paramobject} % And here it works again \name @@ -108,26 +126,30 @@ \newcommand\name{...}% \parbox{\linewidth}{ \begin{paramobject}{object example} - \name \email + \name \email \grade \end{paramobject} \name }\\ Table example:\\ - \begin{lstlisting}[style=TeX,morekeywords={formatrow,fortablerow,description,price}] + \begin{lstlisting}[style=TeX,morekeywords={nprounddigits,npnoround,formatrow,fortablerow,description,price}] +\nprounddigits{2} \newcommand\formatrow{\description & \price \\}% \begin{tabular}{l | l} \textbf{Description} & \textbf{Price} \\ \hline \fortablerow{table example}{formatrow} \end{tabular} +\npnoround \end{lstlisting} $\implies$ + \nprounddigits{2} \newcommand\formatrow{\description & \price \\}% \begin{tabular}{l | l} \textbf{Description} & \textbf{Price} \\ \hline \fortablerow{table example}{formatrow} \end{tabular} + \npnoround \section*{After values loaded} @@ -151,10 +173,24 @@ Number example:\\ + \lstinline[style=TeX,morekeywords={rawparam}]|\rawparam{\jobname}{number example}| + $\implies$ + \rawparam{\jobname}{number example}\\ + \lstinline[style=TeX,morekeywords={param}]|\param{number example}| $\implies$ + \lstinline[style=TeX,morekeywords={numprint}]|\numprint{|\rawparam{\jobname}{number example}\verb|}| + $\implies$ \param{number example}\\ + Number in foreign language:\\ + + \lstinline[style=TeX,morekeywords={param,selectlanguage}]|\selectlanguage{dutch}\param{number example}|\\ + $\implies$ + \lstinline[style=TeX,morekeywords={numprint}]|\numprint{|\rawparam{\jobname}{number example}\lstinline|}| + $\implies$ + \begingroup\selectlanguage{dutch}\param{number example}\endgroup\\ + List example:\\ \lstinline[style=TeX,morekeywords={param}]|\param{list example}| @@ -177,14 +213,16 @@ \lstinline[style=TeX,morekeywords={paramfield}]|\paramfield{object example}{name}|\\ \lstinline[style=TeX,morekeywords={paramfield}]|\paramfield{object example}{email}|\\ + \lstinline[style=TeX,morekeywords={paramfield}]|\paramfield{object example}{grade}|\\ $\implies$ \paramfield{object example}{name} - \paramfield{object example}{email}\\ + \paramfield{object example}{email} + \paramfield{object example}{grade}\\ - \begin{lstlisting}[style=TeX,morekeywords={name,email}] + \begin{lstlisting}[style=TeX,morekeywords={name,email,grade}] \newcommand\name{...} \begin{paramobject}{object example} - \name \email + \name \email \grade \end{paramobject} % And here it works again \name @@ -192,34 +230,32 @@ $\implies$ \parbox{\linewidth}{ \begin{paramobject}{object example} - \name \email + \name \email \grade \end{paramobject} \name }\\ Table example:\\ - \begin{lstlisting}[style=TeX,morekeywords={formatrow,fortablerow,description,price}] + \begin{lstlisting}[style=TeX,morekeywords={nprounddigits,npnoround,formatrow,fortablerow,description,price}] +\nprounddigits{2} \newcommand\formatrow{\description & \price \\}% \begin{tabular}{l | l} \textbf{Description} & \textbf{Price} \\ \hline \fortablerow{table example}{formatrow} \end{tabular} +\npnoround \end{lstlisting} $\implies$ + \nprounddigits{2}% \begin{tabular}{l | l} \textbf{Description} & \textbf{Price} \\ \hline \fortablerow{table example}{formatrow} \end{tabular} - \section*{Specification File} - \lstinputlisting[language=YAML,numbers=left,xleftmargin=15pt,caption={example-specification.yaml},columns=fullflexible]{example-specification.yaml} - - \clearpage - \section*{Payload File} \lstinputlisting[language=YAML,numbers=left,xleftmargin={15pt},caption={example.yaml},columns=fullflexible]{example.yaml} - \section*{Fallback Payload} - \lstinputlisting[language=JSON,numbers=left,xleftmargin={15pt},caption={example.json},columns=fullflexible]{example.json} + \section*{Specification File} + \lstinputlisting[language=YAML,numbers=left,xleftmargin=15pt,caption={example-specification.yaml},columns=fullflexible]{example-specification.yaml} \end{document} diff --git a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.yaml b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.yaml index 1806fad8da..57fc9859b5 100644 --- a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.yaml +++ b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-example/example.yaml @@ -1,14 +1,15 @@ bool example: true string example: PeelInc. -number example: 1 +number example: 1.21 list example: - Tomatoes - Potatoes object example: name: John Doe email: j.doe@example.com + grade: 9.5 table example: - description: Peeling tomatoes - price: 50.00 + price: 50 - description: Peeling potatoes - price: 25.00 + price: 25 diff --git a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.pdf b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.pdf Binary files differindex b9bb4a0238..1a84db82dd 100644 --- a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.pdf +++ b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.pdf diff --git a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.tex b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.tex index c618146637..4a7d885ea6 100644 --- a/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.tex +++ b/macros/luatex/latex/lua-placeholders/doc/lua-placeholders-manual.tex @@ -32,6 +32,7 @@ \usepackage{attachfile2} \usepackage{enumitem} \usepackage{biblatex} +\usepackage[english]{isodate} \DefineBibliographyStrings{english}{% bibliography = {References}, @@ -43,7 +44,6 @@ \embedfile[desc={Parameter Specification Example},filespec=example.pdf]{lua-placeholders-example/example.pdf} \embedfile[desc={Parameter Specification Example (YAML)},filespec=example-specification.yaml]{lua-placeholders-example/example-specification.yaml} \embedfile[desc={Values Specification Example},filespec=example.yaml]{lua-placeholders-example/example.yaml} -\embedfile[desc={Values Fallback Specification Example},filespec=example.json]{lua-placeholders-example/example.json} \def\projecturl{https://github.com/Xerdi/lua-placeholders} @@ -88,13 +88,16 @@ \end{enumerate} \subsection{Prerequisites} + For proper number formatting package \texttt{numprint}\cite{numprint} is required. + + \subsubsection{YAML Support} If you're using JSON as \meta{recipe} and \meta{payload} format, the following requirements are no longer needed, since Lua\TeX{} already supports JSON formats out of the box. For YAML support, however, this package requires the \texttt{lyaml}\cite{lyaml} Lua module for parsing the YAML files. This also includes the \texttt{libYAML}\cite{libYAML} platform dependent library and optionally LuaRocks for installing \texttt{lyaml}. Another requirement is Lua, which version meets the Lua version used by Lua\TeX{}. If no \texttt{LUA\_PATH} is set, and you use LuaRocks, this package tries to call the LuaRocks executable to find the \texttt{LUA\_PATH}. - If \texttt{lyaml} can't be loaded, this package will first try to fall back with \texttt{lua-tinyyaml}\cite{tiny} for lesser YAML support and secondly fall back on accepting JSON files only. + If \texttt{lyaml} can't be loaded, this package will first try to fall back with \texttt{lua-tinyyaml}\cite{lua-tinyyaml} for lesser YAML support and secondly fall back on accepting JSON files only. \clearpage \section{Usage} @@ -155,9 +158,14 @@ \item[number] representing a number, like the number type of Lua. In most cases it's necessary to use \meta{default} instead of \meta{placeholder}, especially when the number is used in calculations, since a placeholder will cause errors in \LaTeX{} calculations.\\ \showexample{7}{7-9}{3}{3-3} + \DescribeMacro{\param} A number type can be used with \cmd{\param}, just like the string type. - \DescribeMacro{\numparam} However, the \cmd{\numparam}\oarg{namespace}\marg{name} command uses \cmd{\numprint} to properly format the number according to the selected language. + In version 1.0.0 there was a special command \cmd{\numparam}, which is now deprecated as it now is the default implementation for number types using \cmd{\param}. + When \cmd{\numprint} is defined, it will use it for display using \cmd{\param}. + When \cmd{\numprint} isn't defined, it will print a warning message and formats the number as is. + The same behavior counts for number types within a \texttt{list}, \texttt{object} or \texttt{table}. Read the documentation of package \texttt{numprint} for more information. + If you need a nonformatted version of the number, use \cmd{\rawparam} instead. \item[list] representing a list of values. The value type is specified by \meta{value type}. A \meta{default} setting can be set. @@ -176,7 +184,7 @@ \item[object] representing a list of key value pairs. This parameter type requires a \meta{fields} specification to be set. Any field must be of type \texttt{bool}, \texttt{number} or \texttt{string}.\\ - \showexample{16}{16-24}{7}{7-9} + \showexample{16}{16-27}{7}{7-10} There is no support for the \cmd{\param} command. \DescribeMacro{\paramfield} In order to show to contents there is the \cmd{\paramfield}\oarg{namespace}\marg{name}\marg{field} command. @@ -190,7 +198,7 @@ This parameter type requires a \meta{columns} specification to be set. The \meta{columns} describes each column by name with its own type specification. Like the object field, only the types \texttt{bool}, \texttt{number} and \texttt{string} are supported column types.\\ - \showexample[20pt]{25}{25}{10}{10} + \showexample[20pt]{28}{28-36}{11}{11-15} \DescribeMacro{\fortablerow} Like the object, the table has no support for \cmd{\param}, but comes with a table specific command \cmd{\fortablerow}\oarg{namespace}\marg{name}\marg{csname}. The control sequence name \meta{csname} is a user-defined command with no arguments, containing any of the column names in a command form. @@ -206,6 +214,24 @@ \printbibliography[heading=bibnumbered] \clearpage + + \section{Changelog} + \newcommand\commitline[3]{\item #1\ifx&% + \else\\[1em] + #3\fi\\\hspace*{1em} — \printdate{#2}} + \newcommand\formatversion[3]{% + \item[#1] + \gittag[(taggerdate)(taggerdate:short)(authordate:short)]{printdate}{#1} + \begin{itemize} + \forgitcommit[s,as,b]{commitline}{#3} + \end{itemize} + }% + \begin{description} + \forgittagseq{formatversion} + \end{description} + + \clearpage + \section{Example} The source file \texttt{example.tex} is a perfect demonstration of all macros in action. diff --git a/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-namespace.lua b/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-namespace.lua index fb84447a25..bca680769f 100644 --- a/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-namespace.lua +++ b/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-namespace.lua @@ -66,7 +66,7 @@ function namespace:load_payload(values) else texio.write_nl('Warning: passed an unknown key ' .. key) end - texio.write_nl('Key' .. key) + texio.write_nl('Info: loaded key ' .. key) end else texio.write_nl('Warning: Payload file was empty') diff --git a/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-types.lua b/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-types.lua index faa637c8f7..bb6abafdb1 100644 --- a/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-types.lua +++ b/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders-types.lua @@ -40,10 +40,14 @@ function base_param:is_set() return self and ((self.values or self.fields or self.value) ~= nil) end -function base_param:val() +function base_param:raw_val() return self.value or self.values or self.default end +function base_param:val() + return self:raw_val() +end + function base_param:to_upper() local val = self:val() if type(val) == 'string' then @@ -56,7 +60,7 @@ end function base_param:print_val() local value = self:val() if value ~= nil then - tex.write(value) + tex.sprint(value) else tex.sprint(lua_placeholders_toks.placeholder_format, '{', self.placeholder or self.key, '}') end @@ -77,7 +81,7 @@ function bool_param:new(key, _o) return o end -function bool_param:val() +function bool_param:raw_val() local value if self.value ~= nil then value = tostring(self.value) @@ -122,21 +126,29 @@ function number_param:new(key, _o) return o end -function number_param:val() +function number_param:raw_val() if self.value or self.default then - return tex.number(self.value or self.default) + return self.value or self.default end end -function number_param:print_num() - local val = self:val() +function number_param:val() + local val = self:raw_val() if val then - tex.print('\\numprint{' .. val .. '}') - else - tex.sprint(lua_placeholders_toks.placeholder_format, '{', self.placeholder or self.key, '}') + if token.is_defined('numprint') then + return '\\numprint{' .. val .. '}' + else + texio.write_nl([[Warning: package 'numprint' not loaded. Outputting numbers as is.]]) + return val + end end end +function number_param:print_num() + texio.write_nl('Warning: number_param:print_num is deprecated. Use number_param:print_val instead') + self:print_val() +end + list_param = base_param:new{ type = 'list' } diff --git a/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders.lua b/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders.lua index 181676679c..832e0106eb 100644 --- a/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders.lua +++ b/macros/luatex/latex/lua-placeholders/scripts/lua-placeholders.lua @@ -23,8 +23,8 @@ if not modules then end modules.lua_placeholders = { - version = "1.0.0", - date = "2024/01/23", + version = "1.0.1", + date = "2024/02/12", comment = 'Extended LaTeX Parameter Interface — for specifying and inserting document parameters', author = 'Erik Nijenhuis', license = 'free' diff --git a/macros/luatex/latex/lua-placeholders/tex/lua-placeholders.sty b/macros/luatex/latex/lua-placeholders/tex/lua-placeholders.sty index e11b950f5a..d467033c11 100644 --- a/macros/luatex/latex/lua-placeholders/tex/lua-placeholders.sty +++ b/macros/luatex/latex/lua-placeholders/tex/lua-placeholders.sty @@ -19,7 +19,7 @@ % lua-placeholders-parser.lua and lua-placeholders-types.lua \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lua-placeholders}[2024/01/23 1.0.0 Extended LaTeX Paramter Interface Package] +\ProvidesPackage{lua-placeholders}[2024/02/12 1.0.1 Extended LaTeX Paramter Interface Package] \RequirePackage{ifthen} \RequirePackage{luapackageloader} @@ -41,7 +41,7 @@ \ifthenelse{\boolean{#2}}{#3}{#4}} \newcommand\param[2][\curnamespace]{\directlua{lua_placeholders.param('#2', '#1')}} \newcommand\PARAM[2][\curnamespace]{\directlua{local p = lua_placeholders.param_object('#2', '#1') if p then tex.print(p:to_upper()) end}} -\def\rawparam#1#2{\directlua{local p = lua_placeholders.param_object('#2', '#1') if p then tex.print(p:val() or p.default or p.placeholder) end}} +\def\rawparam#1#2{\directlua{local p = lua_placeholders.param_object('#2', '#1') if p then tex.print(p:raw_val() or p.default or p.placeholder) end}} \newcommand\numparam[2][\curnamespace]{\directlua{local n = lua_placeholders.param_object('#2', '#1') if n then n:print_num() end}} \newcommand\hasparam[4][\curnamespace]{% \def\has@param@true{#3}% |