Skip to content
/ exemplar Public
forked from oubiwann/exemplar

Markup Language Expressions for LFE

License

Notifications You must be signed in to change notification settings

lfex/exemplar

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

exemplar

Build Status LFE Versions Erlang Versions Tags

Markup Language Expressions for LFE: creating XML/HTML with S-expressions on the Erlang VM

Project Logo

Contents

Introduction

Supported Tags

Right now, only HTML5 is supported. Feel free to submit pull requests to support older/different tags/elements.

The list of tags was obtained from Mozilla's HTML 5 documentation

Note that XML namespacing hasn't been explored yet, but should be possible.

Current Status

As you can see in the example usage below, you can use exemplar to build HTML strings using LFE S-expressions. However, do note that the project has just started and there are lots of unexplored HTML edge-cases that simply won't work right now.

If you come across anything, feel free to submit a bug in the github issue tracker, or even send us a pull request :-)

About the Name

Naming and cache invalidation, right?

The first thought was to name the project ML-expr: ML for HTML, replacing the "s" of "s-expression". MLEXPR isn't all that pronouncable, so another "e" and an "a" were added for "exemplar". That's all there is to it.

Also: "Do you know who I am?!"1

Dependencies

This project assumes that you have rebar3 installed somwhere in your $PATH.

Installation

Just add it to your rebar.config deps:

{deps, [
  ...
  {exemplar, "0.6.0"}
]}.

And then do the usual:

$ rebar3 compile

Usage

For details, see the "Documentation" section below, but here's a quick usage example:

(include-lib "exemplar/include/html-macros.lfe")

(let ((content (html
                 (body
                   (div
                     (p "Here is some content"))))))
  (io:format "~s" (list content)))

which prints out the expected:

<html><body><div><p>Here is some content</p></div></body></html>

Documentation

Documentation for Exemplar is published here.

License

Copyright © 2014-2023 Duncan McGreggor

Distributed under the Apache License, Version 2.0.


Footnotes

Footnotes

  1. "The first Exemplar was the Juggernaut, who had formerly been Cain Marko, stepbrother to Charles Xavier." See the Exemplars wikipedia entry for more details.

About

Markup Language Expressions for LFE

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • LFE 76.5%
  • Makefile 17.1%
  • Erlang 5.7%
  • HTML 0.7%