👨‍💻 about me home CV/Resume 🖊️ Contact Github LinkedIn I’m a Haskeller 📝 Blog Freedom, privacy, tutorials… 🏆 Best of Fizzbuzz makex LuaX lsvg Calculadoira panda upp Haskell todo pwd TPG Nextcloud Git

🆕 February 2023: lsvg is a Lua interpreter specialized to generate SVG images.
🆕 since August 2022: LuaX is a Lua eXtended interpreter/cross compiler providing a bunch of useful modules (statically linked, no dependency). Nice integration with upp (new functions and modules available to extend upp macros) and Pandoc (LuaX can by loaded by the Pandoc Lua interpreter). LuaX was initially made for a soon released but yet confidential project about actor oriented programming!
💣 Kick GAFAMs out (✔️ ǝlƃooפ, ✔️ ʞooqǝɔɐℲ, ✔️ uozɐɯ∀): Stop giving our soul and money to evils, be free and respectful!
📰 Friday 2. April 2021: upp is a panda companion. It’s a Lua-scriptable lightweight text preprocessor.
🆕 since December 2020: Playing with the actor model in an embedded multicore context. C imperative components become C stream pure functions with no side effect ➡️ C low level programming with high level pure functional programming properties 🏆
📰 Saturday 30. January 2021: Playing with Pandoc Lua filters in Lua. panda is a lightweight alternative to abp providing a consistent set of Pandoc filters (text substitution, file inclusion, diagrams, scripts, …).
🆕 Sunday 24. May 2020: Working at EasyMile for more than 6 years. Critical real-time software in C, simulation and monitoring in Haskell ➡️ perfect combo! It’s efficient and funny ;-)

UPP: Universal PreProcessor

Christophe Delord - http://cdelord.fr/upp

Universal PreProcessor

UPP is a minimalist and generic text preprocessor using Lua macros.

If you need a Pandoc preprocessor, Panda may be a better choice.

Open source

UPP is an Open source software. Anybody can contribute on GitHub to:

Installation

Prerequisites

Installation from source

$ git clone https://github.com/CDSoft/luax.git && make -C luax install
$ git clone https://github.com/CDSoft/upp.git
$ cd upp
$ make install      # install upp in ~/.local/bin

make install installs upp in ~/.local/bin. The PREFIX variable can be defined to install upp to a different directory (e.g. make install PREFIX=/usr to install upp in /usr/bin).

Note: upp can also be installed with makex.

Precompiled binaries

It is recommended to install upp from the sources.

In case you need precompiled binaries (upp and Luax interpretor included), the latest binaries are available here: UPP precompiled binaries

Test

$ make test

Usage

$ upp [options] files

where files is the list of files (- for stdin).

options:

Documentation

Lua expressions are embedded in the document to process: $( Lua expression ) or @( Lua expression ).

Lua chunks can also be embedded in the document to add new definitions: :( Lua chunk ) or @@( Lua chunk ).

The @ notation has been added as it is more Markdown syntax friendly ($ may interfere with LaTeX equations).

A macro is just a Lua function. Some macros are predefined by upp. New macros can be defined by loading Lua scripts (options -l and -e) or embedded as Lua chunks.

Expression and chunks can return values. These values are formatted according to their types:

Example

The user's home is $(os.getenv "HOME").

Builtin macros

Example

Import a Lua script: :(require "module_name")
Embed a Lua script: :( Lua script )
Evaluate a Lua expression: $( 1 + lua_function(lua_variable) )
Include another document: $(include "other_document_name")
Conditional text: $(when (lang == "fr") [[ Ce texte est écrit en français ! ]])

Additional packages

upp comes with some packages (already included in the binaries, no external dependancies are required).

counter

The counter function generates counters:

req

The package req provides basic requirement management tools.

Warning: this package is still experimental and not tested...

License

This file is part of UPP.

UPP is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

UPP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with UPP.  If not, see <https://www.gnu.org/licenses/>.

For further information about UPP you can visit
http://cdelord.fr/upp

Feedback

Your feedback and contributions are welcome. You can contact me at cdelord.fr.