summaryrefslogtreecommitdiff
path: root/macros/luatex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-06-26 03:02:01 +0000
committerNorbert Preining <norbert@preining.info>2024-06-26 03:02:01 +0000
commitb5e5351d680bb0e65b0b0406f3f2973c671239ca (patch)
treefb5600db0d544a0365ac329294a0d954dae17090 /macros/luatex
parentcc35d9fb75f8872c9fb31755bab77d9bd74672d8 (diff)
CTAN sync 202406260301
Diffstat (limited to 'macros/luatex')
-rw-r--r--macros/luatex/latex/ideavault/ideavault-doc.pdfbin35625 -> 39361 bytes
-rw-r--r--macros/luatex/latex/ideavault/ideavault-doc.tex30
-rw-r--r--macros/luatex/latex/ideavault/ideavault-lua.lua61
-rw-r--r--macros/luatex/latex/ideavault/ideavault.sty6
4 files changed, 81 insertions, 16 deletions
diff --git a/macros/luatex/latex/ideavault/ideavault-doc.pdf b/macros/luatex/latex/ideavault/ideavault-doc.pdf
index fc48b1384e..0a641014ab 100644
--- a/macros/luatex/latex/ideavault/ideavault-doc.pdf
+++ b/macros/luatex/latex/ideavault/ideavault-doc.pdf
Binary files differ
diff --git a/macros/luatex/latex/ideavault/ideavault-doc.tex b/macros/luatex/latex/ideavault/ideavault-doc.tex
index 0bea7622c6..5b2f2ff4a5 100644
--- a/macros/luatex/latex/ideavault/ideavault-doc.tex
+++ b/macros/luatex/latex/ideavault/ideavault-doc.tex
@@ -13,7 +13,8 @@
\par This is what the Idea Vault is used for.
\section{Dependencies}
-\par Idea Vault requires some packages (most of them for styling the printed idea).
+\par Lua\LaTeX --- this is Lua\LaTeX package and will not work without Lua.
+\par Additionally, Idea Vault requires some packages (most of them for styling the printed idea).
\begin{itemize}
\item \texttt{bookmark}
\item \texttt{xargs}
@@ -33,7 +34,7 @@
\subsection{\textbackslash{}createIdea}
\begin{verbatim}
-\printIdea[prefix]{name}{content}[dependencies][tags][weight]
+\createIdea[prefix]{name}{content}[dependencies][tags][weight]
\end{verbatim}
\begin{itemize}
\item \texttt{prefix}: prefix to locate the idea in. By default, equals to \texttt{default}.
@@ -84,7 +85,7 @@
\par Example:
\begin{verbatim}
-\printIdeaAllWithPrefix[somePrefix][lcbf]
+\printAllWithPrefix[somePrefix][lcbf]
\end{verbatim}
\subsection{\textbackslash{}printAllWithTag}
@@ -100,7 +101,7 @@
\par Example:
\begin{verbatim}
-\printIdeaAllWithTag[somePrefix][lcbf]{tag1}
+\printAllWithTag[somePrefix][lcbf]{tag1}
\end{verbatim}
\section{Style}
@@ -109,15 +110,32 @@
\item \texttt{f}: Frame whole idea
\item \texttt{c}: Center whole idea
\item \texttt{b}: Create bookmark leading to the idea
-\item \texttt{l}: Use large font for the name
+\item \texttt{l}: Use Large font for the name
+\item \texttt{L}: Use LARGE font for the name
+\item \texttt{h}: Use huge font for the name
+\item \texttt{H}: Use Huge font for the name
\item \texttt{s}: Reserve some space using needspace to avoid awkward pagebreaks
\item \texttt{e}: emph the name
-\item \texttt{q}: do not print the name
+\item \texttt{q}: Do not print the name
\item \texttt{p}: New page before printing the idea (useful when doing serial printing, for example via \texttt{printAllWithTag})
\item \texttt{P}: New page after printing the idea (useful when doing serial printing, for example via \texttt{printAllWithTag})
\end{itemize}
+\section{Debugging}
+\par By default, this package avoids spamming too much to stdout, but sometimes it would be useful to see what idea creation/printing is triggering some problems.
+\subsection{\textbackslash{}debugEnable}
+\begin{verbatim}
+\debugEnable
+\end{verbatim}
+\par Enables debug output --- remember, it may be quite overwhelming if there are a lot of ideas.
+\subsection{\textbackslash{}debugDisable}
+\begin{verbatim}
+\debugDisable
+\end{verbatim}
+\par Disables debug output. Debug output is disabled by default, so it's only use is to revert the effect of enabling it.
+
\section{Example}
+\par This is short example of code, and it's result. Extended example can be found in file \texttt{example.tex}.
\subsection{Code}
\begin{verbatim}
\createIdea[somePrefix]{Not So Great Idea}{
diff --git a/macros/luatex/latex/ideavault/ideavault-lua.lua b/macros/luatex/latex/ideavault/ideavault-lua.lua
index 09bade82a2..c39a964f64 100644
--- a/macros/luatex/latex/ideavault/ideavault-lua.lua
+++ b/macros/luatex/latex/ideavault/ideavault-lua.lua
@@ -15,6 +15,29 @@
--
-- This work consists of the files ideavault.sty and ideavault-lua.lua
+
+logErrorEnabled = true
+logWarnEnabled = true
+logDebugEnabled = false
+
+function logError(message)
+ if (logErrorEnabled) then
+ texio.write_nl("[ERROR] " .. message)
+ end
+end
+
+function logWarn(message)
+ if (logWarnEnabled) then
+ texio.write_nl("[WARN] " .. message)
+ end
+end
+
+function logDebug(message)
+ if (logDebugEnabled) then
+ texio.write_nl("[DEBUG] " .. message)
+ end
+end
+
IdeaVaultClass = {}
IdeaVaultClass.__index = IdeaVaultClass
@@ -186,12 +209,15 @@ bookmark_counter = 0
function IdeaClass:printSelf(style)
style = style or ""
- texio.write("Printing idea. Title: '" .. self:getTitle() .. "', style: '" .. style .. "'.\n")
+ logDebug("Printing idea. Title: '" .. self:getTitle() .. "', style: '" .. style .. "'.\n")
local frame = false
local center = false
local bookmark = false
local large = false
+ local Large = false
+ local huge = false
+ local Huge = false
local needSpace = false
local emph = false
local quiet = false
@@ -206,7 +232,13 @@ function IdeaClass:printSelf(style)
elseif (c == "b") then
bookmark = true
elseif (c == "l") then
- large = true
+ large = true
+ elseif (c == "L") then
+ Large = true
+ elseif (c == "h") then
+ huge = true
+ elseif (c == "H") then
+ Huge = true
elseif (c == "s") then
needSpace = true
elseif (c == "e") then
@@ -247,23 +279,34 @@ function IdeaClass:printSelf(style)
end
if (not quiet)
then
+ tex.sprint("{%")
if (large)
then
- tex.sprint("{\\Large%")
+ tex.sprint("\\Large%")
+ end
+ if (Large)
+ then
+ tex.sprint("\\LARGE%")
+ end
+ if (huge)
+ then
+ tex.sprint("\\huge%")
+ end
+ if (Huge)
+ then
+ tex.sprint("\\Huge%")
end
if (emph)
then
tex.sprint("\\emph{,,")
end
tex.sprint(self:getTitle())
+ tex.sprint("\\nopagebreak%")
if (emph)
then
tex.sprint("''}%")
end
- if (large)
- then
- tex.sprint("}%")
- end
+ tex.sprint("}%")
end
if (center)
then
@@ -344,7 +387,7 @@ function createIdea(prefix, key, content, dependencies, tags, value)
t = t .. a .. ", "
end
t = t .. "]"
- texio.write("Creating idea. Title: '" .. key .. "'. Prefix: '" .. prefix .. "', tags: " .. t .. ".\n")
+ logDebug("Creating idea. Title: '" .. key .. "'. Prefix: '" .. prefix .. "', tags: " .. t .. ".\n")
deps = {}
for _, val in pairs(dependencies)
do
@@ -360,7 +403,7 @@ end
function die(reason)
reason = reason or "nil"
- texio.write_nl("Critical error: " .. reason)
+ logError("Critical error: " .. reason)
tex.error("Critical error: " .. reason)
end
diff --git a/macros/luatex/latex/ideavault/ideavault.sty b/macros/luatex/latex/ideavault/ideavault.sty
index 4b5c72a351..8b73929eaf 100644
--- a/macros/luatex/latex/ideavault/ideavault.sty
+++ b/macros/luatex/latex/ideavault/ideavault.sty
@@ -17,7 +17,7 @@
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ideavault}[1.0.3]
+\ProvidesPackage{ideavault}[1.0.4]
\RequirePackage[open,openlevel=2,atend]{bookmark}
\RequirePackage{xargs}
\RequirePackage{luacode}
@@ -57,6 +57,10 @@
% #3: tag
\newcommandx{\printAllWithTag}[3][1=default, 2=lcf]{\luadirect{ideaVault:printAllWithTag(\luastringN{#1}, \luastringN{#3}, \luastringN{#2})}}
+% Commands for managing debug output
+\newcommandx{\debugEnable}{\luadirect{logDebugEnabled = true}}
+\newcommandx{\debugDisable}{\luadirect{logDebugEnabled = false}}
+
% Internal commands for managing bookmark depth
\newcounter{bookmarkDepth}
\newcommand{\bookDown}{\stepcounter{bookmarkDepth}}