https://github.com/mariuslundgard/node-transclusion
[ALPHA]
https://github.com/mariuslundgard/node-transclusion
Last synced: 3 months ago
JSON representation
[ALPHA]
- Host: GitHub
- URL: https://github.com/mariuslundgard/node-transclusion
- Owner: mariuslundgard
- Created: 2013-05-29T08:51:46.000Z (almost 12 years ago)
- Default Branch: develop
- Last Pushed: 2013-05-29T09:11:20.000Z (almost 12 years ago)
- Last Synced: 2024-12-25T11:29:54.171Z (4 months ago)
- Homepage: http://mariuslundgard.com/projects/transclusion
- Size: 2.41 MB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-starred - mariuslundgard/node-transclusion - [ALPHA] (others)
README
# Transclusion
Transclusion is an HTML5 preprocessor based on the DOM and the concept of _[transclusion](https://en.wikipedia.org/wiki/Transclusion)_ as defined by [Ted Nelson](https://en.wikipedia.org/wiki/Ted_Nelson) in 1982.
The purpose of Transclusion is to make life easier for anyone who knows a little bit of HTML, as well as laying the foundation for developers working with advanced HTML content editors.
*Transclusion is currently only implemented in PHP5.4+.*
[See the PHP version here](http://github.com/mariuslundgard/transclusion).
## Syntax examples
### Basic syntax
The syntax of Transclusion embraces/extends the XML-flavored syntax implemeneted by HTML5. Therefore, valid HTML5 is completely valid Transclusion syntax:
```html
Hello, world!
Hello world!
```
However, the following will produce the same output as the previous example:
```html
Hello, world!Hello world!
```This is because Transclusion lets you omit unecessary markup (although this does require a good understanding of the way XML and HTML5 is structured).
Here's a more advanced example where the `header` element needs a closing tag in order to produce the intended structure:
```htmlA More Advanced “Hello, World!” Example
[[ title ]]
A “Hello, world!” example is a common way of introducing a scripting language.
```Which will output:
```html
A More Advanced “Hello, World!” Example
A More Advanced “Hello, World!” Example
A “Hello, world!” example is a common way of introducing a scripting language.
```
### Including element blocks
```html
The element following this paragraph will be the element with the corresponding id "intro" in "source.html".
```
### Base documents and block replacement
In _Extension.html_:
```html
This replaces the div#content element in the base document.
```
In _Base.html_:
```html
[[ title ]]
(Content goes here.)
```### Expressions
Transclusion uses the expression delimiters `[[` and `]]` (without the quotes). In the following example, the document variable `title` is used as an example.
```html
The following header's text will be the document filename (if the title was not otherwise set using the setter routine).
[[ title ]]
```### Operations
```html
The sum of 3 + 7 is [[ 3 + 7 ]]
```### Iterations
```html
```
### Conditions
```html
[[ post.title ]]
No posts
```### Document variables
* `title` -- Refers to the document title (the filename by default)
* `uri`
* `last_modified`
* `meta.author` -- Refers to the content atrribute of the `` element
* `meta.description`
* `meta.keywords`
* `meta.*`
* `directory.title`
* `directory.documents`
* `directory.stylesheets`
* `directory.scripts`
* `directory.files`
* `directory.resources`## Implementations
### Official
* PHP5.4+ (in development)
* Node.js (in development)