Skip to content

🥣 A Preprocessor for HTML that converts <objc> and other tags to MulleScion {% %}

License

Notifications You must be signed in to change notification settings

MulleWeb/MulleScionHTMLPreprocessor

Repository files navigation

MulleScionHTMLPreprocessor

🥣 A Preprocessor for HTML that converts <objc> and other tags to MulleScion {% %}

Write your MulleScion template code in HTML lookalike tags. Now reformat the HTML document and it doesn't destroy your template code (as much).

Check the Wiki for editor setup help.

Release Version Release Notes
Mulle kybernetiK tag Build Status RELEASENOTES

Usage

Preprocessor support is available starting with MulleScion version 1859.

MulleScionParser *parser;

...
[parser setPreprocessor:[MulleScionHTMLPreprocessor object]];

Example

 <html>
  <head>
    <objc>
       x = @"Hello World";
    </objc>
  </head>
  <body>
    <if x>
       <h1></h1>
    <else/>
       <h1>I have nothing to say</h1>
    </if>
  </body>
</html>

Info

Hide the uglies in HTML preview

Unknown tags shouldn't get rendered by the browser. Therefore there is nothing to do for most tags. The text between <objc> and </objc> can be hidden with CSS:

<style type="text/css">
 objc { display: none; white-space: pre; }
</style>

Tags

Tag pairs enclose template content. The tag-pairs are translated to MulleScion handlebars. There is no syntax check done on the text following the tag identifier.

Tag Opener Closer Translates to
<block> </block> {% block %} {% endblock %}
<else/> {% else %}
<if expr> </if> {% if expr %} {% endif %}
<for var in expr> </for> {% for var in expr %} {% endfor %}
<objc> <objc> {% %}
<while expr> </while> {% while expr %} {% endwhile %}

objc is useful to add Objective-C code in the <head> section of the HTML document, but it can be placed anywhere. The other tags are more useful in the <body> section.

Notes

  • <block> is experimental, it might get removed
  • <else/> has no closer.

You are here

Overview

Add

Use mulle-sde to add MulleScionHTMLPreprocessor to your project:

mulle-sde add github:MulleWeb/MulleScionHTMLPreprocessor

Install

Install with mulle-sde

Use mulle-sde to build and install MulleScionHTMLPreprocessor and all dependencies:

mulle-sde install --prefix /usr/local \
   https://github.com//MulleScionHTMLPreprocessor/archive/latest.tar.gz

Manual Installation

Install the requirements:

Requirements Description
MulleFoundationBase 🧱 MulleFoundationBase amalgamates Foundations projects
mulle-objc-list 📒 Lists mulle-objc runtime information contained in executables.

Download the latest tar or zip archive and unpack it.

Install MulleScionHTMLPreprocessor into /usr/local with cmake:

cmake -B build \
      -DCMAKE_INSTALL_PREFIX=/usr/local \
      -DCMAKE_PREFIX_PATH=/usr/local \
      -DCMAKE_BUILD_TYPE=Release &&
cmake --build build --config Release &&
cmake --install build --config Release

Platforms and Compilers

All platforms and compilers supported by mulle-c11.

Author

Nat! for Mulle kybernetiK