-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
54 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
hamlParser | ||
popularity 0.007524 | ||
description HTML tag via HAML syntax. | ||
extends abstractScrollParser | ||
atoms urlAtom | ||
catchAllAtomType stringAtom | ||
pattern ^[\w-]+(#|\.)[\w-\.\#]+ * | ||
javascript | ||
get tag() { | ||
return this.atoms[0].split(/[#\.]/).shift() | ||
} | ||
get htmlId() { | ||
const idMatch = this.atoms[0].match(/#([\w-]+)/) | ||
return idMatch ? idMatch[1] : "" | ||
} | ||
get htmlClasses() { | ||
return this.atoms[0].match(/\.([\w-]+)/g)?.map(cls => cls.slice(1)) || []; | ||
} | ||
compile() { | ||
const {htmlId, htmlClasses, content, tag} = this | ||
this.parent.sectionStack.push(`</${tag}>`) | ||
return `<${tag} ${htmlId ? ' id="' + htmlId + '"' : ""} ${htmlClasses ? ' class="' + htmlClasses.join(" ") + '"' : ""}>${content || ""}` | ||
} | ||
compileTxt() { | ||
return this.content | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
buildHtml | ||
buildTxt | ||
|
||
css | ||
#green {color: green;} | ||
.red {color:red;} | ||
.underline {text-decoration: underline;} | ||
|
||
h1#green Green | ||
|
||
h1.red Red | ||
|
||
div.red.underline Red underline | ||
|
||
|
||
div.underline#green Green underline | ||
|