Name: pug-source-gen
Owner: Pug
Description: Generate Pug source from a Pug AST.
Created: 2015-10-04 04:32:16.0
Updated: 2018-05-14 13:09:18.0
Pushed: 2018-05-14 13:09:17.0
Size: 14
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Generate Pug sources from a Pug AST. The resultant source may be different from the original Pug source, but the rendered output should be the same.
npm install pug-source-gen
lex = require('pug-lexer');
parse = require('pug-parser');
genSource = require('pug-source-gen');
source = `
ude a
n myMixin(arg)
ock
attributes(attributes) Paragraph: #[strong= arg]
ad
dy
p.klass(attr falseattr=false class=['myClass']) Introduction
+myMixin('Content').klass2
h1 Heading
ast = parse(lex(source));
generatedSource = genSource(ast);
>
nclude a
ixin myMixin(arg)
block
p&attributes(attributes) Paragraph: #[strong= arg]
tml
head
body
p.klass(attr falseattr=false class=['myClass']) Introduction
+myMixin('Content').klass2
h1 Heading
MIT