Debian Codegraph @

texmf-dist/tex/lualatex/ideavault/ideavault.sty

raw
1 % ideavault.sty
2 % Copyright 2024-2025 Tomasz M. Czarkowski
3 %
4 % This work may be distributed and/or modified under the
5 % conditions of the LaTeX Project Public License, either version 1.3c
6 % of this license or any later version.
7 % The latest version of this license is in
8 % https://www.latex-project.org/lppl.txt
9 % and version 1.3c or later is part of all distributions of LaTeX
10 % version 2008 or later.
11 %
12 % This work has the LPPL maintenance status `maintained'.
13 %
14 % The Current Maintainer of this work is Tomasz M. Czarkowski
15 %
16 % This work consists of the files ideavault.sty and ideavault-lua.lua
17
18
19 \NeedsTeXFormat{LaTeX2e}
20 \ProvidesPackage{ideavault}[1.0.5]
21 \RequirePackage[open,openlevel=2,atend]{bookmark}
22 \RequirePackage{xargs}
23 \RequirePackage{luacode}
24 \RequirePackage{xpatch}
25 \RequirePackage{mdframed}
26 % Magic that lets mdframed nest more than 3 times
27 \makeatletter
28 \xpatchcmd{\mdf@preenvsetting}
29 {\mdf@envdepth >\tw@}
30 {\mdf@envdepth >20}
31 {}
32 {}
33 \makeatother
34 \RequirePackage{needspace}
35
36 \directlua{require("ideavault-lua")}
37
38 % #1: prefix
39 % #2: name
40 % #3: content
41 % #4: dependencies
42 % #5: tags
43 % #6: weight
44 \newcommandx{\createIdea}[6][1=default, 4=,5=,6=-1]{\luadirect{createIdea(\luastringN{#1}, \luastringN{#2}, \luastringN{#3}, {#4}, {#5}, #6)}}
45
46 % #1: prefix
47 % #2: style
48 % #3: name
49 \newcommandx{\printIdea}[3][1=default, 2=lcf]{\luadirect{ideaVault:printIdea(\luastringN{#1}, \luastringN{#3}, \luastringN{#2})}}
50
51 % #1: prefix
52 % #2: style
53 \newcommandx{\printAllWithPrefix}[2][1=default, 2=lcf]{\luadirect{ideaVault:printAllWithPrefix(\luastringN{#1}, \luastringN{#2})}}
54
55 % #1: prefix
56 % #2: style
57 % #3: tag
58 \newcommandx{\printAllWithTag}[3][1=default, 2=lcf]{\luadirect{ideaVault:printAllWithTag(\luastringN{#1}, \luastringN{#3}, \luastringN{#2})}}
59
60 % Commands for managing debug output
61 \newcommandx{\debugEnable}{\luadirect{logDebugEnabled = true}}
62 \newcommandx{\debugDisable}{\luadirect{logDebugEnabled = false}}
63
64 % Internal commands for managing bookmark depth
65 \newcounter{bookmarkDepth}
66 \newcommand{\bookDown}{\stepcounter{bookmarkDepth}}
67 \newcommand{\bookUp}{\addtocounter{bookmarkDepth}{-1}}
68 \newcommand{\bookSet}[1]{\setcounter{bookmarkDepth}{#1}}
69 \newcommand{\bookDepth}{\arabic{bookmarkDepth}}
70
71 \endinput