From d0fe56f4e98fa552c5e271713a815d2382e614f7 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sun, 29 Sep 2024 10:11:35 +0200 Subject: feat(templates): Provide a consistent syntax for replacements All replacements now start with `lpm::` and thus provide a future way to extend them. This change also adds the ability to access the chapter name in a new section and the current data in a new chapter. --- example/example.tex | 21 +++++++++++++++++++++ example/lpm.toml | 12 +++++------- example/main.tex | 21 --------------------- 3 files changed, 26 insertions(+), 28 deletions(-) create mode 100644 example/example.tex delete mode 100644 example/main.tex (limited to 'example') diff --git a/example/example.tex b/example/example.tex new file mode 100644 index 0000000..d5f0d2f --- /dev/null +++ b/example/example.tex @@ -0,0 +1,21 @@ +% LTeX: language=en-GB +\documentclass[a4paper, 12pt]{report} +\input{headers/preamble.tex} +\input{headers/preamble_local.tex} + + +\title{\textbf{Some Title}} +\author{Some Author} +\authors{name\inst} +\years{2024} +\date{\Today} + +\includeonly{} + +\begin{document} + \input{content/static/title} + + % NEXT_CHAPTER + + \printbibliography\relax +\end{document} diff --git a/example/lpm.toml b/example/lpm.toml index 5a3565d..7c4aaad 100644 --- a/example/lpm.toml +++ b/example/lpm.toml @@ -1,19 +1,17 @@ -[last_chapter] -user_name = "static" -number = 0 +main_file = "example.tex" [templates] section = ''' -%! TEX root = ../../../main.tex +%! TEX root = ../../../example.tex % LTeX: language=en-GB -\section{REPLACMENT_SECTION_TITLE} % DATE +\section{lpm::new_section_name} % lpm::current_date (lpm::current_chapter_name::title_case) This is some text ''' chapter = ''' -%! TEX root = ../../main.tex +%! TEX root = ../../example.tex % LTeX: language=en-GB -\chapter{REPLACEMENT_CHAPTER} +\chapter{lpm::new_chapter_name} % lpm::current_date ''' diff --git a/example/main.tex b/example/main.tex deleted file mode 100644 index d5f0d2f..0000000 --- a/example/main.tex +++ /dev/null @@ -1,21 +0,0 @@ -% LTeX: language=en-GB -\documentclass[a4paper, 12pt]{report} -\input{headers/preamble.tex} -\input{headers/preamble_local.tex} - - -\title{\textbf{Some Title}} -\author{Some Author} -\authors{name\inst} -\years{2024} -\date{\Today} - -\includeonly{} - -\begin{document} - \input{content/static/title} - - % NEXT_CHAPTER - - \printbibliography\relax -\end{document} -- cgit 1.4.1