Skip to content

Commit

Permalink
Revert "add patreon link"
Browse files Browse the repository at this point in the history
This reverts commit bd6dc53.
  • Loading branch information
kbrsh committed Nov 29, 2017
1 parent bd6dc53 commit ac315d3
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 115 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,10 @@ Still, you do **not have to** use Moon if you are happy with your current soluti

See [the website.](http://moonjs.ga)

### Contributing
### How to Contribute?

Check the [CONTRIBUTING](/CONTRIBUTING.md) file for more information about this project and how to help.

### Support

Support Moon [on Patreon](https://patreon.com/kbrsh) to help sustain the development of the project. The maker of the project works on open source for free. If you or your company depend on this project, then it makes sense to donate to ensure that the project is maintained.

### License

Licensed under the [MIT License](http://kbrsh.github.io/license) by [Kabir Shah](https://kabir.ml)
5 changes: 1 addition & 4 deletions dist/moon.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,9 @@
var createNode = function(vnode) {
var type = vnode.type;
var data = vnode.data;
var existingNode = data.node;
var node;

if(existingNode !== undefined) {
node = existingNode;
} else if(type === "#text") {
if(type === "#text") {
// Create textnode
node = document.createTextNode(vnode.value);
} else {
Expand Down
2 changes: 1 addition & 1 deletion dist/moon.min.js

Large diffs are not rendered by default.

101 changes: 0 additions & 101 deletions src/compiler/lexer.js
Original file line number Diff line number Diff line change
@@ -1,104 +1,3 @@
// Concatenation Symbol
const concatenationSymbol = " + ";

// Opening delimiter
const openRE = /\{\{\s*/;

// Closing delimiter
const closeRE = /\s*\}\}/;

// Whitespace character
const whitespaceCharRE = /[\s\n]/;

// All whitespace
const whitespaceRE = /[\s\n]/g;

// Start of a tag or comment
const tagOrCommentStartRE = /<\/?(?:[A-Za-z]+\w*)|<!--/;

// Dynamic expressions
const expressionRE = /"[^"]*"|'[^']*'|\d+[a-zA-Z$_]\w*|\.[a-zA-Z$_]\w*|[a-zA-Z$_]\w*:|([a-zA-Z$_]\w*)(?:\s*\()?/g;

// HTML Escapes
const escapeRE = /(?:(?:&(?:lt|gt|quot|amp);)|"|\\|\n)/g;
const escapeMap = {
"&lt;": '<',
"&gt;": '>',
"&quot;": "\\\"",
"&amp;": '&',
'\\': "\\\\",
'"': "\\\"",
'\n': "\\n"
}

// Global Variables/Keywords
const globals = ["instance", "staticNodes", "true", "false", "undefined", "null", "NaN", "typeof", "in"];

// Void and SVG Elements
const VOID_ELEMENTS = ["area", "base", "br", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
const SVG_ELEMENTS = ["animate", "circle", "clippath", "cursor", "defs", "desc", "ellipse", "filter", "font-face", "foreignObject", "g", "glyph", "image", "line", "marker", "mask", "missing-glyph", "path", "pattern", "polygon", "polyline", "rect", "svg", "switch", "symbol", "text", "textpath", "tspan", "use", "view"];


const lex = function(template) {
const length = template.length;
let tokens = [];
let current = 0;

while(current < length) {
let char = template[current];
if(char === '<') {
current++;
if(template.substring(current, current + 3) === "!--") {
// Comment
current += 3;
const endOfComment = template.indexOf("-->", current);
if(endOfComment === -1) {
current = length;
} else {
current = endOfComment + 3;
}
} else {
// Tag
let tagToken = {
type: "Tag"
}
let tagType = '';

while(current < length) {

}

tagToken.value = tagType;
tokens.push(tagToken);
}
} else {
// Text
const textTail = template.substring(current);
const endOfText = textTail.search(tagOrCommentStartRE);
let text;
if(endOfText === -1) {
text = textTail;
current = length;
} else {
text = textTail.substring(0, endOfText);
current += endOfText;
}
if(text.replace(whitespaceRE, '').length !== 0) {
tokens.push({
type: "Text",
value: text.replace(escapeRE, function(match) {
return escapeMap[match];
})
});
}
}
}

return tokens;
}

console.log(JSON.stringify(lex("<div></div>"), null, 2))

const lex = function(template) {
const length = template.length;
let tokens = [];
Expand Down
5 changes: 1 addition & 4 deletions src/util/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ const addEvents = function(node, events) {
const createNode = function(vnode) {
const type = vnode.type;
let data = vnode.data;
const existingNode = data.node;
let node;

if(existingNode !== undefined) {
node = existingNode;
} else if(type === "#text") {
if(type === "#text") {
// Create textnode
node = document.createTextNode(vnode.value);
} else {
Expand Down

0 comments on commit ac315d3

Please sign in to comment.