Skip to content

Resource Processing

philcali edited this page Mar 22, 2013 · 1 revision

The lmxml-resource module allows for external resource load to be a part of the parsing mechanism.

Example

Below is an example of loading an external plain text file as a text node.

index.lmxml

html
  head title "Title"
  body load @file="body.html" is unescaped

body.html

<h1>You did it!</h1>
<p>See you can load any kind of file if you want</p>

result

<html>
  <head>
    <title>Title</title>
  </head>
  <body>
    <h1>You did it!</h1>
    <p>See you can load any kind of file if you want</p>
  </body>
</html>

Funneling LMXML

You can pipe LMXML files into the load and node replacement

index.lmxml

html
  load @type="lmxml" @node="body" @file="lmxml.lmxml"

lmxml.lmxml

p
 em "Resource Loading"
 "is all there is to it"

Mixn' it up

The purpose of this plugin is to allow re-usable files for your lmxml conversions.

data.json

{
  "contents": "contents.md",
  "index": "index.md",
}

index.lmxml

!html

html
  head title "Site"
  body
    md load @file="{contents}"
    md load @file="{index}"

Clone this wiki locally