Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
f764aee4
Commit
f764aee4
authored
13 years ago
by
Jacob Thornton
Browse files
Options
Download
Email Patches
Plain Diff
add templates for doc generation
parent
1209a375
Changes
85
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
docs/build/node_modules/hogan.js/tools/release.js
+74
-0
docs/build/node_modules/hogan.js/tools/release.js
docs/build/node_modules/hogan.js/tools/web_templates.js
+32
-0
docs/build/node_modules/hogan.js/tools/web_templates.js
docs/build/node_modules/hogan.js/web/1.0.0/hogan.js
+500
-0
docs/build/node_modules/hogan.js/web/1.0.0/hogan.js
docs/build/node_modules/hogan.js/web/1.0.0/hogan.min.js
+14
-0
docs/build/node_modules/hogan.js/web/1.0.0/hogan.min.js
docs/build/node_modules/hogan.js/web/builds/1.0.0/hogan.js
+500
-0
docs/build/node_modules/hogan.js/web/builds/1.0.0/hogan.js
docs/build/node_modules/hogan.js/web/builds/1.0.0/hogan.min.js
+14
-0
...build/node_modules/hogan.js/web/builds/1.0.0/hogan.min.js
docs/build/node_modules/hogan.js/web/builds/1.0.3/hogan.js
+545
-0
docs/build/node_modules/hogan.js/web/builds/1.0.3/hogan.js
docs/build/node_modules/hogan.js/web/builds/1.0.3/hogan.min.js
+5
-0
...build/node_modules/hogan.js/web/builds/1.0.3/hogan.min.js
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.amd.js
+576
-0
...node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.amd.js
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.common.js
+576
-0
...e_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.common.js
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.js
+572
-0
...ild/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.js
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.amd.js
+5
-0
..._modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.amd.js
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.common.js
+5
-0
...dules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.common.js
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.js
+5
-0
...node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.js
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.mustache.js
+5
-0
...les/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.mustache.js
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.mustache.js
+619
-0
...modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.mustache.js
docs/build/node_modules/hogan.js/web/builds/1.0.5/template-1.0.5.js
+233
-0
.../node_modules/hogan.js/web/builds/1.0.5/template-1.0.5.js
docs/build/node_modules/hogan.js/web/builds/1.0.5/template-1.0.5.min.js
+5
-0
...e_modules/hogan.js/web/builds/1.0.5/template-1.0.5.min.js
docs/build/node_modules/hogan.js/web/favicon.ico
+0
-0
docs/build/node_modules/hogan.js/web/favicon.ico
docs/build/node_modules/hogan.js/web/images/logo.png
+0
-0
docs/build/node_modules/hogan.js/web/images/logo.png
with
4285 additions
and
0 deletions
+4285
-0
docs/build/node_modules/hogan.js/tools/release.js
0 → 100644
+
74
-
0
View file @
f764aee4
/*
* Copyright 2011 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var
fs
=
require
(
'
fs
'
);
var
path
=
require
(
'
path
'
);
var
Hogan
=
require
(
__dirname
+
'
/../lib/hogan
'
);
var
minlicense
=
'
/**
\n
* @preserve Copyright 2012 Twitter, Inc.
\n
* @license http://www.apache.org/licenses/LICENSE-2.0.txt
\n
*/
\n
'
;
function
read
(
path
)
{
return
fs
.
readFileSync
(
path
).
toString
()
}
// Good enough for little js files
function
copy
(
src
,
dst
)
{
return
fs
.
writeFileSync
(
dst
,
read
(
src
));
}
function
uglify
(
src
,
dst
)
{
var
jsp
=
require
(
"
uglify-js
"
).
parser
;
var
pro
=
require
(
"
uglify-js
"
).
uglify
;
var
orig_code
=
read
(
src
);
var
ast
=
jsp
.
parse
(
orig_code
);
// parse code and get the initial AST
ast
=
pro
.
ast_mangle
(
ast
);
// get a new AST with mangled names
ast
=
pro
.
ast_squeeze
(
ast
);
// get an AST with compression optimizations
fs
.
writeFileSync
(
dst
,
minlicense
+
pro
.
gen_code
(
ast
));
}
var
packageJSON
=
JSON
.
parse
(
read
(
'
package.json
'
));
var
version
=
packageJSON
.
version
.
substring
(
0
,
packageJSON
.
version
.
indexOf
(
'
-
'
));
function
removeFirstComment
(
text
)
{
return
text
.
substring
(
text
.
indexOf
(
'
*/
'
)
+
2
);
}
var
context
=
{
template
:
removeFirstComment
(
read
(
__dirname
+
'
/../lib/template.js
'
)),
compiler
:
removeFirstComment
(
read
(
__dirname
+
'
/../lib/compiler.js
'
))
};
var
wrapperPath
=
'
/../wrappers/
'
;
var
wrappers
=
fs
.
readdirSync
(
__dirname
+
wrapperPath
).
map
(
function
(
f
)
{
return
__dirname
+
wrapperPath
+
f
;
});
var
distPath
=
__dirname
+
'
/../dist/
'
;
wrappers
.
forEach
(
function
(
wrapper
)
{
var
tail
=
path
.
basename
(
wrapper
,
'
.mustache
'
);
var
target
=
distPath
+
'
hogan-
'
+
version
+
'
.
'
+
tail
;
var
uglified
=
distPath
+
'
hogan-
'
+
version
+
'
.min.
'
+
tail
;
fs
.
writeFileSync
(
target
,
Hogan
.
compile
(
read
(
wrapper
)).
render
(
context
));
uglify
(
target
,
uglified
);
});
// Also release Hogan.Template on its own.
var
templateTarget
=
distPath
+
'
template-
'
+
version
+
'
.js
'
;
fs
.
writeFileSync
(
templateTarget
,
read
(
__dirname
+
'
/../lib/template.js
'
));
uglify
(
templateTarget
,
distPath
+
'
template-
'
+
version
+
'
.min.js
'
);
// Add packageJSON to node distribution
packageJSON
.
version
=
version
;
fs
.
writeFileSync
(
__dirname
+
'
/../dist/nodejs/package.json
'
,
JSON
.
stringify
(
packageJSON
,
null
,
"
"
));
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/tools/web_templates.js
0 → 100644
+
32
-
0
View file @
f764aee4
/*
* Copyright 2011 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var
Hogan
=
require
(
__dirname
+
'
/../lib/hogan.js
'
);
var
fs
=
require
(
'
fs
'
);
var
path
=
require
(
'
path
'
);
// Substitute variables in the homepage with values from package.json
var
homeTemplatePath
=
__dirname
+
'
/../build/gh-pages/index.html.mustache
'
;
var
contextPath
=
__dirname
+
'
/../dist/nodejs/package.json
'
;
var
homepage
=
fs
.
readFileSync
(
homeTemplatePath
).
toString
();
var
context
=
JSON
.
parse
(
fs
.
readFileSync
(
contextPath
).
toString
());
var
template
=
Hogan
.
compile
(
homepage
);
fs
.
writeFileSync
(
path
.
dirname
(
homeTemplatePath
)
+
'
/index.html
'
,
template
.
render
(
context
));
fs
.
unlinkSync
(
homeTemplatePath
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/1.0.0/hogan.js
0 → 100644
+
500
-
0
View file @
f764aee4
/*
* Copyright 2011 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var
HoganTemplate
=
(
function
()
{
function
constructor
(
text
)
{
this
.
text
=
text
;
};
constructor
.
prototype
=
{
// render: replaced by generated code.
r
:
function
(
context
,
partials
)
{
return
''
;
},
// variable escaping
v
:
hoganEscape
,
render
:
function
render
(
context
,
partials
)
{
return
this
.
r
(
context
,
partials
);
},
// tries to find a partial in the curent scope and render it
rp
:
function
(
name
,
context
,
partials
,
indent
)
{
var
partial
=
partials
[
name
];
if
(
!
partial
)
{
return
''
;
}
return
partial
.
render
(
context
,
partials
);
},
// render a section
rs
:
function
(
context
,
partials
,
section
)
{
var
buf
=
''
;
var
tail
=
context
[
context
.
length
-
1
];
if
(
!
isArray
(
tail
))
{
buf
=
section
(
context
,
partials
);
return
buf
;
}
for
(
var
i
=
0
;
i
<
tail
.
length
;
i
++
)
{
context
.
push
(
tail
[
i
]);
buf
+=
section
(
context
,
partials
);
context
.
pop
();
}
return
buf
;
},
// maybe start a section
s
:
function
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
)
{
if
(
isArray
(
val
)
&&
val
.
length
===
0
)
{
return
false
;
}
if
(
!
inverted
&&
typeof
val
==
'
function
'
)
{
val
=
this
.
ls
(
val
,
ctx
,
partials
,
start
,
end
);
}
var
pass
=
(
val
===
''
)
||
!!
val
;
if
(
!
inverted
&&
pass
&&
ctx
)
{
ctx
.
push
((
typeof
val
==
'
object
'
)
?
val
:
ctx
[
ctx
.
length
-
1
]);
}
return
pass
;
},
// find values with dotted names
d
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
if
(
key
===
'
.
'
&&
isArray
(
ctx
[
ctx
.
length
-
2
]))
{
return
ctx
[
ctx
.
length
-
1
];
}
var
names
=
key
.
split
(
'
.
'
);
var
val
=
this
.
f
(
names
[
0
],
ctx
,
partials
,
returnFound
);
var
cx
=
null
;
for
(
var
i
=
1
;
i
<
names
.
length
;
i
++
)
{
if
(
val
&&
typeof
val
==
'
object
'
&&
names
[
i
]
in
val
)
{
cx
=
val
;
val
=
val
[
names
[
i
]];
}
else
{
val
=
''
;
}
}
if
(
returnFound
&&
!
val
)
{
return
false
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
ctx
.
push
(
cx
);
val
=
this
.
lv
(
val
,
ctx
,
partials
);
ctx
.
pop
();
}
return
val
;
},
// find values with normal names
f
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
var
val
=
false
;
var
v
=
null
;
var
found
=
false
;
for
(
var
i
=
ctx
.
length
-
1
;
i
>=
0
;
i
--
)
{
v
=
ctx
[
i
];
if
(
v
&&
typeof
v
==
'
object
'
&&
key
in
v
)
{
val
=
v
[
key
];
found
=
true
;
break
;
}
}
if
(
!
found
)
{
return
(
returnFound
)
?
false
:
""
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
val
=
this
.
lv
(
val
,
ctx
,
partials
);
}
return
val
;
},
// higher order templates
ho
:
function
(
val
,
cx
,
partials
,
text
)
{
var
t
=
val
.
call
(
cx
,
text
,
function
(
t
)
{
return
Hogan
.
compile
(
t
).
render
(
cx
);
});
var
s
=
Hogan
.
compile
(
t
.
toString
()).
render
(
cx
,
partials
);
this
.
b
=
s
;
return
false
;
},
// higher order template result buffer
b
:
''
,
// lambda replace section
ls
:
function
(
val
,
ctx
,
partials
,
start
,
end
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
];
if
(
val
.
length
>
0
)
{
return
this
.
ho
(
val
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
));
}
var
t
=
val
.
call
(
cx
);
if
(
typeof
t
==
'
function
'
)
{
return
this
.
ho
(
t
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
));
}
return
t
;
},
// lambda replace variable
lv
:
function
(
val
,
ctx
,
partials
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
];
return
Hogan
.
compile
(
val
.
call
(
cx
).
toString
()).
render
(
cx
,
partials
);
}
};
var
rAmp
=
/&/g
,
rLt
=
/</g
,
rGt
=
/>/g
,
rApos
=
/
\'
/g
,
rQuot
=
/
\"
/g
,
hChars
=
/
[
&<>
\"\']
/
;
function
hoganEscape
(
str
)
{
var
s
=
String
(
str
===
null
?
''
:
str
);
return
hChars
.
test
(
s
)
?
s
.
replace
(
rAmp
,
'
&
'
)
.
replace
(
rLt
,
'
<
'
).
replace
(
rGt
,
'
>
'
)
.
replace
(
rApos
,
'
'
'
).
replace
(
rQuot
,
'
"
'
)
:
s
;
}
var
isArray
=
Array
.
isArray
||
function
(
a
)
{
return
Object
.
prototype
.
toString
.
call
(
a
)
===
'
[object Array]
'
;
}
return
constructor
;
})();
var
Hogan
=
(
function
()
{
function
scan
(
text
)
{
var
len
=
text
.
length
,
IN_TEXT
=
0
,
IN_TAG_TYPE
=
1
,
IN_TAG
=
2
,
state
=
IN_TEXT
,
tagType
=
null
,
buf
=
''
,
tokens
=
[],
seenTag
=
false
,
i
=
0
,
lineStart
=
0
,
otag
=
'
{{
'
,
ctag
=
'
}}
'
;
function
addBuf
()
{
if
(
buf
.
length
>
0
)
{
tokens
.
push
(
new
String
(
buf
));
buf
=
''
;
}
}
function
lineIsWhitespace
()
{
var
isAllWhitespace
=
true
;
for
(
var
j
=
lineStart
;
j
<
tokens
.
length
;
j
++
)
{
isAllWhitespace
=
(
tokens
[
j
].
tag
&&
tagTypes
[
tokens
[
j
].
tag
]
<
tagTypes
[
'
_v
'
])
||
(
!
tokens
[
j
].
tag
&&
tokens
[
j
].
match
(
rIsWhitespace
)
==
null
);
if
(
!
isAllWhitespace
)
{
return
false
;
}
}
return
isAllWhitespace
;
}
function
filterLine
(
haveSeenTag
,
noNewLine
)
{
addBuf
();
if
(
haveSeenTag
&&
lineIsWhitespace
())
{
for
(
var
j
=
lineStart
;
j
<
tokens
.
length
;
j
++
)
{
if
(
!
tokens
[
j
].
tag
)
{
tokens
.
splice
(
j
,
1
);
}
}
}
else
if
(
!
noNewLine
)
{
tokens
.
push
({
tag
:
'
\n
'
})
}
seenTag
=
false
;
lineStart
=
tokens
.
length
;
}
function
changeDelimiters
(
text
,
index
)
{
var
close
=
'
=
'
+
ctag
;
var
closeIndex
=
text
.
indexOf
(
close
,
index
);
var
delimiters
=
trim
(
text
.
substring
(
text
.
indexOf
(
'
=
'
,
index
)
+
1
,
closeIndex
)).
split
(
'
'
);
otag
=
delimiters
[
0
];
ctag
=
delimiters
[
1
];
return
closeIndex
+
close
.
length
-
1
;
}
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
state
==
IN_TEXT
)
{
if
(
tagChange
(
otag
,
text
,
i
))
{
--
i
;
addBuf
();
state
=
IN_TAG_TYPE
;
}
else
{
if
(
text
[
i
]
==
'
\n
'
)
{
filterLine
(
seenTag
);
}
else
{
buf
+=
text
[
i
];
}
}
}
else
if
(
state
==
IN_TAG_TYPE
)
{
i
+=
otag
.
length
-
1
;
var
tag
=
tagTypes
[
text
[
i
+
1
]];
tagType
=
tag
?
text
[
i
+
1
]
:
'
_v
'
;
seenTag
=
i
;
if
(
tagType
==
'
=
'
)
{
i
=
changeDelimiters
(
text
,
i
);
state
=
IN_TEXT
;
}
else
{
if
(
tag
)
{
i
++
;
}
state
=
IN_TAG
;
}
}
else
{
if
(
tagChange
(
ctag
,
text
,
i
))
{
i
+=
ctag
.
length
-
1
;
tokens
.
push
({
tag
:
tagType
,
n
:
trim
(
buf
),
i
:
(
tagType
==
'
/
'
)
?
seenTag
-
1
:
i
+
1
});
buf
=
''
;
state
=
IN_TEXT
;
if
(
tagType
==
'
{
'
)
{
i
++
;
}
}
else
{
buf
+=
text
[
i
];
}
}
}
filterLine
(
seenTag
,
true
);
return
tokens
;
}
function
trim
(
s
)
{
if
(
s
.
trim
)
{
return
s
.
trim
();
}
return
s
.
replace
(
/^
\s
*|
\s
*$/g
,
''
);
}
// remove whitespace according to Mustache spec
var
rIsWhitespace
=
/
\S
/
;
var
tagTypes
=
{
'
#
'
:
1
,
'
^
'
:
2
,
'
/
'
:
3
,
'
!
'
:
4
,
'
>
'
:
5
,
'
<
'
:
6
,
'
=
'
:
7
,
'
_v
'
:
8
,
'
{
'
:
9
,
'
&
'
:
10
};
function
tagChange
(
tag
,
text
,
index
)
{
if
(
text
[
index
]
!=
tag
[
0
])
{
return
false
;
}
for
(
var
i
=
1
,
l
=
tag
.
length
;
i
<
l
;
i
++
)
{
if
(
text
[
index
+
i
]
!=
tag
[
i
])
{
return
false
;
}
}
return
true
;
}
function
buildTree
(
tokens
,
kind
,
stack
,
customTags
)
{
var
instructions
=
[],
opener
=
null
,
token
=
null
;
while
(
tokens
.
length
>
0
)
{
token
=
tokens
.
shift
();
if
(
token
.
tag
==
'
#
'
||
token
.
tag
==
'
^
'
||
isOpener
(
token
,
customTags
))
{
stack
.
push
(
token
);
token
.
nodes
=
buildTree
(
tokens
,
token
.
tag
,
stack
,
customTags
);
instructions
.
push
(
token
);
}
else
if
(
token
.
tag
==
'
/
'
)
{
if
(
stack
.
length
==
0
)
{
throw
new
Error
(
'
Closing tag without opener: /
'
+
token
.
n
);
}
opener
=
stack
.
pop
();
if
(
token
.
n
!=
opener
.
n
&&
!
isCloser
(
token
.
n
,
opener
.
n
,
customTags
))
{
throw
new
Error
(
'
Nesting error:
'
+
opener
.
n
+
'
vs.
'
+
token
.
n
);
}
opener
.
end
=
token
.
i
;
return
instructions
;
}
else
{
instructions
.
push
(
token
);
}
}
if
(
stack
.
length
>
0
)
{
throw
new
Error
(
'
missing closing tag:
'
+
stack
.
pop
().
n
);
}
return
instructions
;
}
function
isOpener
(
token
,
tags
)
{
for
(
var
i
=
0
,
l
=
tags
.
length
;
i
<
l
;
i
++
)
{
if
(
tags
[
i
].
o
==
token
.
n
)
{
token
.
tag
=
'
#
'
;
return
true
;
}
}
}
function
isCloser
(
close
,
open
,
tags
)
{
for
(
var
i
=
0
,
l
=
tags
.
length
;
i
<
l
;
i
++
)
{
if
(
tags
[
i
].
c
==
close
&&
tags
[
i
].
o
==
open
)
{
return
true
;
}
}
}
function
generate
(
tree
,
text
,
options
)
{
var
code
=
'
var c = [cx];var b = "";var _ = this;
'
+
walk
(
tree
)
+
'
return b;
'
;
if
(
options
.
asString
)
{
return
'
function(cx,p){
'
+
code
+
'
;};
'
;
}
var
template
=
new
HoganTemplate
(
text
);
template
.
r
=
new
Function
(
'
cx
'
,
'
p
'
,
code
);
return
template
;
}
var
rQuot
=
/
\"
/g
,
rNewline
=
/
\n
/g
,
rCr
=
/
\r
/g
,
rSlash
=
/
\\
/g
;
function
esc
(
s
)
{
return
s
.
replace
(
rSlash
,
'
\\\\
'
)
.
replace
(
rQuot
,
'
\\\
"
'
)
.
replace
(
rNewline
,
'
\\
n
'
)
.
replace
(
rCr
,
'
\\
r
'
)
};
function
chooseMethod
(
s
)
{
return
(
~
s
.
indexOf
(
'
.
'
))
?
'
d
'
:
'
f
'
;
}
function
walk
(
tree
)
{
var
code
=
''
;
for
(
var
i
=
0
,
l
=
tree
.
length
;
i
<
l
;
i
++
)
{
var
tag
=
tree
[
i
].
tag
;
if
(
tag
==
'
#
'
)
{
code
+=
section
(
tree
[
i
].
nodes
,
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
),
tree
[
i
].
i
,
tree
[
i
].
end
);
}
else
if
(
tag
==
'
^
'
)
{
code
+=
invertedSection
(
tree
[
i
].
nodes
,
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
==
'
<
'
||
tag
==
'
>
'
)
{
code
+=
partial
(
tree
[
i
].
n
);
}
else
if
(
tag
==
'
{
'
||
tag
==
'
&
'
)
{
code
+=
tripleStache
(
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
==
'
\n
'
)
{
code
+=
text
(
'
\n
'
);
}
else
if
(
tag
==
'
_v
'
)
{
code
+=
variable
(
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
===
undefined
)
{
code
+=
text
(
tree
[
i
]);
}
}
return
code
;
}
function
section
(
nodes
,
id
,
method
,
start
,
end
)
{
var
code
=
'
if(_.s(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,1),
'
;
code
+=
'
c,p,0,
'
+
start
+
'
,
'
+
end
+
'
)){
'
;
code
+=
'
b += _.rs(c,p,
'
;
code
+=
'
function(c,p){ var b = "";
'
;
code
+=
walk
(
nodes
);
code
+=
'
return b;});c.pop();}
'
;
code
+=
'
else{b += _.b; _.b = ""};
'
;
return
code
;
}
function
invertedSection
(
nodes
,
id
,
method
)
{
var
code
=
'
if (!_.s(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,1),c,p,1,0,0)){
'
;
code
+=
walk
(
nodes
);
code
+=
'
};
'
;
return
code
;
}
function
partial
(
id
)
{
return
'
b += _.rp("
'
+
esc
(
id
)
+
'
",c[c.length - 1],p);
'
;
}
function
tripleStache
(
id
,
method
)
{
return
'
b += (_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,0));
'
;
}
function
variable
(
id
,
method
)
{
return
'
b += (_.v(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,0)));
'
;
}
function
text
(
id
)
{
return
'
b += "
'
+
esc
(
id
)
+
'
";
'
;
}
return
({
scan
:
scan
,
parse
:
function
(
tokens
,
options
)
{
options
=
options
||
{};
return
buildTree
(
tokens
,
''
,
[],
options
.
sectionTags
||
[]);
},
cache
:
{},
compile
:
function
(
text
,
options
)
{
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
options
=
options
||
{};
var
t
=
this
.
cache
[
text
];
if
(
t
)
{
return
t
;
}
t
=
generate
(
this
.
parse
(
scan
(
text
),
options
),
text
,
options
);
return
this
.
cache
[
text
]
=
t
;
}
});
})();
// Export the hogan constructor for Node.js and CommonJS.
if
(
typeof
module
!==
'
undefined
'
&&
module
.
exports
)
{
module
.
exports
=
Hogan
;
module
.
exports
.
Template
=
HoganTemplate
;
}
else
if
(
typeof
exports
!==
'
undefined
'
)
{
exports
.
Hogan
=
Hogan
;
exports
.
HoganTemplate
=
HoganTemplate
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/1.0.0/hogan.min.js
0 → 100644
+
14
-
0
View file @
f764aee4
/*
* Copyright 2011 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var
HoganTemplate
=
function
(){
function
a
(
a
){
this
.
text
=
a
}
function
h
(
a
){
var
h
=
String
(
a
===
null
?
""
:
a
);
return
g
.
test
(
h
)?
h
.
replace
(
b
,
"
&
"
).
replace
(
c
,
"
<
"
).
replace
(
d
,
"
>
"
).
replace
(
e
,
"
'
"
).
replace
(
f
,
"
"
"
):
h
}
a
.
prototype
=
{
r
:
function
(
a
,
b
){
return
""
},
v
:
h
,
render
:
function
(
a
,
b
){
return
this
.
r
(
a
,
b
)},
rp
:
function
(
a
,
b
,
c
,
d
){
var
e
=
c
[
a
];
return
e
?
e
.
render
(
b
,
c
):
""
},
rs
:
function
(
a
,
b
,
c
){
var
d
=
""
,
e
=
a
[
a
.
length
-
1
];
if
(
!
i
(
e
))
return
d
=
c
(
a
,
b
),
d
;
for
(
var
f
=
0
;
f
<
e
.
length
;
f
++
)
a
.
push
(
e
[
f
]),
d
+=
c
(
a
,
b
),
a
.
pop
();
return
d
},
s
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
if
(
i
(
a
)
&&
a
.
length
===
0
)
return
!
1
;
!
d
&&
typeof
a
==
"
function
"
&&
(
a
=
this
.
ls
(
a
,
b
,
c
,
e
,
f
));
var
g
=
a
===
""
||!!
a
;
return
!
d
&&
g
&&
b
&&
b
.
push
(
typeof
a
==
"
object
"
?
a
:
b
[
b
.
length
-
1
]),
g
},
d
:
function
(
a
,
b
,
c
,
d
){
if
(
a
===
"
.
"
&&
i
(
b
[
b
.
length
-
2
]))
return
b
[
b
.
length
-
1
];
var
e
=
a
.
split
(
"
.
"
),
f
=
this
.
f
(
e
[
0
],
b
,
c
,
d
),
g
=
null
;
for
(
var
h
=
1
;
h
<
e
.
length
;
h
++
)
f
&&
typeof
f
==
"
object
"
&&
e
[
h
]
in
f
?(
g
=
f
,
f
=
f
[
e
[
h
]]):
f
=
""
;
return
d
&&!
f
?
!
1
:(
!
d
&&
typeof
f
==
"
function
"
&&
(
b
.
push
(
g
),
f
=
this
.
lv
(
f
,
b
,
c
),
b
.
pop
()),
f
)},
f
:
function
(
a
,
b
,
c
,
d
){
var
e
=!
1
,
f
=
null
,
g
=!
1
;
for
(
var
h
=
b
.
length
-
1
;
h
>=
0
;
h
--
){
f
=
b
[
h
];
if
(
f
&&
typeof
f
==
"
object
"
&&
a
in
f
){
e
=
f
[
a
],
g
=!
0
;
break
}}
return
g
?(
!
d
&&
typeof
e
==
"
function
"
&&
(
e
=
this
.
lv
(
e
,
b
,
c
)),
e
):
d
?
!
1
:
""
},
ho
:
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
call
(
b
,
d
,
function
(
a
){
return
Hogan
.
compile
(
a
).
render
(
b
)}),
f
=
Hogan
.
compile
(
e
.
toString
()).
render
(
b
,
c
);
return
this
.
b
=
f
,
!
1
},
b
:
""
,
ls
:
function
(
a
,
b
,
c
,
d
,
e
){
var
f
=
b
[
b
.
length
-
1
];
if
(
a
.
length
>
0
)
return
this
.
ho
(
a
,
f
,
c
,
this
.
text
.
substring
(
d
,
e
));
var
g
=
a
.
call
(
f
);
return
typeof
g
==
"
function
"
?
this
.
ho
(
g
,
f
,
c
,
this
.
text
.
substring
(
d
,
e
)):
g
},
lv
:
function
(
a
,
b
,
c
){
var
d
=
b
[
b
.
length
-
1
];
return
Hogan
.
compile
(
a
.
call
(
d
).
toString
()).
render
(
d
,
c
)}};
var
b
=
/&/g
,
c
=
/</g
,
d
=
/>/g
,
e
=
/
\'
/g
,
f
=
/
\"
/g
,
g
=
/
[
&<>
\"\']
/
,
i
=
Array
.
isArray
||
function
(
a
){
return
Object
.
prototype
.
toString
.
call
(
a
)
===
"
[object Array]
"
};
return
a
}(),
Hogan
=
function
(){
function
a
(
a
){
function
s
(){
l
.
length
>
0
&&
(
m
.
push
(
new
String
(
l
)),
l
=
""
)}
function
t
(){
var
a
=!
0
;
for
(
var
b
=
p
;
b
<
m
.
length
;
b
++
){
a
=
m
[
b
].
tag
&&
d
[
m
[
b
].
tag
]
<
d
.
_v
||!
m
[
b
].
tag
&&
m
[
b
].
match
(
c
)
==
null
;
if
(
!
a
)
return
!
1
}
return
a
}
function
u
(
a
,
b
){
s
();
if
(
a
&&
t
())
for
(
var
c
=
p
;
c
<
m
.
length
;
c
++
)
m
[
c
].
tag
||
m
.
splice
(
c
,
1
);
else
b
||
m
.
push
({
tag
:
"
\n
"
});
n
=!
1
,
p
=
m
.
length
}
function
v
(
a
,
c
){
var
d
=
"
=
"
+
r
,
e
=
a
.
indexOf
(
d
,
c
),
f
=
b
(
a
.
substring
(
a
.
indexOf
(
"
=
"
,
c
)
+
1
,
e
)).
split
(
"
"
);
return
q
=
f
[
0
],
r
=
f
[
1
],
e
+
d
.
length
-
1
}
var
f
=
a
.
length
,
g
=
0
,
h
=
1
,
i
=
2
,
j
=
g
,
k
=
null
,
l
=
""
,
m
=
[],
n
=!
1
,
o
=
0
,
p
=
0
,
q
=
"
{{
"
,
r
=
"
}}
"
;
for
(
o
=
0
;
o
<
f
;
o
++
)
if
(
j
==
g
)
e
(
q
,
a
,
o
)?(
--
o
,
s
(),
j
=
h
):
a
[
o
]
==
"
\n
"
?
u
(
n
):
l
+=
a
[
o
];
else
if
(
j
==
h
){
o
+=
q
.
length
-
1
;
var
w
=
d
[
a
[
o
+
1
]];
k
=
w
?
a
[
o
+
1
]:
"
_v
"
,
n
=
o
,
k
==
"
=
"
?(
o
=
v
(
a
,
o
),
j
=
g
):(
w
&&
o
++
,
j
=
i
)}
else
e
(
r
,
a
,
o
)?(
o
+=
r
.
length
-
1
,
m
.
push
({
tag
:
k
,
n
:
b
(
l
),
i
:
k
==
"
/
"
?
n
-
1
:
o
+
1
}),
l
=
""
,
j
=
g
,
k
==
"
{
"
&&
o
++
):
l
+=
a
[
o
];
return
u
(
n
,
!
0
),
m
}
function
b
(
a
){
return
a
.
trim
?
a
.
trim
():
a
.
replace
(
/^
\s
*|
\s
*$/g
,
""
)}
function
e
(
a
,
b
,
c
){
if
(
b
[
c
]
!=
a
[
0
])
return
!
1
;
for
(
var
d
=
1
,
e
=
a
.
length
;
d
<
e
;
d
++
)
if
(
b
[
c
+
d
]
!=
a
[
d
])
return
!
1
;
return
!
0
}
function
f
(
a
,
b
,
c
,
d
){
var
e
=
[],
i
=
null
,
j
=
null
;
while
(
a
.
length
>
0
){
j
=
a
.
shift
();
if
(
j
.
tag
==
"
#
"
||
j
.
tag
==
"
^
"
||
g
(
j
,
d
))
c
.
push
(
j
),
j
.
nodes
=
f
(
a
,
j
.
tag
,
c
,
d
),
e
.
push
(
j
);
else
{
if
(
j
.
tag
==
"
/
"
){
if
(
c
.
length
==
0
)
throw
new
Error
(
"
Closing tag without opener: /
"
+
j
.
n
);
i
=
c
.
pop
();
if
(
j
.
n
!=
i
.
n
&&!
h
(
j
.
n
,
i
.
n
,
d
))
throw
new
Error
(
"
Nesting error:
"
+
i
.
n
+
"
vs.
"
+
j
.
n
);
return
i
.
end
=
j
.
i
,
e
}
e
.
push
(
j
)}}
if
(
c
.
length
>
0
)
throw
new
Error
(
"
missing closing tag:
"
+
c
.
pop
().
n
);
return
e
}
function
g
(
a
,
b
){
for
(
var
c
=
0
,
d
=
b
.
length
;
c
<
d
;
c
++
)
if
(
b
[
c
].
o
==
a
.
n
)
return
a
.
tag
=
"
#
"
,
!
0
}
function
h
(
a
,
b
,
c
){
for
(
var
d
=
0
,
e
=
c
.
length
;
d
<
e
;
d
++
)
if
(
c
[
d
].
c
==
a
&&
c
[
d
].
o
==
b
)
return
!
0
}
function
i
(
a
,
b
,
c
){
var
d
=
'
var c = [cx];var b = "";var _ = this;
'
+
p
(
a
)
+
"
return b;
"
;
if
(
c
.
asString
)
return
"
function(cx,p){
"
+
d
+
"
;};
"
;
var
e
=
new
HoganTemplate
(
b
);
return
e
.
r
=
new
Function
(
"
cx
"
,
"
p
"
,
d
),
e
}
function
n
(
a
){
return
a
.
replace
(
m
,
"
\\\\
"
).
replace
(
j
,
'
\\
"
'
).
replace
(
k
,
"
\\
n
"
).
replace
(
l
,
"
\\
r
"
)}
function
o
(
a
){
return
~
a
.
indexOf
(
"
.
"
)?
"
d
"
:
"
f
"
}
function
p
(
a
){
var
b
=
""
;
for
(
var
c
=
0
,
d
=
a
.
length
;
c
<
d
;
c
++
){
var
e
=
a
[
c
].
tag
;
e
==
"
#
"
?
b
+=
q
(
a
[
c
].
nodes
,
a
[
c
].
n
,
o
(
a
[
c
].
n
),
a
[
c
].
i
,
a
[
c
].
end
):
e
==
"
^
"
?
b
+=
r
(
a
[
c
].
nodes
,
a
[
c
].
n
,
o
(
a
[
c
].
n
)):
e
==
"
<
"
||
e
==
"
>
"
?
b
+=
s
(
a
[
c
].
n
):
e
==
"
{
"
||
e
==
"
&
"
?
b
+=
t
(
a
[
c
].
n
,
o
(
a
[
c
].
n
)):
e
==
"
\n
"
?
b
+=
v
(
"
\n
"
):
e
==
"
_v
"
?
b
+=
u
(
a
[
c
].
n
,
o
(
a
[
c
].
n
)):
e
===
undefined
&&
(
b
+=
v
(
a
[
c
]))}
return
b
}
function
q
(
a
,
b
,
c
,
d
,
e
){
var
f
=
"
if(_.s(_.
"
+
c
+
'
("
'
+
n
(
b
)
+
'
",c,p,1),
'
;
return
f
+=
"
c,p,0,
"
+
d
+
"
,
"
+
e
+
"
)){
"
,
f
+=
"
b += _.rs(c,p,
"
,
f
+=
'
function(c,p){ var b = "";
'
,
f
+=
p
(
a
),
f
+=
"
return b;});c.pop();}
"
,
f
+=
'
else{b += _.b; _.b = ""};
'
,
f
}
function
r
(
a
,
b
,
c
){
var
d
=
"
if (!_.s(_.
"
+
c
+
'
("
'
+
n
(
b
)
+
'
",c,p,1),c,p,1,0,0)){
'
;
return
d
+=
p
(
a
),
d
+=
"
};
"
,
d
}
function
s
(
a
){
return
'
b += _.rp("
'
+
n
(
a
)
+
'
",c[c.length - 1],p);
'
}
function
t
(
a
,
b
){
return
"
b += (_.
"
+
b
+
'
("
'
+
n
(
a
)
+
'
",c,p,0));
'
}
function
u
(
a
,
b
){
return
"
b += (_.v(_.
"
+
b
+
'
("
'
+
n
(
a
)
+
'
",c,p,0)));
'
}
function
v
(
a
){
return
'
b += "
'
+
n
(
a
)
+
'
";
'
}
var
c
=
/
\S
/
,
d
=
{
"
#
"
:
1
,
"
^
"
:
2
,
"
/
"
:
3
,
"
!
"
:
4
,
"
>
"
:
5
,
"
<
"
:
6
,
"
=
"
:
7
,
_v
:
8
,
"
{
"
:
9
,
"
&
"
:
10
},
j
=
/
\"
/g
,
k
=
/
\n
/g
,
l
=
/
\r
/g
,
m
=
/
\\
/g
;
return
{
scan
:
a
,
parse
:
function
(
a
,
b
){
return
b
=
b
||
{},
f
(
a
,
""
,[],
b
.
sectionTags
||
[])},
cache
:{},
compile
:
function
(
b
,
c
){
c
=
c
||
{};
var
d
=
this
.
cache
[
b
];
return
d
?
d
:(
d
=
i
(
this
.
parse
(
a
(
b
),
c
),
b
,
c
),
this
.
cache
[
b
]
=
d
)}}}();
typeof
module
!=
"
undefined
"
&&
module
.
exports
?(
module
.
exports
=
Hogan
,
module
.
exports
.
Template
=
HoganTemplate
):
typeof
exports
!=
"
undefined
"
&&
(
exports
.
Hogan
=
Hogan
,
exports
.
HoganTemplate
=
HoganTemplate
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/builds/1.0.0/hogan.js
0 → 100644
+
500
-
0
View file @
f764aee4
/*
* Copyright 2011 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var
HoganTemplate
=
(
function
()
{
function
constructor
(
text
)
{
this
.
text
=
text
;
};
constructor
.
prototype
=
{
// render: replaced by generated code.
r
:
function
(
context
,
partials
)
{
return
''
;
},
// variable escaping
v
:
hoganEscape
,
render
:
function
render
(
context
,
partials
)
{
return
this
.
r
(
context
,
partials
);
},
// tries to find a partial in the curent scope and render it
rp
:
function
(
name
,
context
,
partials
,
indent
)
{
var
partial
=
partials
[
name
];
if
(
!
partial
)
{
return
''
;
}
return
partial
.
render
(
context
,
partials
);
},
// render a section
rs
:
function
(
context
,
partials
,
section
)
{
var
buf
=
''
;
var
tail
=
context
[
context
.
length
-
1
];
if
(
!
isArray
(
tail
))
{
buf
=
section
(
context
,
partials
);
return
buf
;
}
for
(
var
i
=
0
;
i
<
tail
.
length
;
i
++
)
{
context
.
push
(
tail
[
i
]);
buf
+=
section
(
context
,
partials
);
context
.
pop
();
}
return
buf
;
},
// maybe start a section
s
:
function
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
)
{
if
(
isArray
(
val
)
&&
val
.
length
===
0
)
{
return
false
;
}
if
(
!
inverted
&&
typeof
val
==
'
function
'
)
{
val
=
this
.
ls
(
val
,
ctx
,
partials
,
start
,
end
);
}
var
pass
=
(
val
===
''
)
||
!!
val
;
if
(
!
inverted
&&
pass
&&
ctx
)
{
ctx
.
push
((
typeof
val
==
'
object
'
)
?
val
:
ctx
[
ctx
.
length
-
1
]);
}
return
pass
;
},
// find values with dotted names
d
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
if
(
key
===
'
.
'
&&
isArray
(
ctx
[
ctx
.
length
-
2
]))
{
return
ctx
[
ctx
.
length
-
1
];
}
var
names
=
key
.
split
(
'
.
'
);
var
val
=
this
.
f
(
names
[
0
],
ctx
,
partials
,
returnFound
);
var
cx
=
null
;
for
(
var
i
=
1
;
i
<
names
.
length
;
i
++
)
{
if
(
val
&&
typeof
val
==
'
object
'
&&
names
[
i
]
in
val
)
{
cx
=
val
;
val
=
val
[
names
[
i
]];
}
else
{
val
=
''
;
}
}
if
(
returnFound
&&
!
val
)
{
return
false
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
ctx
.
push
(
cx
);
val
=
this
.
lv
(
val
,
ctx
,
partials
);
ctx
.
pop
();
}
return
val
;
},
// find values with normal names
f
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
var
val
=
false
;
var
v
=
null
;
var
found
=
false
;
for
(
var
i
=
ctx
.
length
-
1
;
i
>=
0
;
i
--
)
{
v
=
ctx
[
i
];
if
(
v
&&
typeof
v
==
'
object
'
&&
key
in
v
)
{
val
=
v
[
key
];
found
=
true
;
break
;
}
}
if
(
!
found
)
{
return
(
returnFound
)
?
false
:
""
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
val
=
this
.
lv
(
val
,
ctx
,
partials
);
}
return
val
;
},
// higher order templates
ho
:
function
(
val
,
cx
,
partials
,
text
)
{
var
t
=
val
.
call
(
cx
,
text
,
function
(
t
)
{
return
Hogan
.
compile
(
t
).
render
(
cx
);
});
var
s
=
Hogan
.
compile
(
t
.
toString
()).
render
(
cx
,
partials
);
this
.
b
=
s
;
return
false
;
},
// higher order template result buffer
b
:
''
,
// lambda replace section
ls
:
function
(
val
,
ctx
,
partials
,
start
,
end
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
];
if
(
val
.
length
>
0
)
{
return
this
.
ho
(
val
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
));
}
var
t
=
val
.
call
(
cx
);
if
(
typeof
t
==
'
function
'
)
{
return
this
.
ho
(
t
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
));
}
return
t
;
},
// lambda replace variable
lv
:
function
(
val
,
ctx
,
partials
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
];
return
Hogan
.
compile
(
val
.
call
(
cx
).
toString
()).
render
(
cx
,
partials
);
}
};
var
rAmp
=
/&/g
,
rLt
=
/</g
,
rGt
=
/>/g
,
rApos
=
/
\'
/g
,
rQuot
=
/
\"
/g
,
hChars
=
/
[
&<>
\"\']
/
;
function
hoganEscape
(
str
)
{
var
s
=
String
(
str
===
null
?
''
:
str
);
return
hChars
.
test
(
s
)
?
s
.
replace
(
rAmp
,
'
&
'
)
.
replace
(
rLt
,
'
<
'
).
replace
(
rGt
,
'
>
'
)
.
replace
(
rApos
,
'
'
'
).
replace
(
rQuot
,
'
"
'
)
:
s
;
}
var
isArray
=
Array
.
isArray
||
function
(
a
)
{
return
Object
.
prototype
.
toString
.
call
(
a
)
===
'
[object Array]
'
;
}
return
constructor
;
})();
var
Hogan
=
(
function
()
{
function
scan
(
text
)
{
var
len
=
text
.
length
,
IN_TEXT
=
0
,
IN_TAG_TYPE
=
1
,
IN_TAG
=
2
,
state
=
IN_TEXT
,
tagType
=
null
,
buf
=
''
,
tokens
=
[],
seenTag
=
false
,
i
=
0
,
lineStart
=
0
,
otag
=
'
{{
'
,
ctag
=
'
}}
'
;
function
addBuf
()
{
if
(
buf
.
length
>
0
)
{
tokens
.
push
(
new
String
(
buf
));
buf
=
''
;
}
}
function
lineIsWhitespace
()
{
var
isAllWhitespace
=
true
;
for
(
var
j
=
lineStart
;
j
<
tokens
.
length
;
j
++
)
{
isAllWhitespace
=
(
tokens
[
j
].
tag
&&
tagTypes
[
tokens
[
j
].
tag
]
<
tagTypes
[
'
_v
'
])
||
(
!
tokens
[
j
].
tag
&&
tokens
[
j
].
match
(
rIsWhitespace
)
==
null
);
if
(
!
isAllWhitespace
)
{
return
false
;
}
}
return
isAllWhitespace
;
}
function
filterLine
(
haveSeenTag
,
noNewLine
)
{
addBuf
();
if
(
haveSeenTag
&&
lineIsWhitespace
())
{
for
(
var
j
=
lineStart
;
j
<
tokens
.
length
;
j
++
)
{
if
(
!
tokens
[
j
].
tag
)
{
tokens
.
splice
(
j
,
1
);
}
}
}
else
if
(
!
noNewLine
)
{
tokens
.
push
({
tag
:
'
\n
'
})
}
seenTag
=
false
;
lineStart
=
tokens
.
length
;
}
function
changeDelimiters
(
text
,
index
)
{
var
close
=
'
=
'
+
ctag
;
var
closeIndex
=
text
.
indexOf
(
close
,
index
);
var
delimiters
=
trim
(
text
.
substring
(
text
.
indexOf
(
'
=
'
,
index
)
+
1
,
closeIndex
)).
split
(
'
'
);
otag
=
delimiters
[
0
];
ctag
=
delimiters
[
1
];
return
closeIndex
+
close
.
length
-
1
;
}
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
state
==
IN_TEXT
)
{
if
(
tagChange
(
otag
,
text
,
i
))
{
--
i
;
addBuf
();
state
=
IN_TAG_TYPE
;
}
else
{
if
(
text
[
i
]
==
'
\n
'
)
{
filterLine
(
seenTag
);
}
else
{
buf
+=
text
[
i
];
}
}
}
else
if
(
state
==
IN_TAG_TYPE
)
{
i
+=
otag
.
length
-
1
;
var
tag
=
tagTypes
[
text
[
i
+
1
]];
tagType
=
tag
?
text
[
i
+
1
]
:
'
_v
'
;
seenTag
=
i
;
if
(
tagType
==
'
=
'
)
{
i
=
changeDelimiters
(
text
,
i
);
state
=
IN_TEXT
;
}
else
{
if
(
tag
)
{
i
++
;
}
state
=
IN_TAG
;
}
}
else
{
if
(
tagChange
(
ctag
,
text
,
i
))
{
i
+=
ctag
.
length
-
1
;
tokens
.
push
({
tag
:
tagType
,
n
:
trim
(
buf
),
i
:
(
tagType
==
'
/
'
)
?
seenTag
-
1
:
i
+
1
});
buf
=
''
;
state
=
IN_TEXT
;
if
(
tagType
==
'
{
'
)
{
i
++
;
}
}
else
{
buf
+=
text
[
i
];
}
}
}
filterLine
(
seenTag
,
true
);
return
tokens
;
}
function
trim
(
s
)
{
if
(
s
.
trim
)
{
return
s
.
trim
();
}
return
s
.
replace
(
/^
\s
*|
\s
*$/g
,
''
);
}
// remove whitespace according to Mustache spec
var
rIsWhitespace
=
/
\S
/
;
var
tagTypes
=
{
'
#
'
:
1
,
'
^
'
:
2
,
'
/
'
:
3
,
'
!
'
:
4
,
'
>
'
:
5
,
'
<
'
:
6
,
'
=
'
:
7
,
'
_v
'
:
8
,
'
{
'
:
9
,
'
&
'
:
10
};
function
tagChange
(
tag
,
text
,
index
)
{
if
(
text
[
index
]
!=
tag
[
0
])
{
return
false
;
}
for
(
var
i
=
1
,
l
=
tag
.
length
;
i
<
l
;
i
++
)
{
if
(
text
[
index
+
i
]
!=
tag
[
i
])
{
return
false
;
}
}
return
true
;
}
function
buildTree
(
tokens
,
kind
,
stack
,
customTags
)
{
var
instructions
=
[],
opener
=
null
,
token
=
null
;
while
(
tokens
.
length
>
0
)
{
token
=
tokens
.
shift
();
if
(
token
.
tag
==
'
#
'
||
token
.
tag
==
'
^
'
||
isOpener
(
token
,
customTags
))
{
stack
.
push
(
token
);
token
.
nodes
=
buildTree
(
tokens
,
token
.
tag
,
stack
,
customTags
);
instructions
.
push
(
token
);
}
else
if
(
token
.
tag
==
'
/
'
)
{
if
(
stack
.
length
==
0
)
{
throw
new
Error
(
'
Closing tag without opener: /
'
+
token
.
n
);
}
opener
=
stack
.
pop
();
if
(
token
.
n
!=
opener
.
n
&&
!
isCloser
(
token
.
n
,
opener
.
n
,
customTags
))
{
throw
new
Error
(
'
Nesting error:
'
+
opener
.
n
+
'
vs.
'
+
token
.
n
);
}
opener
.
end
=
token
.
i
;
return
instructions
;
}
else
{
instructions
.
push
(
token
);
}
}
if
(
stack
.
length
>
0
)
{
throw
new
Error
(
'
missing closing tag:
'
+
stack
.
pop
().
n
);
}
return
instructions
;
}
function
isOpener
(
token
,
tags
)
{
for
(
var
i
=
0
,
l
=
tags
.
length
;
i
<
l
;
i
++
)
{
if
(
tags
[
i
].
o
==
token
.
n
)
{
token
.
tag
=
'
#
'
;
return
true
;
}
}
}
function
isCloser
(
close
,
open
,
tags
)
{
for
(
var
i
=
0
,
l
=
tags
.
length
;
i
<
l
;
i
++
)
{
if
(
tags
[
i
].
c
==
close
&&
tags
[
i
].
o
==
open
)
{
return
true
;
}
}
}
function
generate
(
tree
,
text
,
options
)
{
var
code
=
'
var c = [cx];var b = "";var _ = this;
'
+
walk
(
tree
)
+
'
return b;
'
;
if
(
options
.
asString
)
{
return
'
function(cx,p){
'
+
code
+
'
;};
'
;
}
var
template
=
new
HoganTemplate
(
text
);
template
.
r
=
new
Function
(
'
cx
'
,
'
p
'
,
code
);
return
template
;
}
var
rQuot
=
/
\"
/g
,
rNewline
=
/
\n
/g
,
rCr
=
/
\r
/g
,
rSlash
=
/
\\
/g
;
function
esc
(
s
)
{
return
s
.
replace
(
rSlash
,
'
\\\\
'
)
.
replace
(
rQuot
,
'
\\\
"
'
)
.
replace
(
rNewline
,
'
\\
n
'
)
.
replace
(
rCr
,
'
\\
r
'
)
};
function
chooseMethod
(
s
)
{
return
(
~
s
.
indexOf
(
'
.
'
))
?
'
d
'
:
'
f
'
;
}
function
walk
(
tree
)
{
var
code
=
''
;
for
(
var
i
=
0
,
l
=
tree
.
length
;
i
<
l
;
i
++
)
{
var
tag
=
tree
[
i
].
tag
;
if
(
tag
==
'
#
'
)
{
code
+=
section
(
tree
[
i
].
nodes
,
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
),
tree
[
i
].
i
,
tree
[
i
].
end
);
}
else
if
(
tag
==
'
^
'
)
{
code
+=
invertedSection
(
tree
[
i
].
nodes
,
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
==
'
<
'
||
tag
==
'
>
'
)
{
code
+=
partial
(
tree
[
i
].
n
);
}
else
if
(
tag
==
'
{
'
||
tag
==
'
&
'
)
{
code
+=
tripleStache
(
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
==
'
\n
'
)
{
code
+=
text
(
'
\n
'
);
}
else
if
(
tag
==
'
_v
'
)
{
code
+=
variable
(
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
===
undefined
)
{
code
+=
text
(
tree
[
i
]);
}
}
return
code
;
}
function
section
(
nodes
,
id
,
method
,
start
,
end
)
{
var
code
=
'
if(_.s(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,1),
'
;
code
+=
'
c,p,0,
'
+
start
+
'
,
'
+
end
+
'
)){
'
;
code
+=
'
b += _.rs(c,p,
'
;
code
+=
'
function(c,p){ var b = "";
'
;
code
+=
walk
(
nodes
);
code
+=
'
return b;});c.pop();}
'
;
code
+=
'
else{b += _.b; _.b = ""};
'
;
return
code
;
}
function
invertedSection
(
nodes
,
id
,
method
)
{
var
code
=
'
if (!_.s(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,1),c,p,1,0,0)){
'
;
code
+=
walk
(
nodes
);
code
+=
'
};
'
;
return
code
;
}
function
partial
(
id
)
{
return
'
b += _.rp("
'
+
esc
(
id
)
+
'
",c[c.length - 1],p);
'
;
}
function
tripleStache
(
id
,
method
)
{
return
'
b += (_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,0));
'
;
}
function
variable
(
id
,
method
)
{
return
'
b += (_.v(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,0)));
'
;
}
function
text
(
id
)
{
return
'
b += "
'
+
esc
(
id
)
+
'
";
'
;
}
return
({
scan
:
scan
,
parse
:
function
(
tokens
,
options
)
{
options
=
options
||
{};
return
buildTree
(
tokens
,
''
,
[],
options
.
sectionTags
||
[]);
},
cache
:
{},
compile
:
function
(
text
,
options
)
{
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
options
=
options
||
{};
var
t
=
this
.
cache
[
text
];
if
(
t
)
{
return
t
;
}
t
=
generate
(
this
.
parse
(
scan
(
text
),
options
),
text
,
options
);
return
this
.
cache
[
text
]
=
t
;
}
});
})();
// Export the hogan constructor for Node.js and CommonJS.
if
(
typeof
module
!==
'
undefined
'
&&
module
.
exports
)
{
module
.
exports
=
Hogan
;
module
.
exports
.
Template
=
HoganTemplate
;
}
else
if
(
typeof
exports
!==
'
undefined
'
)
{
exports
.
Hogan
=
Hogan
;
exports
.
HoganTemplate
=
HoganTemplate
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/builds/1.0.0/hogan.min.js
0 → 100644
+
14
-
0
View file @
f764aee4
/*
* Copyright 2011 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var
HoganTemplate
=
function
(){
function
a
(
a
){
this
.
text
=
a
}
function
h
(
a
){
var
h
=
String
(
a
===
null
?
""
:
a
);
return
g
.
test
(
h
)?
h
.
replace
(
b
,
"
&
"
).
replace
(
c
,
"
<
"
).
replace
(
d
,
"
>
"
).
replace
(
e
,
"
'
"
).
replace
(
f
,
"
"
"
):
h
}
a
.
prototype
=
{
r
:
function
(
a
,
b
){
return
""
},
v
:
h
,
render
:
function
(
a
,
b
){
return
this
.
r
(
a
,
b
)},
rp
:
function
(
a
,
b
,
c
,
d
){
var
e
=
c
[
a
];
return
e
?
e
.
render
(
b
,
c
):
""
},
rs
:
function
(
a
,
b
,
c
){
var
d
=
""
,
e
=
a
[
a
.
length
-
1
];
if
(
!
i
(
e
))
return
d
=
c
(
a
,
b
),
d
;
for
(
var
f
=
0
;
f
<
e
.
length
;
f
++
)
a
.
push
(
e
[
f
]),
d
+=
c
(
a
,
b
),
a
.
pop
();
return
d
},
s
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
if
(
i
(
a
)
&&
a
.
length
===
0
)
return
!
1
;
!
d
&&
typeof
a
==
"
function
"
&&
(
a
=
this
.
ls
(
a
,
b
,
c
,
e
,
f
));
var
g
=
a
===
""
||!!
a
;
return
!
d
&&
g
&&
b
&&
b
.
push
(
typeof
a
==
"
object
"
?
a
:
b
[
b
.
length
-
1
]),
g
},
d
:
function
(
a
,
b
,
c
,
d
){
if
(
a
===
"
.
"
&&
i
(
b
[
b
.
length
-
2
]))
return
b
[
b
.
length
-
1
];
var
e
=
a
.
split
(
"
.
"
),
f
=
this
.
f
(
e
[
0
],
b
,
c
,
d
),
g
=
null
;
for
(
var
h
=
1
;
h
<
e
.
length
;
h
++
)
f
&&
typeof
f
==
"
object
"
&&
e
[
h
]
in
f
?(
g
=
f
,
f
=
f
[
e
[
h
]]):
f
=
""
;
return
d
&&!
f
?
!
1
:(
!
d
&&
typeof
f
==
"
function
"
&&
(
b
.
push
(
g
),
f
=
this
.
lv
(
f
,
b
,
c
),
b
.
pop
()),
f
)},
f
:
function
(
a
,
b
,
c
,
d
){
var
e
=!
1
,
f
=
null
,
g
=!
1
;
for
(
var
h
=
b
.
length
-
1
;
h
>=
0
;
h
--
){
f
=
b
[
h
];
if
(
f
&&
typeof
f
==
"
object
"
&&
a
in
f
){
e
=
f
[
a
],
g
=!
0
;
break
}}
return
g
?(
!
d
&&
typeof
e
==
"
function
"
&&
(
e
=
this
.
lv
(
e
,
b
,
c
)),
e
):
d
?
!
1
:
""
},
ho
:
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
call
(
b
,
d
,
function
(
a
){
return
Hogan
.
compile
(
a
).
render
(
b
)}),
f
=
Hogan
.
compile
(
e
.
toString
()).
render
(
b
,
c
);
return
this
.
b
=
f
,
!
1
},
b
:
""
,
ls
:
function
(
a
,
b
,
c
,
d
,
e
){
var
f
=
b
[
b
.
length
-
1
];
if
(
a
.
length
>
0
)
return
this
.
ho
(
a
,
f
,
c
,
this
.
text
.
substring
(
d
,
e
));
var
g
=
a
.
call
(
f
);
return
typeof
g
==
"
function
"
?
this
.
ho
(
g
,
f
,
c
,
this
.
text
.
substring
(
d
,
e
)):
g
},
lv
:
function
(
a
,
b
,
c
){
var
d
=
b
[
b
.
length
-
1
];
return
Hogan
.
compile
(
a
.
call
(
d
).
toString
()).
render
(
d
,
c
)}};
var
b
=
/&/g
,
c
=
/</g
,
d
=
/>/g
,
e
=
/
\'
/g
,
f
=
/
\"
/g
,
g
=
/
[
&<>
\"\']
/
,
i
=
Array
.
isArray
||
function
(
a
){
return
Object
.
prototype
.
toString
.
call
(
a
)
===
"
[object Array]
"
};
return
a
}(),
Hogan
=
function
(){
function
a
(
a
){
function
s
(){
l
.
length
>
0
&&
(
m
.
push
(
new
String
(
l
)),
l
=
""
)}
function
t
(){
var
a
=!
0
;
for
(
var
b
=
p
;
b
<
m
.
length
;
b
++
){
a
=
m
[
b
].
tag
&&
d
[
m
[
b
].
tag
]
<
d
.
_v
||!
m
[
b
].
tag
&&
m
[
b
].
match
(
c
)
==
null
;
if
(
!
a
)
return
!
1
}
return
a
}
function
u
(
a
,
b
){
s
();
if
(
a
&&
t
())
for
(
var
c
=
p
;
c
<
m
.
length
;
c
++
)
m
[
c
].
tag
||
m
.
splice
(
c
,
1
);
else
b
||
m
.
push
({
tag
:
"
\n
"
});
n
=!
1
,
p
=
m
.
length
}
function
v
(
a
,
c
){
var
d
=
"
=
"
+
r
,
e
=
a
.
indexOf
(
d
,
c
),
f
=
b
(
a
.
substring
(
a
.
indexOf
(
"
=
"
,
c
)
+
1
,
e
)).
split
(
"
"
);
return
q
=
f
[
0
],
r
=
f
[
1
],
e
+
d
.
length
-
1
}
var
f
=
a
.
length
,
g
=
0
,
h
=
1
,
i
=
2
,
j
=
g
,
k
=
null
,
l
=
""
,
m
=
[],
n
=!
1
,
o
=
0
,
p
=
0
,
q
=
"
{{
"
,
r
=
"
}}
"
;
for
(
o
=
0
;
o
<
f
;
o
++
)
if
(
j
==
g
)
e
(
q
,
a
,
o
)?(
--
o
,
s
(),
j
=
h
):
a
[
o
]
==
"
\n
"
?
u
(
n
):
l
+=
a
[
o
];
else
if
(
j
==
h
){
o
+=
q
.
length
-
1
;
var
w
=
d
[
a
[
o
+
1
]];
k
=
w
?
a
[
o
+
1
]:
"
_v
"
,
n
=
o
,
k
==
"
=
"
?(
o
=
v
(
a
,
o
),
j
=
g
):(
w
&&
o
++
,
j
=
i
)}
else
e
(
r
,
a
,
o
)?(
o
+=
r
.
length
-
1
,
m
.
push
({
tag
:
k
,
n
:
b
(
l
),
i
:
k
==
"
/
"
?
n
-
1
:
o
+
1
}),
l
=
""
,
j
=
g
,
k
==
"
{
"
&&
o
++
):
l
+=
a
[
o
];
return
u
(
n
,
!
0
),
m
}
function
b
(
a
){
return
a
.
trim
?
a
.
trim
():
a
.
replace
(
/^
\s
*|
\s
*$/g
,
""
)}
function
e
(
a
,
b
,
c
){
if
(
b
[
c
]
!=
a
[
0
])
return
!
1
;
for
(
var
d
=
1
,
e
=
a
.
length
;
d
<
e
;
d
++
)
if
(
b
[
c
+
d
]
!=
a
[
d
])
return
!
1
;
return
!
0
}
function
f
(
a
,
b
,
c
,
d
){
var
e
=
[],
i
=
null
,
j
=
null
;
while
(
a
.
length
>
0
){
j
=
a
.
shift
();
if
(
j
.
tag
==
"
#
"
||
j
.
tag
==
"
^
"
||
g
(
j
,
d
))
c
.
push
(
j
),
j
.
nodes
=
f
(
a
,
j
.
tag
,
c
,
d
),
e
.
push
(
j
);
else
{
if
(
j
.
tag
==
"
/
"
){
if
(
c
.
length
==
0
)
throw
new
Error
(
"
Closing tag without opener: /
"
+
j
.
n
);
i
=
c
.
pop
();
if
(
j
.
n
!=
i
.
n
&&!
h
(
j
.
n
,
i
.
n
,
d
))
throw
new
Error
(
"
Nesting error:
"
+
i
.
n
+
"
vs.
"
+
j
.
n
);
return
i
.
end
=
j
.
i
,
e
}
e
.
push
(
j
)}}
if
(
c
.
length
>
0
)
throw
new
Error
(
"
missing closing tag:
"
+
c
.
pop
().
n
);
return
e
}
function
g
(
a
,
b
){
for
(
var
c
=
0
,
d
=
b
.
length
;
c
<
d
;
c
++
)
if
(
b
[
c
].
o
==
a
.
n
)
return
a
.
tag
=
"
#
"
,
!
0
}
function
h
(
a
,
b
,
c
){
for
(
var
d
=
0
,
e
=
c
.
length
;
d
<
e
;
d
++
)
if
(
c
[
d
].
c
==
a
&&
c
[
d
].
o
==
b
)
return
!
0
}
function
i
(
a
,
b
,
c
){
var
d
=
'
var c = [cx];var b = "";var _ = this;
'
+
p
(
a
)
+
"
return b;
"
;
if
(
c
.
asString
)
return
"
function(cx,p){
"
+
d
+
"
;};
"
;
var
e
=
new
HoganTemplate
(
b
);
return
e
.
r
=
new
Function
(
"
cx
"
,
"
p
"
,
d
),
e
}
function
n
(
a
){
return
a
.
replace
(
m
,
"
\\\\
"
).
replace
(
j
,
'
\\
"
'
).
replace
(
k
,
"
\\
n
"
).
replace
(
l
,
"
\\
r
"
)}
function
o
(
a
){
return
~
a
.
indexOf
(
"
.
"
)?
"
d
"
:
"
f
"
}
function
p
(
a
){
var
b
=
""
;
for
(
var
c
=
0
,
d
=
a
.
length
;
c
<
d
;
c
++
){
var
e
=
a
[
c
].
tag
;
e
==
"
#
"
?
b
+=
q
(
a
[
c
].
nodes
,
a
[
c
].
n
,
o
(
a
[
c
].
n
),
a
[
c
].
i
,
a
[
c
].
end
):
e
==
"
^
"
?
b
+=
r
(
a
[
c
].
nodes
,
a
[
c
].
n
,
o
(
a
[
c
].
n
)):
e
==
"
<
"
||
e
==
"
>
"
?
b
+=
s
(
a
[
c
].
n
):
e
==
"
{
"
||
e
==
"
&
"
?
b
+=
t
(
a
[
c
].
n
,
o
(
a
[
c
].
n
)):
e
==
"
\n
"
?
b
+=
v
(
"
\n
"
):
e
==
"
_v
"
?
b
+=
u
(
a
[
c
].
n
,
o
(
a
[
c
].
n
)):
e
===
undefined
&&
(
b
+=
v
(
a
[
c
]))}
return
b
}
function
q
(
a
,
b
,
c
,
d
,
e
){
var
f
=
"
if(_.s(_.
"
+
c
+
'
("
'
+
n
(
b
)
+
'
",c,p,1),
'
;
return
f
+=
"
c,p,0,
"
+
d
+
"
,
"
+
e
+
"
)){
"
,
f
+=
"
b += _.rs(c,p,
"
,
f
+=
'
function(c,p){ var b = "";
'
,
f
+=
p
(
a
),
f
+=
"
return b;});c.pop();}
"
,
f
+=
'
else{b += _.b; _.b = ""};
'
,
f
}
function
r
(
a
,
b
,
c
){
var
d
=
"
if (!_.s(_.
"
+
c
+
'
("
'
+
n
(
b
)
+
'
",c,p,1),c,p,1,0,0)){
'
;
return
d
+=
p
(
a
),
d
+=
"
};
"
,
d
}
function
s
(
a
){
return
'
b += _.rp("
'
+
n
(
a
)
+
'
",c[c.length - 1],p);
'
}
function
t
(
a
,
b
){
return
"
b += (_.
"
+
b
+
'
("
'
+
n
(
a
)
+
'
",c,p,0));
'
}
function
u
(
a
,
b
){
return
"
b += (_.v(_.
"
+
b
+
'
("
'
+
n
(
a
)
+
'
",c,p,0)));
'
}
function
v
(
a
){
return
'
b += "
'
+
n
(
a
)
+
'
";
'
}
var
c
=
/
\S
/
,
d
=
{
"
#
"
:
1
,
"
^
"
:
2
,
"
/
"
:
3
,
"
!
"
:
4
,
"
>
"
:
5
,
"
<
"
:
6
,
"
=
"
:
7
,
_v
:
8
,
"
{
"
:
9
,
"
&
"
:
10
},
j
=
/
\"
/g
,
k
=
/
\n
/g
,
l
=
/
\r
/g
,
m
=
/
\\
/g
;
return
{
scan
:
a
,
parse
:
function
(
a
,
b
){
return
b
=
b
||
{},
f
(
a
,
""
,[],
b
.
sectionTags
||
[])},
cache
:{},
compile
:
function
(
b
,
c
){
c
=
c
||
{};
var
d
=
this
.
cache
[
b
];
return
d
?
d
:(
d
=
i
(
this
.
parse
(
a
(
b
),
c
),
b
,
c
),
this
.
cache
[
b
]
=
d
)}}}();
typeof
module
!=
"
undefined
"
&&
module
.
exports
?(
module
.
exports
=
Hogan
,
module
.
exports
.
Template
=
HoganTemplate
):
typeof
exports
!=
"
undefined
"
&&
(
exports
.
Hogan
=
Hogan
,
exports
.
HoganTemplate
=
HoganTemplate
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/builds/1.0.3/hogan.js
0 → 100644
+
545
-
0
View file @
f764aee4
/*
* Copyright 2011 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var
HoganTemplate
=
(
function
()
{
function
constructor
(
text
)
{
this
.
text
=
text
;
}
constructor
.
prototype
=
{
// render: replaced by generated code.
r
:
function
(
context
,
partials
,
indent
)
{
return
''
;
},
// variable escaping
v
:
hoganEscape
,
render
:
function
render
(
context
,
partials
,
indent
)
{
return
this
.
r
(
context
,
partials
,
indent
);
},
// tries to find a partial in the curent scope and render it
rp
:
function
(
name
,
context
,
partials
,
indent
)
{
var
partial
=
partials
[
name
];
if
(
!
partial
)
{
return
''
;
}
return
partial
.
r
(
context
,
partials
,
indent
);
},
// render a section
rs
:
function
(
context
,
partials
,
section
)
{
var
buf
=
''
,
tail
=
context
[
context
.
length
-
1
];
if
(
!
isArray
(
tail
))
{
return
buf
=
section
(
context
,
partials
);
}
for
(
var
i
=
0
;
i
<
tail
.
length
;
i
++
)
{
context
.
push
(
tail
[
i
]);
buf
+=
section
(
context
,
partials
);
context
.
pop
();
}
return
buf
;
},
// maybe start a section
s
:
function
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
)
{
var
pass
;
if
(
isArray
(
val
)
&&
val
.
length
===
0
)
{
return
false
;
}
if
(
!
inverted
&&
typeof
val
==
'
function
'
)
{
val
=
this
.
ls
(
val
,
ctx
,
partials
,
start
,
end
,
tags
);
}
pass
=
(
val
===
''
)
||
!!
val
;
if
(
!
inverted
&&
pass
&&
ctx
)
{
ctx
.
push
((
typeof
val
==
'
object
'
)
?
val
:
ctx
[
ctx
.
length
-
1
]);
}
return
pass
;
},
// find values with dotted names
d
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
var
names
=
key
.
split
(
'
.
'
),
val
=
this
.
f
(
names
[
0
],
ctx
,
partials
,
returnFound
),
cx
=
null
;
if
(
key
===
'
.
'
&&
isArray
(
ctx
[
ctx
.
length
-
2
]))
{
return
ctx
[
ctx
.
length
-
1
];
}
for
(
var
i
=
1
;
i
<
names
.
length
;
i
++
)
{
if
(
val
&&
typeof
val
==
'
object
'
&&
names
[
i
]
in
val
)
{
cx
=
val
;
val
=
val
[
names
[
i
]];
}
else
{
val
=
''
;
}
}
if
(
returnFound
&&
!
val
)
{
return
false
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
ctx
.
push
(
cx
);
val
=
this
.
lv
(
val
,
ctx
,
partials
);
ctx
.
pop
();
}
return
val
;
},
// find values with normal names
f
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
var
val
=
false
,
v
=
null
,
found
=
false
;
for
(
var
i
=
ctx
.
length
-
1
;
i
>=
0
;
i
--
)
{
v
=
ctx
[
i
];
if
(
v
&&
typeof
v
==
'
object
'
&&
key
in
v
)
{
val
=
v
[
key
];
found
=
true
;
break
;
}
}
if
(
!
found
)
{
return
(
returnFound
)
?
false
:
""
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
val
=
this
.
lv
(
val
,
ctx
,
partials
);
}
return
val
;
},
// higher order templates
ho
:
function
(
val
,
cx
,
partials
,
text
,
tags
)
{
var
t
=
val
.
call
(
cx
,
text
,
function
(
t
)
{
return
Hogan
.
compile
(
t
,
{
delimiters
:
tags
}).
render
(
cx
,
partials
);
});
var
s
=
Hogan
.
compile
(
t
.
toString
(),
{
delimiters
:
tags
}).
render
(
cx
,
partials
);
this
.
b
=
s
;
return
false
;
},
// higher order template result buffer
b
:
''
,
// lambda replace section
ls
:
function
(
val
,
ctx
,
partials
,
start
,
end
,
tags
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
],
t
=
val
.
call
(
cx
);
if
(
val
.
length
>
0
)
{
return
this
.
ho
(
val
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
),
tags
);
}
if
(
typeof
t
==
'
function
'
)
{
return
this
.
ho
(
t
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
),
tags
);
}
return
t
;
},
// lambda replace variable
lv
:
function
(
val
,
ctx
,
partials
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
];
return
Hogan
.
compile
(
val
.
call
(
cx
).
toString
()).
render
(
cx
,
partials
);
}
};
var
rAmp
=
/&/g
,
rLt
=
/</g
,
rGt
=
/>/g
,
rApos
=
/
\'
/g
,
rQuot
=
/
\"
/g
,
hChars
=
/
[
&<>
\"\']
/
;
function
hoganEscape
(
str
)
{
str
=
String
(
str
===
null
?
''
:
str
);
return
hChars
.
test
(
str
)
?
str
.
replace
(
rAmp
,
'
&
'
)
.
replace
(
rLt
,
'
<
'
)
.
replace
(
rGt
,
'
>
'
)
.
replace
(
rApos
,
'
'
'
)
.
replace
(
rQuot
,
'
"
'
)
:
str
;
}
var
isArray
=
Array
.
isArray
||
function
(
a
)
{
return
Object
.
prototype
.
toString
.
call
(
a
)
===
'
[object Array]
'
;
};
return
constructor
;
})();
var
Hogan
=
(
function
()
{
// Setup regex assignments
// remove whitespace according to Mustache spec
var
rIsWhitespace
=
/
\S
/
,
rQuot
=
/
\"
/g
,
rNewline
=
/
\n
/g
,
rCr
=
/
\r
/g
,
rSlash
=
/
\\
/g
,
tagTypes
=
{
'
#
'
:
1
,
'
^
'
:
2
,
'
/
'
:
3
,
'
!
'
:
4
,
'
>
'
:
5
,
'
<
'
:
6
,
'
=
'
:
7
,
'
_v
'
:
8
,
'
{
'
:
9
,
'
&
'
:
10
};
function
scan
(
text
,
delimiters
)
{
var
len
=
text
.
length
,
IN_TEXT
=
0
,
IN_TAG_TYPE
=
1
,
IN_TAG
=
2
,
state
=
IN_TEXT
,
tagType
=
null
,
tag
=
null
,
buf
=
''
,
tokens
=
[],
seenTag
=
false
,
i
=
0
,
lineStart
=
0
,
otag
=
'
{{
'
,
ctag
=
'
}}
'
;
function
addBuf
()
{
if
(
buf
.
length
>
0
)
{
tokens
.
push
(
new
String
(
buf
));
buf
=
''
;
}
}
function
lineIsWhitespace
()
{
var
isAllWhitespace
=
true
;
for
(
var
j
=
lineStart
;
j
<
tokens
.
length
;
j
++
)
{
isAllWhitespace
=
(
tokens
[
j
].
tag
&&
tagTypes
[
tokens
[
j
].
tag
]
<
tagTypes
[
'
_v
'
])
||
(
!
tokens
[
j
].
tag
&&
tokens
[
j
].
match
(
rIsWhitespace
)
===
null
);
if
(
!
isAllWhitespace
)
{
return
false
;
}
}
return
isAllWhitespace
;
}
function
filterLine
(
haveSeenTag
,
noNewLine
)
{
addBuf
();
if
(
haveSeenTag
&&
lineIsWhitespace
())
{
for
(
var
j
=
lineStart
,
next
;
j
<
tokens
.
length
;
j
++
)
{
if
(
!
tokens
[
j
].
tag
)
{
if
((
next
=
tokens
[
j
+
1
])
&&
next
.
tag
==
'
>
'
)
{
// set indent to token value
next
.
indent
=
tokens
[
j
].
toString
()
}
tokens
.
splice
(
j
,
1
);
}
}
}
else
if
(
!
noNewLine
)
{
tokens
.
push
({
tag
:
'
\n
'
});
}
seenTag
=
false
;
lineStart
=
tokens
.
length
;
}
function
changeDelimiters
(
text
,
index
)
{
var
close
=
'
=
'
+
ctag
,
closeIndex
=
text
.
indexOf
(
close
,
index
),
delimiters
=
trim
(
text
.
substring
(
text
.
indexOf
(
'
=
'
,
index
)
+
1
,
closeIndex
)
).
split
(
'
'
);
otag
=
delimiters
[
0
];
ctag
=
delimiters
[
1
];
return
closeIndex
+
close
.
length
-
1
;
}
if
(
delimiters
)
{
delimiters
=
delimiters
.
split
(
'
'
);
otag
=
delimiters
[
0
];
ctag
=
delimiters
[
1
];
}
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
state
==
IN_TEXT
)
{
if
(
tagChange
(
otag
,
text
,
i
))
{
--
i
;
addBuf
();
state
=
IN_TAG_TYPE
;
}
else
{
if
(
text
.
charAt
(
i
)
==
'
\n
'
)
{
filterLine
(
seenTag
);
}
else
{
buf
+=
text
.
charAt
(
i
);
}
}
}
else
if
(
state
==
IN_TAG_TYPE
)
{
i
+=
otag
.
length
-
1
;
tag
=
tagTypes
[
text
.
charAt
(
i
+
1
)];
tagType
=
tag
?
text
.
charAt
(
i
+
1
)
:
'
_v
'
;
if
(
tagType
==
'
=
'
)
{
i
=
changeDelimiters
(
text
,
i
);
state
=
IN_TEXT
;
}
else
{
if
(
tag
)
{
i
++
;
}
state
=
IN_TAG
;
}
seenTag
=
i
;
}
else
{
if
(
tagChange
(
ctag
,
text
,
i
))
{
tokens
.
push
({
tag
:
tagType
,
n
:
trim
(
buf
),
otag
:
otag
,
ctag
:
ctag
,
i
:
(
tagType
==
'
/
'
)
?
seenTag
-
ctag
.
length
:
i
+
otag
.
length
});
buf
=
''
;
i
+=
ctag
.
length
-
1
;
state
=
IN_TEXT
;
if
(
tagType
==
'
{
'
)
{
i
++
;
}
}
else
{
buf
+=
text
.
charAt
(
i
);
}
}
}
filterLine
(
seenTag
,
true
);
return
tokens
;
}
function
trim
(
s
)
{
if
(
s
.
trim
)
{
return
s
.
trim
();
}
return
s
.
replace
(
/^
\s
*|
\s
*$/g
,
''
);
}
function
tagChange
(
tag
,
text
,
index
)
{
if
(
text
.
charAt
(
index
)
!=
tag
.
charAt
(
0
))
{
return
false
;
}
for
(
var
i
=
1
,
l
=
tag
.
length
;
i
<
l
;
i
++
)
{
if
(
text
.
charAt
(
index
+
i
)
!=
tag
.
charAt
(
i
))
{
return
false
;
}
}
return
true
;
}
function
buildTree
(
tokens
,
kind
,
stack
,
customTags
)
{
var
instructions
=
[],
opener
=
null
,
token
=
null
;
while
(
tokens
.
length
>
0
)
{
token
=
tokens
.
shift
();
if
(
token
.
tag
==
'
#
'
||
token
.
tag
==
'
^
'
||
isOpener
(
token
,
customTags
))
{
stack
.
push
(
token
);
token
.
nodes
=
buildTree
(
tokens
,
token
.
tag
,
stack
,
customTags
);
instructions
.
push
(
token
);
}
else
if
(
token
.
tag
==
'
/
'
)
{
if
(
stack
.
length
===
0
)
{
throw
new
Error
(
'
Closing tag without opener: /
'
+
token
.
n
);
}
opener
=
stack
.
pop
();
if
(
token
.
n
!=
opener
.
n
&&
!
isCloser
(
token
.
n
,
opener
.
n
,
customTags
))
{
throw
new
Error
(
'
Nesting error:
'
+
opener
.
n
+
'
vs.
'
+
token
.
n
);
}
opener
.
end
=
token
.
i
;
return
instructions
;
}
else
{
instructions
.
push
(
token
);
}
}
if
(
stack
.
length
>
0
)
{
throw
new
Error
(
'
missing closing tag:
'
+
stack
.
pop
().
n
);
}
return
instructions
;
}
function
isOpener
(
token
,
tags
)
{
for
(
var
i
=
0
,
l
=
tags
.
length
;
i
<
l
;
i
++
)
{
if
(
tags
[
i
].
o
==
token
.
n
)
{
token
.
tag
=
'
#
'
;
return
true
;
}
}
}
function
isCloser
(
close
,
open
,
tags
)
{
for
(
var
i
=
0
,
l
=
tags
.
length
;
i
<
l
;
i
++
)
{
if
(
tags
[
i
].
c
==
close
&&
tags
[
i
].
o
==
open
)
{
return
true
;
}
}
}
function
generate
(
tree
,
text
,
options
)
{
var
code
=
'
i = i || "";var c = [cx];var b = i + "";var _ = this;
'
+
walk
(
tree
)
+
'
return b;
'
;
if
(
options
.
asString
)
{
return
'
function(cx,p,i){
'
+
code
+
'
;}
'
;
}
var
template
=
new
HoganTemplate
(
text
);
template
.
r
=
new
Function
(
'
cx
'
,
'
p
'
,
'
i
'
,
code
);
return
template
;
}
function
esc
(
s
)
{
return
s
.
replace
(
rSlash
,
'
\\\\
'
)
.
replace
(
rQuot
,
'
\\\
"
'
)
.
replace
(
rNewline
,
'
\\
n
'
)
.
replace
(
rCr
,
'
\\
r
'
);
}
function
chooseMethod
(
s
)
{
return
(
~
s
.
indexOf
(
'
.
'
))
?
'
d
'
:
'
f
'
;
}
function
walk
(
tree
)
{
var
code
=
''
;
for
(
var
i
=
0
,
l
=
tree
.
length
;
i
<
l
;
i
++
)
{
var
tag
=
tree
[
i
].
tag
;
if
(
tag
==
'
#
'
)
{
code
+=
section
(
tree
[
i
].
nodes
,
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
),
tree
[
i
].
i
,
tree
[
i
].
end
,
tree
[
i
].
otag
+
"
"
+
tree
[
i
].
ctag
);
}
else
if
(
tag
==
'
^
'
)
{
code
+=
invertedSection
(
tree
[
i
].
nodes
,
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
==
'
<
'
||
tag
==
'
>
'
)
{
code
+=
partial
(
tree
[
i
]);
}
else
if
(
tag
==
'
{
'
||
tag
==
'
&
'
)
{
code
+=
tripleStache
(
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
==
'
\n
'
)
{
code
+=
text
(
'
"
\\
n"
'
+
(
tree
.
length
-
1
==
i
?
''
:
'
+ i
'
));
}
else
if
(
tag
==
'
_v
'
)
{
code
+=
variable
(
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
===
undefined
)
{
code
+=
text
(
'
"
'
+
esc
(
tree
[
i
])
+
'
"
'
);
}
}
return
code
;
}
function
section
(
nodes
,
id
,
method
,
start
,
end
,
tags
)
{
return
'
if(_.s(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,1),
'
+
'
c,p,0,
'
+
start
+
'
,
'
+
end
+
'
, "
'
+
tags
+
'
")){
'
+
'
b += _.rs(c,p,
'
+
'
function(c,p){ var b = "";
'
+
walk
(
nodes
)
+
'
return b;});c.pop();}
'
+
'
else{b += _.b; _.b = ""};
'
;
}
function
invertedSection
(
nodes
,
id
,
method
)
{
return
'
if (!_.s(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,1),c,p,1,0,0,"")){
'
+
walk
(
nodes
)
+
'
};
'
;
}
function
partial
(
tok
)
{
return
'
b += _.rp("
'
+
esc
(
tok
.
n
)
+
'
",c[c.length - 1],p,"
'
+
(
tok
.
indent
||
''
)
+
'
");
'
;
}
function
tripleStache
(
id
,
method
)
{
return
'
b += (_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,0));
'
;
}
function
variable
(
id
,
method
)
{
return
'
b += (_.v(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,0)));
'
;
}
function
text
(
id
)
{
return
'
b +=
'
+
id
+
'
;
'
;
}
return
({
scan
:
scan
,
parse
:
function
(
tokens
,
options
)
{
options
=
options
||
{};
return
buildTree
(
tokens
,
''
,
[],
options
.
sectionTags
||
[]);
},
cache
:
{},
compile
:
function
(
text
,
options
)
{
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
// delimiters: A string that overrides the default delimiters.
// Example: "<% %>"
//
options
=
options
||
{};
var
t
=
this
.
cache
[
text
];
if
(
t
)
{
return
t
;
}
t
=
generate
(
this
.
parse
(
scan
(
text
,
options
.
delimiters
),
options
),
text
,
options
);
return
this
.
cache
[
text
]
=
t
;
}
});
})();
// Export the hogan constructor for Node.js and CommonJS.
if
(
typeof
module
!==
'
undefined
'
&&
module
.
exports
)
{
module
.
exports
=
Hogan
;
module
.
exports
.
Template
=
HoganTemplate
;
}
else
if
(
typeof
define
===
'
function
'
&&
define
.
amd
)
{
define
(
function
()
{
return
Hogan
;
});
}
else
if
(
typeof
exports
!==
'
undefined
'
)
{
exports
.
Hogan
=
Hogan
;
exports
.
HoganTemplate
=
HoganTemplate
;
}
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/builds/1.0.3/hogan.min.js
0 → 100644
+
5
-
0
View file @
f764aee4
/**
* @preserve Copyright 2012 Twitter, Inc.
* @license http://www.apache.org/licenses/LICENSE-2.0.txt
*/
var
HoganTemplate
=
function
(){
function
a
(
a
){
this
.
text
=
a
}
function
h
(
a
){
return
a
=
String
(
a
===
null
?
""
:
a
),
g
.
test
(
a
)?
a
.
replace
(
b
,
"
&
"
).
replace
(
c
,
"
<
"
).
replace
(
d
,
"
>
"
).
replace
(
e
,
"
'
"
).
replace
(
f
,
"
"
"
):
a
}
a
.
prototype
=
{
r
:
function
(
a
,
b
,
c
){
return
""
},
v
:
h
,
render
:
function
(
b
,
c
,
d
){
return
this
.
r
(
b
,
c
,
d
)},
rp
:
function
(
a
,
b
,
c
,
d
){
var
e
=
c
[
a
];
return
e
?
e
.
r
(
b
,
c
,
d
):
""
},
rs
:
function
(
a
,
b
,
c
){
var
d
=
""
,
e
=
a
[
a
.
length
-
1
];
if
(
!
i
(
e
))
return
d
=
c
(
a
,
b
);
for
(
var
f
=
0
;
f
<
e
.
length
;
f
++
)
a
.
push
(
e
[
f
]),
d
+=
c
(
a
,
b
),
a
.
pop
();
return
d
},
s
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
var
h
;
return
i
(
a
)
&&
a
.
length
===
0
?
!
1
:(
!
d
&&
typeof
a
==
"
function
"
&&
(
a
=
this
.
ls
(
a
,
b
,
c
,
e
,
f
,
g
)),
h
=
a
===
""
||!!
a
,
!
d
&&
h
&&
b
&&
b
.
push
(
typeof
a
==
"
object
"
?
a
:
b
[
b
.
length
-
1
]),
h
)},
d
:
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
split
(
"
.
"
),
f
=
this
.
f
(
e
[
0
],
b
,
c
,
d
),
g
=
null
;
if
(
a
===
"
.
"
&&
i
(
b
[
b
.
length
-
2
]))
return
b
[
b
.
length
-
1
];
for
(
var
h
=
1
;
h
<
e
.
length
;
h
++
)
f
&&
typeof
f
==
"
object
"
&&
e
[
h
]
in
f
?(
g
=
f
,
f
=
f
[
e
[
h
]]):
f
=
""
;
return
d
&&!
f
?
!
1
:(
!
d
&&
typeof
f
==
"
function
"
&&
(
b
.
push
(
g
),
f
=
this
.
lv
(
f
,
b
,
c
),
b
.
pop
()),
f
)},
f
:
function
(
a
,
b
,
c
,
d
){
var
e
=!
1
,
f
=
null
,
g
=!
1
;
for
(
var
h
=
b
.
length
-
1
;
h
>=
0
;
h
--
){
f
=
b
[
h
];
if
(
f
&&
typeof
f
==
"
object
"
&&
a
in
f
){
e
=
f
[
a
],
g
=!
0
;
break
}}
return
g
?(
!
d
&&
typeof
e
==
"
function
"
&&
(
e
=
this
.
lv
(
e
,
b
,
c
)),
e
):
d
?
!
1
:
""
},
ho
:
function
(
a
,
b
,
c
,
d
,
e
){
var
f
=
a
.
call
(
b
,
d
,
function
(
a
){
return
Hogan
.
compile
(
a
,{
delimiters
:
e
}).
render
(
b
,
c
)}),
g
=
Hogan
.
compile
(
f
.
toString
(),{
delimiters
:
e
}).
render
(
b
,
c
);
return
this
.
b
=
g
,
!
1
},
b
:
""
,
ls
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
var
g
=
b
[
b
.
length
-
1
],
h
=
a
.
call
(
g
);
return
a
.
length
>
0
?
this
.
ho
(
a
,
g
,
c
,
this
.
text
.
substring
(
d
,
e
),
f
):
typeof
h
==
"
function
"
?
this
.
ho
(
h
,
g
,
c
,
this
.
text
.
substring
(
d
,
e
),
f
):
h
},
lv
:
function
(
a
,
b
,
c
){
var
d
=
b
[
b
.
length
-
1
];
return
Hogan
.
compile
(
a
.
call
(
d
).
toString
()).
render
(
d
,
c
)}};
var
b
=
/&/g
,
c
=
/</g
,
d
=
/>/g
,
e
=
/
\'
/g
,
f
=
/
\"
/g
,
g
=
/
[
&<>
\"\']
/
,
i
=
Array
.
isArray
||
function
(
a
){
return
Object
.
prototype
.
toString
.
call
(
a
)
===
"
[object Array]
"
};
return
a
}(),
Hogan
=
function
(){
function
g
(
b
,
c
){
function
u
(){
n
.
length
>
0
&&
(
o
.
push
(
new
String
(
n
)),
n
=
""
)}
function
v
(){
var
b
=!
0
;
for
(
var
c
=
r
;
c
<
o
.
length
;
c
++
){
b
=
o
[
c
].
tag
&&
f
[
o
[
c
].
tag
]
<
f
.
_v
||!
o
[
c
].
tag
&&
o
[
c
].
match
(
a
)
===
null
;
if
(
!
b
)
return
!
1
}
return
b
}
function
w
(
a
,
b
){
u
();
if
(
a
&&
v
())
for
(
var
c
=
r
,
d
;
c
<
o
.
length
;
c
++
)
o
[
c
].
tag
||
((
d
=
o
[
c
+
1
])
&&
d
.
tag
==
"
>
"
&&
(
d
.
indent
=
o
[
c
].
toString
()),
o
.
splice
(
c
,
1
));
else
b
||
o
.
push
({
tag
:
"
\n
"
});
p
=!
1
,
r
=
o
.
length
}
function
x
(
a
,
b
){
var
c
=
"
=
"
+
t
,
d
=
a
.
indexOf
(
c
,
b
),
e
=
h
(
a
.
substring
(
a
.
indexOf
(
"
=
"
,
b
)
+
1
,
d
)).
split
(
"
"
);
return
s
=
e
[
0
],
t
=
e
[
1
],
d
+
c
.
length
-
1
}
var
d
=
b
.
length
,
e
=
0
,
g
=
1
,
j
=
2
,
k
=
e
,
l
=
null
,
m
=
null
,
n
=
""
,
o
=
[],
p
=!
1
,
q
=
0
,
r
=
0
,
s
=
"
{{
"
,
t
=
"
}}
"
;
c
&&
(
c
=
c
.
split
(
"
"
),
s
=
c
[
0
],
t
=
c
[
1
]);
for
(
q
=
0
;
q
<
d
;
q
++
)
k
==
e
?
i
(
s
,
b
,
q
)?(
--
q
,
u
(),
k
=
g
):
b
.
charAt
(
q
)
==
"
\n
"
?
w
(
p
):
n
+=
b
.
charAt
(
q
):
k
==
g
?(
q
+=
s
.
length
-
1
,
m
=
f
[
b
.
charAt
(
q
+
1
)],
l
=
m
?
b
.
charAt
(
q
+
1
):
"
_v
"
,
l
==
"
=
"
?(
q
=
x
(
b
,
q
),
k
=
e
):(
m
&&
q
++
,
k
=
j
),
p
=
q
):
i
(
t
,
b
,
q
)?(
o
.
push
({
tag
:
l
,
n
:
h
(
n
),
otag
:
s
,
ctag
:
t
,
i
:
l
==
"
/
"
?
p
-
t
.
length
:
q
+
s
.
length
}),
n
=
""
,
q
+=
t
.
length
-
1
,
k
=
e
,
l
==
"
{
"
&&
q
++
):
n
+=
b
.
charAt
(
q
);
return
w
(
p
,
!
0
),
o
}
function
h
(
a
){
return
a
.
trim
?
a
.
trim
():
a
.
replace
(
/^
\s
*|
\s
*$/g
,
""
)}
function
i
(
a
,
b
,
c
){
if
(
b
.
charAt
(
c
)
!=
a
.
charAt
(
0
))
return
!
1
;
for
(
var
d
=
1
,
e
=
a
.
length
;
d
<
e
;
d
++
)
if
(
b
.
charAt
(
c
+
d
)
!=
a
.
charAt
(
d
))
return
!
1
;
return
!
0
}
function
j
(
a
,
b
,
c
,
d
){
var
e
=
[],
f
=
null
,
g
=
null
;
while
(
a
.
length
>
0
){
g
=
a
.
shift
();
if
(
g
.
tag
==
"
#
"
||
g
.
tag
==
"
^
"
||
k
(
g
,
d
))
c
.
push
(
g
),
g
.
nodes
=
j
(
a
,
g
.
tag
,
c
,
d
),
e
.
push
(
g
);
else
{
if
(
g
.
tag
==
"
/
"
){
if
(
c
.
length
===
0
)
throw
new
Error
(
"
Closing tag without opener: /
"
+
g
.
n
);
f
=
c
.
pop
();
if
(
g
.
n
!=
f
.
n
&&!
l
(
g
.
n
,
f
.
n
,
d
))
throw
new
Error
(
"
Nesting error:
"
+
f
.
n
+
"
vs.
"
+
g
.
n
);
return
f
.
end
=
g
.
i
,
e
}
e
.
push
(
g
)}}
if
(
c
.
length
>
0
)
throw
new
Error
(
"
missing closing tag:
"
+
c
.
pop
().
n
);
return
e
}
function
k
(
a
,
b
){
for
(
var
c
=
0
,
d
=
b
.
length
;
c
<
d
;
c
++
)
if
(
b
[
c
].
o
==
a
.
n
)
return
a
.
tag
=
"
#
"
,
!
0
}
function
l
(
a
,
b
,
c
){
for
(
var
d
=
0
,
e
=
c
.
length
;
d
<
e
;
d
++
)
if
(
c
[
d
].
c
==
a
&&
c
[
d
].
o
==
b
)
return
!
0
}
function
m
(
a
,
b
,
c
){
var
d
=
'
i = i || "";var c = [cx];var b = i + "";var _ = this;
'
+
p
(
a
)
+
"
return b;
"
;
if
(
c
.
asString
)
return
"
function(cx,p,i){
"
+
d
+
"
;}
"
;
var
e
=
new
HoganTemplate
(
b
);
return
e
.
r
=
new
Function
(
"
cx
"
,
"
p
"
,
"
i
"
,
d
),
e
}
function
n
(
a
){
return
a
.
replace
(
e
,
"
\\\\
"
).
replace
(
b
,
'
\\
"
'
).
replace
(
c
,
"
\\
n
"
).
replace
(
d
,
"
\\
r
"
)}
function
o
(
a
){
return
~
a
.
indexOf
(
"
.
"
)?
"
d
"
:
"
f
"
}
function
p
(
a
){
var
b
=
""
;
for
(
var
c
=
0
,
d
=
a
.
length
;
c
<
d
;
c
++
){
var
e
=
a
[
c
].
tag
;
e
==
"
#
"
?
b
+=
q
(
a
[
c
].
nodes
,
a
[
c
].
n
,
o
(
a
[
c
].
n
),
a
[
c
].
i
,
a
[
c
].
end
,
a
[
c
].
otag
+
"
"
+
a
[
c
].
ctag
):
e
==
"
^
"
?
b
+=
r
(
a
[
c
].
nodes
,
a
[
c
].
n
,
o
(
a
[
c
].
n
)):
e
==
"
<
"
||
e
==
"
>
"
?
b
+=
s
(
a
[
c
]):
e
==
"
{
"
||
e
==
"
&
"
?
b
+=
t
(
a
[
c
].
n
,
o
(
a
[
c
].
n
)):
e
==
"
\n
"
?
b
+=
v
(
'
"
\\
n"
'
+
(
a
.
length
-
1
==
c
?
""
:
"
+ i
"
)):
e
==
"
_v
"
?
b
+=
u
(
a
[
c
].
n
,
o
(
a
[
c
].
n
)):
e
===
undefined
&&
(
b
+=
v
(
'
"
'
+
n
(
a
[
c
])
+
'
"
'
))}
return
b
}
function
q
(
a
,
b
,
c
,
d
,
e
,
f
){
return
"
if(_.s(_.
"
+
c
+
'
("
'
+
n
(
b
)
+
'
",c,p,1),
'
+
"
c,p,0,
"
+
d
+
"
,
"
+
e
+
'
, "
'
+
f
+
'
")){
'
+
"
b += _.rs(c,p,
"
+
'
function(c,p){ var b = "";
'
+
p
(
a
)
+
"
return b;});c.pop();}
"
+
'
else{b += _.b; _.b = ""};
'
}
function
r
(
a
,
b
,
c
){
return
"
if (!_.s(_.
"
+
c
+
'
("
'
+
n
(
b
)
+
'
",c,p,1),c,p,1,0,0,"")){
'
+
p
(
a
)
+
"
};
"
}
function
s
(
a
){
return
'
b += _.rp("
'
+
n
(
a
.
n
)
+
'
",c[c.length - 1],p,"
'
+
(
a
.
indent
||
""
)
+
'
");
'
}
function
t
(
a
,
b
){
return
"
b += (_.
"
+
b
+
'
("
'
+
n
(
a
)
+
'
",c,p,0));
'
}
function
u
(
a
,
b
){
return
"
b += (_.v(_.
"
+
b
+
'
("
'
+
n
(
a
)
+
'
",c,p,0)));
'
}
function
v
(
a
){
return
"
b +=
"
+
a
+
"
;
"
}
var
a
=
/
\S
/
,
b
=
/
\"
/g
,
c
=
/
\n
/g
,
d
=
/
\r
/g
,
e
=
/
\\
/g
,
f
=
{
"
#
"
:
1
,
"
^
"
:
2
,
"
/
"
:
3
,
"
!
"
:
4
,
"
>
"
:
5
,
"
<
"
:
6
,
"
=
"
:
7
,
_v
:
8
,
"
{
"
:
9
,
"
&
"
:
10
};
return
{
scan
:
g
,
parse
:
function
(
a
,
b
){
return
b
=
b
||
{},
j
(
a
,
""
,[],
b
.
sectionTags
||
[])},
cache
:{},
compile
:
function
(
a
,
b
){
b
=
b
||
{};
var
c
=
this
.
cache
[
a
];
return
c
?
c
:(
c
=
m
(
this
.
parse
(
g
(
a
,
b
.
delimiters
),
b
),
a
,
b
),
this
.
cache
[
a
]
=
c
)}}}();
typeof
module
!=
"
undefined
"
&&
module
.
exports
?(
module
.
exports
=
Hogan
,
module
.
exports
.
Template
=
HoganTemplate
):
typeof
define
==
"
function
"
&&
define
.
amd
?
define
(
function
(){
return
Hogan
}):
typeof
exports
!=
"
undefined
"
&&
(
exports
.
Hogan
=
Hogan
,
exports
.
HoganTemplate
=
HoganTemplate
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.amd.js
0 → 100644
+
576
-
0
View file @
f764aee4
/*
* Copyright 2011 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var
Hogan
=
{};
(
function
(
Hogan
)
{
Hogan
.
Template
=
function
constructor
(
renderFunc
,
text
,
compiler
)
{
if
(
renderFunc
)
{
this
.
r
=
renderFunc
;
}
this
.
c
=
compiler
;
this
.
text
=
text
||
''
;
}
Hogan
.
Template
.
prototype
=
{
// render: replaced by generated code.
r
:
function
(
context
,
partials
,
indent
)
{
return
''
;
},
// variable escaping
v
:
hoganEscape
,
render
:
function
render
(
context
,
partials
,
indent
)
{
return
this
.
ri
([
context
],
partials
||
{},
indent
);
},
// render internal -- a hook for overrides that catches partials too
ri
:
function
(
context
,
partials
,
indent
)
{
return
this
.
r
(
context
,
partials
,
indent
);
},
// tries to find a partial in the curent scope and render it
rp
:
function
(
name
,
context
,
partials
,
indent
)
{
var
partial
=
partials
[
name
];
if
(
!
partial
)
{
return
''
;
}
if
(
this
.
c
&&
typeof
partial
==
'
string
'
)
{
partial
=
this
.
c
.
compile
(
partial
);
}
return
partial
.
ri
(
context
,
partials
,
indent
);
},
// render a section
rs
:
function
(
context
,
partials
,
section
)
{
var
buf
=
''
,
tail
=
context
[
context
.
length
-
1
];
if
(
!
isArray
(
tail
))
{
return
buf
=
section
(
context
,
partials
);
}
for
(
var
i
=
0
;
i
<
tail
.
length
;
i
++
)
{
context
.
push
(
tail
[
i
]);
buf
+=
section
(
context
,
partials
);
context
.
pop
();
}
return
buf
;
},
// maybe start a section
s
:
function
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
)
{
var
pass
;
if
(
isArray
(
val
)
&&
val
.
length
===
0
)
{
return
false
;
}
if
(
typeof
val
==
'
function
'
)
{
val
=
this
.
ls
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
);
}
pass
=
(
val
===
''
)
||
!!
val
;
if
(
!
inverted
&&
pass
&&
ctx
)
{
ctx
.
push
((
typeof
val
==
'
object
'
)
?
val
:
ctx
[
ctx
.
length
-
1
]);
}
return
pass
;
},
// find values with dotted names
d
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
var
names
=
key
.
split
(
'
.
'
),
val
=
this
.
f
(
names
[
0
],
ctx
,
partials
,
returnFound
),
cx
=
null
;
if
(
key
===
'
.
'
&&
isArray
(
ctx
[
ctx
.
length
-
2
]))
{
return
ctx
[
ctx
.
length
-
1
];
}
for
(
var
i
=
1
;
i
<
names
.
length
;
i
++
)
{
if
(
val
&&
typeof
val
==
'
object
'
&&
names
[
i
]
in
val
)
{
cx
=
val
;
val
=
val
[
names
[
i
]];
}
else
{
val
=
''
;
}
}
if
(
returnFound
&&
!
val
)
{
return
false
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
ctx
.
push
(
cx
);
val
=
this
.
lv
(
val
,
ctx
,
partials
);
ctx
.
pop
();
}
return
val
;
},
// find values with normal names
f
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
var
val
=
false
,
v
=
null
,
found
=
false
;
for
(
var
i
=
ctx
.
length
-
1
;
i
>=
0
;
i
--
)
{
v
=
ctx
[
i
];
if
(
v
&&
typeof
v
==
'
object
'
&&
key
in
v
)
{
val
=
v
[
key
];
found
=
true
;
break
;
}
}
if
(
!
found
)
{
return
(
returnFound
)
?
false
:
""
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
val
=
this
.
lv
(
val
,
ctx
,
partials
);
}
return
val
;
},
// higher order templates
ho
:
function
(
val
,
cx
,
partials
,
text
,
tags
)
{
var
compiler
=
this
.
c
;
var
t
=
val
.
call
(
cx
,
text
,
function
(
t
)
{
return
compiler
.
compile
(
t
,
{
delimiters
:
tags
}).
render
(
cx
,
partials
);
});
var
s
=
compiler
.
compile
(
t
.
toString
(),
{
delimiters
:
tags
}).
render
(
cx
,
partials
);
this
.
b
=
s
;
return
false
;
},
// higher order template result buffer
b
:
''
,
// lambda replace section
ls
:
function
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
],
t
=
null
;
if
(
!
inverted
&&
this
.
c
&&
val
.
length
>
0
)
{
return
this
.
ho
(
val
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
),
tags
);
}
t
=
val
.
call
(
cx
);
if
(
typeof
t
==
'
function
'
)
{
if
(
inverted
)
{
return
true
;
}
else
if
(
this
.
c
)
{
return
this
.
ho
(
t
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
),
tags
);
}
}
return
t
;
},
// lambda replace variable
lv
:
function
(
val
,
ctx
,
partials
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
];
var
result
=
val
.
call
(
cx
);
if
(
typeof
result
==
'
function
'
)
{
result
=
result
.
call
(
cx
);
}
result
=
result
.
toString
();
if
(
this
.
c
&&
~
result
.
indexOf
(
"
{{
"
))
{
return
this
.
c
.
compile
(
result
).
render
(
cx
,
partials
);
}
return
result
;
}
};
var
rAmp
=
/&/g
,
rLt
=
/</g
,
rGt
=
/>/g
,
rApos
=
/
\'
/g
,
rQuot
=
/
\"
/g
,
hChars
=
/
[
&<>
\"\']
/
;
function
hoganEscape
(
str
)
{
str
=
String
((
str
===
null
||
str
===
undefined
)
?
''
:
str
);
return
hChars
.
test
(
str
)
?
str
.
replace
(
rAmp
,
'
&
'
)
.
replace
(
rLt
,
'
<
'
)
.
replace
(
rGt
,
'
>
'
)
.
replace
(
rApos
,
'
'
'
)
.
replace
(
rQuot
,
'
"
'
)
:
str
;
}
var
isArray
=
Array
.
isArray
||
function
(
a
)
{
return
Object
.
prototype
.
toString
.
call
(
a
)
===
'
[object Array]
'
;
};
})(
typeof
exports
!==
'
undefined
'
?
exports
:
Hogan
);
(
function
(
Hogan
)
{
// Setup regex assignments
// remove whitespace according to Mustache spec
var
rIsWhitespace
=
/
\S
/
,
rQuot
=
/
\"
/g
,
rNewline
=
/
\n
/g
,
rCr
=
/
\r
/g
,
rSlash
=
/
\\
/g
,
tagTypes
=
{
'
#
'
:
1
,
'
^
'
:
2
,
'
/
'
:
3
,
'
!
'
:
4
,
'
>
'
:
5
,
'
<
'
:
6
,
'
=
'
:
7
,
'
_v
'
:
8
,
'
{
'
:
9
,
'
&
'
:
10
};
Hogan
.
scan
=
function
scan
(
text
,
delimiters
)
{
var
len
=
text
.
length
,
IN_TEXT
=
0
,
IN_TAG_TYPE
=
1
,
IN_TAG
=
2
,
state
=
IN_TEXT
,
tagType
=
null
,
tag
=
null
,
buf
=
''
,
tokens
=
[],
seenTag
=
false
,
i
=
0
,
lineStart
=
0
,
otag
=
'
{{
'
,
ctag
=
'
}}
'
;
function
addBuf
()
{
if
(
buf
.
length
>
0
)
{
tokens
.
push
(
new
String
(
buf
));
buf
=
''
;
}
}
function
lineIsWhitespace
()
{
var
isAllWhitespace
=
true
;
for
(
var
j
=
lineStart
;
j
<
tokens
.
length
;
j
++
)
{
isAllWhitespace
=
(
tokens
[
j
].
tag
&&
tagTypes
[
tokens
[
j
].
tag
]
<
tagTypes
[
'
_v
'
])
||
(
!
tokens
[
j
].
tag
&&
tokens
[
j
].
match
(
rIsWhitespace
)
===
null
);
if
(
!
isAllWhitespace
)
{
return
false
;
}
}
return
isAllWhitespace
;
}
function
filterLine
(
haveSeenTag
,
noNewLine
)
{
addBuf
();
if
(
haveSeenTag
&&
lineIsWhitespace
())
{
for
(
var
j
=
lineStart
,
next
;
j
<
tokens
.
length
;
j
++
)
{
if
(
!
tokens
[
j
].
tag
)
{
if
((
next
=
tokens
[
j
+
1
])
&&
next
.
tag
==
'
>
'
)
{
// set indent to token value
next
.
indent
=
tokens
[
j
].
toString
()
}
tokens
.
splice
(
j
,
1
);
}
}
}
else
if
(
!
noNewLine
)
{
tokens
.
push
({
tag
:
'
\n
'
});
}
seenTag
=
false
;
lineStart
=
tokens
.
length
;
}
function
changeDelimiters
(
text
,
index
)
{
var
close
=
'
=
'
+
ctag
,
closeIndex
=
text
.
indexOf
(
close
,
index
),
delimiters
=
trim
(
text
.
substring
(
text
.
indexOf
(
'
=
'
,
index
)
+
1
,
closeIndex
)
).
split
(
'
'
);
otag
=
delimiters
[
0
];
ctag
=
delimiters
[
1
];
return
closeIndex
+
close
.
length
-
1
;
}
if
(
delimiters
)
{
delimiters
=
delimiters
.
split
(
'
'
);
otag
=
delimiters
[
0
];
ctag
=
delimiters
[
1
];
}
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
state
==
IN_TEXT
)
{
if
(
tagChange
(
otag
,
text
,
i
))
{
--
i
;
addBuf
();
state
=
IN_TAG_TYPE
;
}
else
{
if
(
text
.
charAt
(
i
)
==
'
\n
'
)
{
filterLine
(
seenTag
);
}
else
{
buf
+=
text
.
charAt
(
i
);
}
}
}
else
if
(
state
==
IN_TAG_TYPE
)
{
i
+=
otag
.
length
-
1
;
tag
=
tagTypes
[
text
.
charAt
(
i
+
1
)];
tagType
=
tag
?
text
.
charAt
(
i
+
1
)
:
'
_v
'
;
if
(
tagType
==
'
=
'
)
{
i
=
changeDelimiters
(
text
,
i
);
state
=
IN_TEXT
;
}
else
{
if
(
tag
)
{
i
++
;
}
state
=
IN_TAG
;
}
seenTag
=
i
;
}
else
{
if
(
tagChange
(
ctag
,
text
,
i
))
{
tokens
.
push
({
tag
:
tagType
,
n
:
trim
(
buf
),
otag
:
otag
,
ctag
:
ctag
,
i
:
(
tagType
==
'
/
'
)
?
seenTag
-
ctag
.
length
:
i
+
otag
.
length
});
buf
=
''
;
i
+=
ctag
.
length
-
1
;
state
=
IN_TEXT
;
if
(
tagType
==
'
{
'
)
{
if
(
ctag
==
'
}}
'
)
{
i
++
;
}
else
{
cleanTripleStache
(
tokens
[
tokens
.
length
-
1
]);
}
}
}
else
{
buf
+=
text
.
charAt
(
i
);
}
}
}
filterLine
(
seenTag
,
true
);
return
tokens
;
}
function
cleanTripleStache
(
token
)
{
if
(
token
.
n
.
substr
(
token
.
n
.
length
-
1
)
===
'
}
'
)
{
token
.
n
=
token
.
n
.
substring
(
0
,
token
.
n
.
length
-
1
);
}
}
function
trim
(
s
)
{
if
(
s
.
trim
)
{
return
s
.
trim
();
}
return
s
.
replace
(
/^
\s
*|
\s
*$/g
,
''
);
}
function
tagChange
(
tag
,
text
,
index
)
{
if
(
text
.
charAt
(
index
)
!=
tag
.
charAt
(
0
))
{
return
false
;
}
for
(
var
i
=
1
,
l
=
tag
.
length
;
i
<
l
;
i
++
)
{
if
(
text
.
charAt
(
index
+
i
)
!=
tag
.
charAt
(
i
))
{
return
false
;
}
}
return
true
;
}
function
buildTree
(
tokens
,
kind
,
stack
,
customTags
)
{
var
instructions
=
[],
opener
=
null
,
token
=
null
;
while
(
tokens
.
length
>
0
)
{
token
=
tokens
.
shift
();
if
(
token
.
tag
==
'
#
'
||
token
.
tag
==
'
^
'
||
isOpener
(
token
,
customTags
))
{
stack
.
push
(
token
);
token
.
nodes
=
buildTree
(
tokens
,
token
.
tag
,
stack
,
customTags
);
instructions
.
push
(
token
);
}
else
if
(
token
.
tag
==
'
/
'
)
{
if
(
stack
.
length
===
0
)
{
throw
new
Error
(
'
Closing tag without opener: /
'
+
token
.
n
);
}
opener
=
stack
.
pop
();
if
(
token
.
n
!=
opener
.
n
&&
!
isCloser
(
token
.
n
,
opener
.
n
,
customTags
))
{
throw
new
Error
(
'
Nesting error:
'
+
opener
.
n
+
'
vs.
'
+
token
.
n
);
}
opener
.
end
=
token
.
i
;
return
instructions
;
}
else
{
instructions
.
push
(
token
);
}
}
if
(
stack
.
length
>
0
)
{
throw
new
Error
(
'
missing closing tag:
'
+
stack
.
pop
().
n
);
}
return
instructions
;
}
function
isOpener
(
token
,
tags
)
{
for
(
var
i
=
0
,
l
=
tags
.
length
;
i
<
l
;
i
++
)
{
if
(
tags
[
i
].
o
==
token
.
n
)
{
token
.
tag
=
'
#
'
;
return
true
;
}
}
}
function
isCloser
(
close
,
open
,
tags
)
{
for
(
var
i
=
0
,
l
=
tags
.
length
;
i
<
l
;
i
++
)
{
if
(
tags
[
i
].
c
==
close
&&
tags
[
i
].
o
==
open
)
{
return
true
;
}
}
}
function
writeCode
(
tree
)
{
return
'
i = i || "";var b = i + "";var _ = this;
'
+
walk
(
tree
)
+
'
return b;
'
;
}
Hogan
.
generate
=
function
(
code
,
text
,
options
)
{
if
(
options
.
asString
)
{
return
'
function(c,p,i){
'
+
code
+
'
;}
'
;
}
return
new
Hogan
.
Template
(
new
Function
(
'
c
'
,
'
p
'
,
'
i
'
,
code
),
text
,
Hogan
);
}
function
esc
(
s
)
{
return
s
.
replace
(
rSlash
,
'
\\\\
'
)
.
replace
(
rQuot
,
'
\\\
"
'
)
.
replace
(
rNewline
,
'
\\
n
'
)
.
replace
(
rCr
,
'
\\
r
'
);
}
function
chooseMethod
(
s
)
{
return
(
~
s
.
indexOf
(
'
.
'
))
?
'
d
'
:
'
f
'
;
}
function
walk
(
tree
)
{
var
code
=
''
;
for
(
var
i
=
0
,
l
=
tree
.
length
;
i
<
l
;
i
++
)
{
var
tag
=
tree
[
i
].
tag
;
if
(
tag
==
'
#
'
)
{
code
+=
section
(
tree
[
i
].
nodes
,
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
),
tree
[
i
].
i
,
tree
[
i
].
end
,
tree
[
i
].
otag
+
"
"
+
tree
[
i
].
ctag
);
}
else
if
(
tag
==
'
^
'
)
{
code
+=
invertedSection
(
tree
[
i
].
nodes
,
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
==
'
<
'
||
tag
==
'
>
'
)
{
code
+=
partial
(
tree
[
i
]);
}
else
if
(
tag
==
'
{
'
||
tag
==
'
&
'
)
{
code
+=
tripleStache
(
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
==
'
\n
'
)
{
code
+=
text
(
'
"
\\
n"
'
+
(
tree
.
length
-
1
==
i
?
''
:
'
+ i
'
));
}
else
if
(
tag
==
'
_v
'
)
{
code
+=
variable
(
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
===
undefined
)
{
code
+=
text
(
'
"
'
+
esc
(
tree
[
i
])
+
'
"
'
);
}
}
return
code
;
}
function
section
(
nodes
,
id
,
method
,
start
,
end
,
tags
)
{
return
'
if(_.s(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,1),
'
+
'
c,p,0,
'
+
start
+
'
,
'
+
end
+
'
, "
'
+
tags
+
'
")){
'
+
'
b += _.rs(c,p,
'
+
'
function(c,p){ var b = "";
'
+
walk
(
nodes
)
+
'
return b;});c.pop();}
'
+
'
else{b += _.b; _.b = ""};
'
;
}
function
invertedSection
(
nodes
,
id
,
method
)
{
return
'
if (!_.s(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,1),c,p,1,0,0,"")){
'
+
walk
(
nodes
)
+
'
};
'
;
}
function
partial
(
tok
)
{
return
'
b += _.rp("
'
+
esc
(
tok
.
n
)
+
'
",c,p,"
'
+
(
tok
.
indent
||
''
)
+
'
");
'
;
}
function
tripleStache
(
id
,
method
)
{
return
'
b += (_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,0));
'
;
}
function
variable
(
id
,
method
)
{
return
'
b += (_.v(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,0)));
'
;
}
function
text
(
id
)
{
return
'
b +=
'
+
id
+
'
;
'
;
}
Hogan
.
parse
=
function
(
tokens
,
options
)
{
options
=
options
||
{};
return
buildTree
(
tokens
,
''
,
[],
options
.
sectionTags
||
[]);
},
Hogan
.
cache
=
{};
Hogan
.
compile
=
function
(
text
,
options
)
{
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
// delimiters: A string that overrides the default delimiters.
// Example: "<% %>"
//
options
=
options
||
{};
var
key
=
text
+
'
||
'
+
!!
options
.
asString
;
var
t
=
this
.
cache
[
key
];
if
(
t
)
{
return
t
;
}
t
=
this
.
generate
(
writeCode
(
this
.
parse
(
this
.
scan
(
text
,
options
.
delimiters
),
options
)),
text
,
options
);
return
this
.
cache
[
key
]
=
t
;
};
})(
typeof
exports
!==
'
undefined
'
?
exports
:
Hogan
);
if
(
typeof
define
===
'
function
'
&&
define
.
amd
)
{
define
(
Hogan
);
}
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.common.js
0 → 100644
+
576
-
0
View file @
f764aee4
/*
* Copyright 2011 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var
Hogan
=
{};
(
function
(
Hogan
)
{
Hogan
.
Template
=
function
constructor
(
renderFunc
,
text
,
compiler
)
{
if
(
renderFunc
)
{
this
.
r
=
renderFunc
;
}
this
.
c
=
compiler
;
this
.
text
=
text
||
''
;
}
Hogan
.
Template
.
prototype
=
{
// render: replaced by generated code.
r
:
function
(
context
,
partials
,
indent
)
{
return
''
;
},
// variable escaping
v
:
hoganEscape
,
render
:
function
render
(
context
,
partials
,
indent
)
{
return
this
.
ri
([
context
],
partials
||
{},
indent
);
},
// render internal -- a hook for overrides that catches partials too
ri
:
function
(
context
,
partials
,
indent
)
{
return
this
.
r
(
context
,
partials
,
indent
);
},
// tries to find a partial in the curent scope and render it
rp
:
function
(
name
,
context
,
partials
,
indent
)
{
var
partial
=
partials
[
name
];
if
(
!
partial
)
{
return
''
;
}
if
(
this
.
c
&&
typeof
partial
==
'
string
'
)
{
partial
=
this
.
c
.
compile
(
partial
);
}
return
partial
.
ri
(
context
,
partials
,
indent
);
},
// render a section
rs
:
function
(
context
,
partials
,
section
)
{
var
buf
=
''
,
tail
=
context
[
context
.
length
-
1
];
if
(
!
isArray
(
tail
))
{
return
buf
=
section
(
context
,
partials
);
}
for
(
var
i
=
0
;
i
<
tail
.
length
;
i
++
)
{
context
.
push
(
tail
[
i
]);
buf
+=
section
(
context
,
partials
);
context
.
pop
();
}
return
buf
;
},
// maybe start a section
s
:
function
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
)
{
var
pass
;
if
(
isArray
(
val
)
&&
val
.
length
===
0
)
{
return
false
;
}
if
(
typeof
val
==
'
function
'
)
{
val
=
this
.
ls
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
);
}
pass
=
(
val
===
''
)
||
!!
val
;
if
(
!
inverted
&&
pass
&&
ctx
)
{
ctx
.
push
((
typeof
val
==
'
object
'
)
?
val
:
ctx
[
ctx
.
length
-
1
]);
}
return
pass
;
},
// find values with dotted names
d
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
var
names
=
key
.
split
(
'
.
'
),
val
=
this
.
f
(
names
[
0
],
ctx
,
partials
,
returnFound
),
cx
=
null
;
if
(
key
===
'
.
'
&&
isArray
(
ctx
[
ctx
.
length
-
2
]))
{
return
ctx
[
ctx
.
length
-
1
];
}
for
(
var
i
=
1
;
i
<
names
.
length
;
i
++
)
{
if
(
val
&&
typeof
val
==
'
object
'
&&
names
[
i
]
in
val
)
{
cx
=
val
;
val
=
val
[
names
[
i
]];
}
else
{
val
=
''
;
}
}
if
(
returnFound
&&
!
val
)
{
return
false
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
ctx
.
push
(
cx
);
val
=
this
.
lv
(
val
,
ctx
,
partials
);
ctx
.
pop
();
}
return
val
;
},
// find values with normal names
f
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
var
val
=
false
,
v
=
null
,
found
=
false
;
for
(
var
i
=
ctx
.
length
-
1
;
i
>=
0
;
i
--
)
{
v
=
ctx
[
i
];
if
(
v
&&
typeof
v
==
'
object
'
&&
key
in
v
)
{
val
=
v
[
key
];
found
=
true
;
break
;
}
}
if
(
!
found
)
{
return
(
returnFound
)
?
false
:
""
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
val
=
this
.
lv
(
val
,
ctx
,
partials
);
}
return
val
;
},
// higher order templates
ho
:
function
(
val
,
cx
,
partials
,
text
,
tags
)
{
var
compiler
=
this
.
c
;
var
t
=
val
.
call
(
cx
,
text
,
function
(
t
)
{
return
compiler
.
compile
(
t
,
{
delimiters
:
tags
}).
render
(
cx
,
partials
);
});
var
s
=
compiler
.
compile
(
t
.
toString
(),
{
delimiters
:
tags
}).
render
(
cx
,
partials
);
this
.
b
=
s
;
return
false
;
},
// higher order template result buffer
b
:
''
,
// lambda replace section
ls
:
function
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
],
t
=
null
;
if
(
!
inverted
&&
this
.
c
&&
val
.
length
>
0
)
{
return
this
.
ho
(
val
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
),
tags
);
}
t
=
val
.
call
(
cx
);
if
(
typeof
t
==
'
function
'
)
{
if
(
inverted
)
{
return
true
;
}
else
if
(
this
.
c
)
{
return
this
.
ho
(
t
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
),
tags
);
}
}
return
t
;
},
// lambda replace variable
lv
:
function
(
val
,
ctx
,
partials
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
];
var
result
=
val
.
call
(
cx
);
if
(
typeof
result
==
'
function
'
)
{
result
=
result
.
call
(
cx
);
}
result
=
result
.
toString
();
if
(
this
.
c
&&
~
result
.
indexOf
(
"
{{
"
))
{
return
this
.
c
.
compile
(
result
).
render
(
cx
,
partials
);
}
return
result
;
}
};
var
rAmp
=
/&/g
,
rLt
=
/</g
,
rGt
=
/>/g
,
rApos
=
/
\'
/g
,
rQuot
=
/
\"
/g
,
hChars
=
/
[
&<>
\"\']
/
;
function
hoganEscape
(
str
)
{
str
=
String
((
str
===
null
||
str
===
undefined
)
?
''
:
str
);
return
hChars
.
test
(
str
)
?
str
.
replace
(
rAmp
,
'
&
'
)
.
replace
(
rLt
,
'
<
'
)
.
replace
(
rGt
,
'
>
'
)
.
replace
(
rApos
,
'
'
'
)
.
replace
(
rQuot
,
'
"
'
)
:
str
;
}
var
isArray
=
Array
.
isArray
||
function
(
a
)
{
return
Object
.
prototype
.
toString
.
call
(
a
)
===
'
[object Array]
'
;
};
})(
typeof
exports
!==
'
undefined
'
?
exports
:
Hogan
);
(
function
(
Hogan
)
{
// Setup regex assignments
// remove whitespace according to Mustache spec
var
rIsWhitespace
=
/
\S
/
,
rQuot
=
/
\"
/g
,
rNewline
=
/
\n
/g
,
rCr
=
/
\r
/g
,
rSlash
=
/
\\
/g
,
tagTypes
=
{
'
#
'
:
1
,
'
^
'
:
2
,
'
/
'
:
3
,
'
!
'
:
4
,
'
>
'
:
5
,
'
<
'
:
6
,
'
=
'
:
7
,
'
_v
'
:
8
,
'
{
'
:
9
,
'
&
'
:
10
};
Hogan
.
scan
=
function
scan
(
text
,
delimiters
)
{
var
len
=
text
.
length
,
IN_TEXT
=
0
,
IN_TAG_TYPE
=
1
,
IN_TAG
=
2
,
state
=
IN_TEXT
,
tagType
=
null
,
tag
=
null
,
buf
=
''
,
tokens
=
[],
seenTag
=
false
,
i
=
0
,
lineStart
=
0
,
otag
=
'
{{
'
,
ctag
=
'
}}
'
;
function
addBuf
()
{
if
(
buf
.
length
>
0
)
{
tokens
.
push
(
new
String
(
buf
));
buf
=
''
;
}
}
function
lineIsWhitespace
()
{
var
isAllWhitespace
=
true
;
for
(
var
j
=
lineStart
;
j
<
tokens
.
length
;
j
++
)
{
isAllWhitespace
=
(
tokens
[
j
].
tag
&&
tagTypes
[
tokens
[
j
].
tag
]
<
tagTypes
[
'
_v
'
])
||
(
!
tokens
[
j
].
tag
&&
tokens
[
j
].
match
(
rIsWhitespace
)
===
null
);
if
(
!
isAllWhitespace
)
{
return
false
;
}
}
return
isAllWhitespace
;
}
function
filterLine
(
haveSeenTag
,
noNewLine
)
{
addBuf
();
if
(
haveSeenTag
&&
lineIsWhitespace
())
{
for
(
var
j
=
lineStart
,
next
;
j
<
tokens
.
length
;
j
++
)
{
if
(
!
tokens
[
j
].
tag
)
{
if
((
next
=
tokens
[
j
+
1
])
&&
next
.
tag
==
'
>
'
)
{
// set indent to token value
next
.
indent
=
tokens
[
j
].
toString
()
}
tokens
.
splice
(
j
,
1
);
}
}
}
else
if
(
!
noNewLine
)
{
tokens
.
push
({
tag
:
'
\n
'
});
}
seenTag
=
false
;
lineStart
=
tokens
.
length
;
}
function
changeDelimiters
(
text
,
index
)
{
var
close
=
'
=
'
+
ctag
,
closeIndex
=
text
.
indexOf
(
close
,
index
),
delimiters
=
trim
(
text
.
substring
(
text
.
indexOf
(
'
=
'
,
index
)
+
1
,
closeIndex
)
).
split
(
'
'
);
otag
=
delimiters
[
0
];
ctag
=
delimiters
[
1
];
return
closeIndex
+
close
.
length
-
1
;
}
if
(
delimiters
)
{
delimiters
=
delimiters
.
split
(
'
'
);
otag
=
delimiters
[
0
];
ctag
=
delimiters
[
1
];
}
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
state
==
IN_TEXT
)
{
if
(
tagChange
(
otag
,
text
,
i
))
{
--
i
;
addBuf
();
state
=
IN_TAG_TYPE
;
}
else
{
if
(
text
.
charAt
(
i
)
==
'
\n
'
)
{
filterLine
(
seenTag
);
}
else
{
buf
+=
text
.
charAt
(
i
);
}
}
}
else
if
(
state
==
IN_TAG_TYPE
)
{
i
+=
otag
.
length
-
1
;
tag
=
tagTypes
[
text
.
charAt
(
i
+
1
)];
tagType
=
tag
?
text
.
charAt
(
i
+
1
)
:
'
_v
'
;
if
(
tagType
==
'
=
'
)
{
i
=
changeDelimiters
(
text
,
i
);
state
=
IN_TEXT
;
}
else
{
if
(
tag
)
{
i
++
;
}
state
=
IN_TAG
;
}
seenTag
=
i
;
}
else
{
if
(
tagChange
(
ctag
,
text
,
i
))
{
tokens
.
push
({
tag
:
tagType
,
n
:
trim
(
buf
),
otag
:
otag
,
ctag
:
ctag
,
i
:
(
tagType
==
'
/
'
)
?
seenTag
-
ctag
.
length
:
i
+
otag
.
length
});
buf
=
''
;
i
+=
ctag
.
length
-
1
;
state
=
IN_TEXT
;
if
(
tagType
==
'
{
'
)
{
if
(
ctag
==
'
}}
'
)
{
i
++
;
}
else
{
cleanTripleStache
(
tokens
[
tokens
.
length
-
1
]);
}
}
}
else
{
buf
+=
text
.
charAt
(
i
);
}
}
}
filterLine
(
seenTag
,
true
);
return
tokens
;
}
function
cleanTripleStache
(
token
)
{
if
(
token
.
n
.
substr
(
token
.
n
.
length
-
1
)
===
'
}
'
)
{
token
.
n
=
token
.
n
.
substring
(
0
,
token
.
n
.
length
-
1
);
}
}
function
trim
(
s
)
{
if
(
s
.
trim
)
{
return
s
.
trim
();
}
return
s
.
replace
(
/^
\s
*|
\s
*$/g
,
''
);
}
function
tagChange
(
tag
,
text
,
index
)
{
if
(
text
.
charAt
(
index
)
!=
tag
.
charAt
(
0
))
{
return
false
;
}
for
(
var
i
=
1
,
l
=
tag
.
length
;
i
<
l
;
i
++
)
{
if
(
text
.
charAt
(
index
+
i
)
!=
tag
.
charAt
(
i
))
{
return
false
;
}
}
return
true
;
}
function
buildTree
(
tokens
,
kind
,
stack
,
customTags
)
{
var
instructions
=
[],
opener
=
null
,
token
=
null
;
while
(
tokens
.
length
>
0
)
{
token
=
tokens
.
shift
();
if
(
token
.
tag
==
'
#
'
||
token
.
tag
==
'
^
'
||
isOpener
(
token
,
customTags
))
{
stack
.
push
(
token
);
token
.
nodes
=
buildTree
(
tokens
,
token
.
tag
,
stack
,
customTags
);
instructions
.
push
(
token
);
}
else
if
(
token
.
tag
==
'
/
'
)
{
if
(
stack
.
length
===
0
)
{
throw
new
Error
(
'
Closing tag without opener: /
'
+
token
.
n
);
}
opener
=
stack
.
pop
();
if
(
token
.
n
!=
opener
.
n
&&
!
isCloser
(
token
.
n
,
opener
.
n
,
customTags
))
{
throw
new
Error
(
'
Nesting error:
'
+
opener
.
n
+
'
vs.
'
+
token
.
n
);
}
opener
.
end
=
token
.
i
;
return
instructions
;
}
else
{
instructions
.
push
(
token
);
}
}
if
(
stack
.
length
>
0
)
{
throw
new
Error
(
'
missing closing tag:
'
+
stack
.
pop
().
n
);
}
return
instructions
;
}
function
isOpener
(
token
,
tags
)
{
for
(
var
i
=
0
,
l
=
tags
.
length
;
i
<
l
;
i
++
)
{
if
(
tags
[
i
].
o
==
token
.
n
)
{
token
.
tag
=
'
#
'
;
return
true
;
}
}
}
function
isCloser
(
close
,
open
,
tags
)
{
for
(
var
i
=
0
,
l
=
tags
.
length
;
i
<
l
;
i
++
)
{
if
(
tags
[
i
].
c
==
close
&&
tags
[
i
].
o
==
open
)
{
return
true
;
}
}
}
function
writeCode
(
tree
)
{
return
'
i = i || "";var b = i + "";var _ = this;
'
+
walk
(
tree
)
+
'
return b;
'
;
}
Hogan
.
generate
=
function
(
code
,
text
,
options
)
{
if
(
options
.
asString
)
{
return
'
function(c,p,i){
'
+
code
+
'
;}
'
;
}
return
new
Hogan
.
Template
(
new
Function
(
'
c
'
,
'
p
'
,
'
i
'
,
code
),
text
,
Hogan
);
}
function
esc
(
s
)
{
return
s
.
replace
(
rSlash
,
'
\\\\
'
)
.
replace
(
rQuot
,
'
\\\
"
'
)
.
replace
(
rNewline
,
'
\\
n
'
)
.
replace
(
rCr
,
'
\\
r
'
);
}
function
chooseMethod
(
s
)
{
return
(
~
s
.
indexOf
(
'
.
'
))
?
'
d
'
:
'
f
'
;
}
function
walk
(
tree
)
{
var
code
=
''
;
for
(
var
i
=
0
,
l
=
tree
.
length
;
i
<
l
;
i
++
)
{
var
tag
=
tree
[
i
].
tag
;
if
(
tag
==
'
#
'
)
{
code
+=
section
(
tree
[
i
].
nodes
,
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
),
tree
[
i
].
i
,
tree
[
i
].
end
,
tree
[
i
].
otag
+
"
"
+
tree
[
i
].
ctag
);
}
else
if
(
tag
==
'
^
'
)
{
code
+=
invertedSection
(
tree
[
i
].
nodes
,
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
==
'
<
'
||
tag
==
'
>
'
)
{
code
+=
partial
(
tree
[
i
]);
}
else
if
(
tag
==
'
{
'
||
tag
==
'
&
'
)
{
code
+=
tripleStache
(
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
==
'
\n
'
)
{
code
+=
text
(
'
"
\\
n"
'
+
(
tree
.
length
-
1
==
i
?
''
:
'
+ i
'
));
}
else
if
(
tag
==
'
_v
'
)
{
code
+=
variable
(
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
===
undefined
)
{
code
+=
text
(
'
"
'
+
esc
(
tree
[
i
])
+
'
"
'
);
}
}
return
code
;
}
function
section
(
nodes
,
id
,
method
,
start
,
end
,
tags
)
{
return
'
if(_.s(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,1),
'
+
'
c,p,0,
'
+
start
+
'
,
'
+
end
+
'
, "
'
+
tags
+
'
")){
'
+
'
b += _.rs(c,p,
'
+
'
function(c,p){ var b = "";
'
+
walk
(
nodes
)
+
'
return b;});c.pop();}
'
+
'
else{b += _.b; _.b = ""};
'
;
}
function
invertedSection
(
nodes
,
id
,
method
)
{
return
'
if (!_.s(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,1),c,p,1,0,0,"")){
'
+
walk
(
nodes
)
+
'
};
'
;
}
function
partial
(
tok
)
{
return
'
b += _.rp("
'
+
esc
(
tok
.
n
)
+
'
",c,p,"
'
+
(
tok
.
indent
||
''
)
+
'
");
'
;
}
function
tripleStache
(
id
,
method
)
{
return
'
b += (_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,0));
'
;
}
function
variable
(
id
,
method
)
{
return
'
b += (_.v(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,0)));
'
;
}
function
text
(
id
)
{
return
'
b +=
'
+
id
+
'
;
'
;
}
Hogan
.
parse
=
function
(
tokens
,
options
)
{
options
=
options
||
{};
return
buildTree
(
tokens
,
''
,
[],
options
.
sectionTags
||
[]);
},
Hogan
.
cache
=
{};
Hogan
.
compile
=
function
(
text
,
options
)
{
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
// delimiters: A string that overrides the default delimiters.
// Example: "<% %>"
//
options
=
options
||
{};
var
key
=
text
+
'
||
'
+
!!
options
.
asString
;
var
t
=
this
.
cache
[
key
];
if
(
t
)
{
return
t
;
}
t
=
this
.
generate
(
writeCode
(
this
.
parse
(
this
.
scan
(
text
,
options
.
delimiters
),
options
)),
text
,
options
);
return
this
.
cache
[
key
]
=
t
;
};
})(
typeof
exports
!==
'
undefined
'
?
exports
:
Hogan
);
if
(
typeof
module
!==
'
undefined
'
&&
module
.
exports
)
{
module
.
exports
=
Hogan
;
}
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.js
0 → 100644
+
572
-
0
View file @
f764aee4
/*
* Copyright 2011 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var
Hogan
=
{};
(
function
(
Hogan
)
{
Hogan
.
Template
=
function
constructor
(
renderFunc
,
text
,
compiler
)
{
if
(
renderFunc
)
{
this
.
r
=
renderFunc
;
}
this
.
c
=
compiler
;
this
.
text
=
text
||
''
;
}
Hogan
.
Template
.
prototype
=
{
// render: replaced by generated code.
r
:
function
(
context
,
partials
,
indent
)
{
return
''
;
},
// variable escaping
v
:
hoganEscape
,
render
:
function
render
(
context
,
partials
,
indent
)
{
return
this
.
ri
([
context
],
partials
||
{},
indent
);
},
// render internal -- a hook for overrides that catches partials too
ri
:
function
(
context
,
partials
,
indent
)
{
return
this
.
r
(
context
,
partials
,
indent
);
},
// tries to find a partial in the curent scope and render it
rp
:
function
(
name
,
context
,
partials
,
indent
)
{
var
partial
=
partials
[
name
];
if
(
!
partial
)
{
return
''
;
}
if
(
this
.
c
&&
typeof
partial
==
'
string
'
)
{
partial
=
this
.
c
.
compile
(
partial
);
}
return
partial
.
ri
(
context
,
partials
,
indent
);
},
// render a section
rs
:
function
(
context
,
partials
,
section
)
{
var
buf
=
''
,
tail
=
context
[
context
.
length
-
1
];
if
(
!
isArray
(
tail
))
{
return
buf
=
section
(
context
,
partials
);
}
for
(
var
i
=
0
;
i
<
tail
.
length
;
i
++
)
{
context
.
push
(
tail
[
i
]);
buf
+=
section
(
context
,
partials
);
context
.
pop
();
}
return
buf
;
},
// maybe start a section
s
:
function
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
)
{
var
pass
;
if
(
isArray
(
val
)
&&
val
.
length
===
0
)
{
return
false
;
}
if
(
typeof
val
==
'
function
'
)
{
val
=
this
.
ls
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
);
}
pass
=
(
val
===
''
)
||
!!
val
;
if
(
!
inverted
&&
pass
&&
ctx
)
{
ctx
.
push
((
typeof
val
==
'
object
'
)
?
val
:
ctx
[
ctx
.
length
-
1
]);
}
return
pass
;
},
// find values with dotted names
d
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
var
names
=
key
.
split
(
'
.
'
),
val
=
this
.
f
(
names
[
0
],
ctx
,
partials
,
returnFound
),
cx
=
null
;
if
(
key
===
'
.
'
&&
isArray
(
ctx
[
ctx
.
length
-
2
]))
{
return
ctx
[
ctx
.
length
-
1
];
}
for
(
var
i
=
1
;
i
<
names
.
length
;
i
++
)
{
if
(
val
&&
typeof
val
==
'
object
'
&&
names
[
i
]
in
val
)
{
cx
=
val
;
val
=
val
[
names
[
i
]];
}
else
{
val
=
''
;
}
}
if
(
returnFound
&&
!
val
)
{
return
false
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
ctx
.
push
(
cx
);
val
=
this
.
lv
(
val
,
ctx
,
partials
);
ctx
.
pop
();
}
return
val
;
},
// find values with normal names
f
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
var
val
=
false
,
v
=
null
,
found
=
false
;
for
(
var
i
=
ctx
.
length
-
1
;
i
>=
0
;
i
--
)
{
v
=
ctx
[
i
];
if
(
v
&&
typeof
v
==
'
object
'
&&
key
in
v
)
{
val
=
v
[
key
];
found
=
true
;
break
;
}
}
if
(
!
found
)
{
return
(
returnFound
)
?
false
:
""
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
val
=
this
.
lv
(
val
,
ctx
,
partials
);
}
return
val
;
},
// higher order templates
ho
:
function
(
val
,
cx
,
partials
,
text
,
tags
)
{
var
compiler
=
this
.
c
;
var
t
=
val
.
call
(
cx
,
text
,
function
(
t
)
{
return
compiler
.
compile
(
t
,
{
delimiters
:
tags
}).
render
(
cx
,
partials
);
});
var
s
=
compiler
.
compile
(
t
.
toString
(),
{
delimiters
:
tags
}).
render
(
cx
,
partials
);
this
.
b
=
s
;
return
false
;
},
// higher order template result buffer
b
:
''
,
// lambda replace section
ls
:
function
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
],
t
=
null
;
if
(
!
inverted
&&
this
.
c
&&
val
.
length
>
0
)
{
return
this
.
ho
(
val
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
),
tags
);
}
t
=
val
.
call
(
cx
);
if
(
typeof
t
==
'
function
'
)
{
if
(
inverted
)
{
return
true
;
}
else
if
(
this
.
c
)
{
return
this
.
ho
(
t
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
),
tags
);
}
}
return
t
;
},
// lambda replace variable
lv
:
function
(
val
,
ctx
,
partials
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
];
var
result
=
val
.
call
(
cx
);
if
(
typeof
result
==
'
function
'
)
{
result
=
result
.
call
(
cx
);
}
result
=
result
.
toString
();
if
(
this
.
c
&&
~
result
.
indexOf
(
"
{{
"
))
{
return
this
.
c
.
compile
(
result
).
render
(
cx
,
partials
);
}
return
result
;
}
};
var
rAmp
=
/&/g
,
rLt
=
/</g
,
rGt
=
/>/g
,
rApos
=
/
\'
/g
,
rQuot
=
/
\"
/g
,
hChars
=
/
[
&<>
\"\']
/
;
function
hoganEscape
(
str
)
{
str
=
String
((
str
===
null
||
str
===
undefined
)
?
''
:
str
);
return
hChars
.
test
(
str
)
?
str
.
replace
(
rAmp
,
'
&
'
)
.
replace
(
rLt
,
'
<
'
)
.
replace
(
rGt
,
'
>
'
)
.
replace
(
rApos
,
'
'
'
)
.
replace
(
rQuot
,
'
"
'
)
:
str
;
}
var
isArray
=
Array
.
isArray
||
function
(
a
)
{
return
Object
.
prototype
.
toString
.
call
(
a
)
===
'
[object Array]
'
;
};
})(
typeof
exports
!==
'
undefined
'
?
exports
:
Hogan
);
(
function
(
Hogan
)
{
// Setup regex assignments
// remove whitespace according to Mustache spec
var
rIsWhitespace
=
/
\S
/
,
rQuot
=
/
\"
/g
,
rNewline
=
/
\n
/g
,
rCr
=
/
\r
/g
,
rSlash
=
/
\\
/g
,
tagTypes
=
{
'
#
'
:
1
,
'
^
'
:
2
,
'
/
'
:
3
,
'
!
'
:
4
,
'
>
'
:
5
,
'
<
'
:
6
,
'
=
'
:
7
,
'
_v
'
:
8
,
'
{
'
:
9
,
'
&
'
:
10
};
Hogan
.
scan
=
function
scan
(
text
,
delimiters
)
{
var
len
=
text
.
length
,
IN_TEXT
=
0
,
IN_TAG_TYPE
=
1
,
IN_TAG
=
2
,
state
=
IN_TEXT
,
tagType
=
null
,
tag
=
null
,
buf
=
''
,
tokens
=
[],
seenTag
=
false
,
i
=
0
,
lineStart
=
0
,
otag
=
'
{{
'
,
ctag
=
'
}}
'
;
function
addBuf
()
{
if
(
buf
.
length
>
0
)
{
tokens
.
push
(
new
String
(
buf
));
buf
=
''
;
}
}
function
lineIsWhitespace
()
{
var
isAllWhitespace
=
true
;
for
(
var
j
=
lineStart
;
j
<
tokens
.
length
;
j
++
)
{
isAllWhitespace
=
(
tokens
[
j
].
tag
&&
tagTypes
[
tokens
[
j
].
tag
]
<
tagTypes
[
'
_v
'
])
||
(
!
tokens
[
j
].
tag
&&
tokens
[
j
].
match
(
rIsWhitespace
)
===
null
);
if
(
!
isAllWhitespace
)
{
return
false
;
}
}
return
isAllWhitespace
;
}
function
filterLine
(
haveSeenTag
,
noNewLine
)
{
addBuf
();
if
(
haveSeenTag
&&
lineIsWhitespace
())
{
for
(
var
j
=
lineStart
,
next
;
j
<
tokens
.
length
;
j
++
)
{
if
(
!
tokens
[
j
].
tag
)
{
if
((
next
=
tokens
[
j
+
1
])
&&
next
.
tag
==
'
>
'
)
{
// set indent to token value
next
.
indent
=
tokens
[
j
].
toString
()
}
tokens
.
splice
(
j
,
1
);
}
}
}
else
if
(
!
noNewLine
)
{
tokens
.
push
({
tag
:
'
\n
'
});
}
seenTag
=
false
;
lineStart
=
tokens
.
length
;
}
function
changeDelimiters
(
text
,
index
)
{
var
close
=
'
=
'
+
ctag
,
closeIndex
=
text
.
indexOf
(
close
,
index
),
delimiters
=
trim
(
text
.
substring
(
text
.
indexOf
(
'
=
'
,
index
)
+
1
,
closeIndex
)
).
split
(
'
'
);
otag
=
delimiters
[
0
];
ctag
=
delimiters
[
1
];
return
closeIndex
+
close
.
length
-
1
;
}
if
(
delimiters
)
{
delimiters
=
delimiters
.
split
(
'
'
);
otag
=
delimiters
[
0
];
ctag
=
delimiters
[
1
];
}
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
state
==
IN_TEXT
)
{
if
(
tagChange
(
otag
,
text
,
i
))
{
--
i
;
addBuf
();
state
=
IN_TAG_TYPE
;
}
else
{
if
(
text
.
charAt
(
i
)
==
'
\n
'
)
{
filterLine
(
seenTag
);
}
else
{
buf
+=
text
.
charAt
(
i
);
}
}
}
else
if
(
state
==
IN_TAG_TYPE
)
{
i
+=
otag
.
length
-
1
;
tag
=
tagTypes
[
text
.
charAt
(
i
+
1
)];
tagType
=
tag
?
text
.
charAt
(
i
+
1
)
:
'
_v
'
;
if
(
tagType
==
'
=
'
)
{
i
=
changeDelimiters
(
text
,
i
);
state
=
IN_TEXT
;
}
else
{
if
(
tag
)
{
i
++
;
}
state
=
IN_TAG
;
}
seenTag
=
i
;
}
else
{
if
(
tagChange
(
ctag
,
text
,
i
))
{
tokens
.
push
({
tag
:
tagType
,
n
:
trim
(
buf
),
otag
:
otag
,
ctag
:
ctag
,
i
:
(
tagType
==
'
/
'
)
?
seenTag
-
ctag
.
length
:
i
+
otag
.
length
});
buf
=
''
;
i
+=
ctag
.
length
-
1
;
state
=
IN_TEXT
;
if
(
tagType
==
'
{
'
)
{
if
(
ctag
==
'
}}
'
)
{
i
++
;
}
else
{
cleanTripleStache
(
tokens
[
tokens
.
length
-
1
]);
}
}
}
else
{
buf
+=
text
.
charAt
(
i
);
}
}
}
filterLine
(
seenTag
,
true
);
return
tokens
;
}
function
cleanTripleStache
(
token
)
{
if
(
token
.
n
.
substr
(
token
.
n
.
length
-
1
)
===
'
}
'
)
{
token
.
n
=
token
.
n
.
substring
(
0
,
token
.
n
.
length
-
1
);
}
}
function
trim
(
s
)
{
if
(
s
.
trim
)
{
return
s
.
trim
();
}
return
s
.
replace
(
/^
\s
*|
\s
*$/g
,
''
);
}
function
tagChange
(
tag
,
text
,
index
)
{
if
(
text
.
charAt
(
index
)
!=
tag
.
charAt
(
0
))
{
return
false
;
}
for
(
var
i
=
1
,
l
=
tag
.
length
;
i
<
l
;
i
++
)
{
if
(
text
.
charAt
(
index
+
i
)
!=
tag
.
charAt
(
i
))
{
return
false
;
}
}
return
true
;
}
function
buildTree
(
tokens
,
kind
,
stack
,
customTags
)
{
var
instructions
=
[],
opener
=
null
,
token
=
null
;
while
(
tokens
.
length
>
0
)
{
token
=
tokens
.
shift
();
if
(
token
.
tag
==
'
#
'
||
token
.
tag
==
'
^
'
||
isOpener
(
token
,
customTags
))
{
stack
.
push
(
token
);
token
.
nodes
=
buildTree
(
tokens
,
token
.
tag
,
stack
,
customTags
);
instructions
.
push
(
token
);
}
else
if
(
token
.
tag
==
'
/
'
)
{
if
(
stack
.
length
===
0
)
{
throw
new
Error
(
'
Closing tag without opener: /
'
+
token
.
n
);
}
opener
=
stack
.
pop
();
if
(
token
.
n
!=
opener
.
n
&&
!
isCloser
(
token
.
n
,
opener
.
n
,
customTags
))
{
throw
new
Error
(
'
Nesting error:
'
+
opener
.
n
+
'
vs.
'
+
token
.
n
);
}
opener
.
end
=
token
.
i
;
return
instructions
;
}
else
{
instructions
.
push
(
token
);
}
}
if
(
stack
.
length
>
0
)
{
throw
new
Error
(
'
missing closing tag:
'
+
stack
.
pop
().
n
);
}
return
instructions
;
}
function
isOpener
(
token
,
tags
)
{
for
(
var
i
=
0
,
l
=
tags
.
length
;
i
<
l
;
i
++
)
{
if
(
tags
[
i
].
o
==
token
.
n
)
{
token
.
tag
=
'
#
'
;
return
true
;
}
}
}
function
isCloser
(
close
,
open
,
tags
)
{
for
(
var
i
=
0
,
l
=
tags
.
length
;
i
<
l
;
i
++
)
{
if
(
tags
[
i
].
c
==
close
&&
tags
[
i
].
o
==
open
)
{
return
true
;
}
}
}
function
writeCode
(
tree
)
{
return
'
i = i || "";var b = i + "";var _ = this;
'
+
walk
(
tree
)
+
'
return b;
'
;
}
Hogan
.
generate
=
function
(
code
,
text
,
options
)
{
if
(
options
.
asString
)
{
return
'
function(c,p,i){
'
+
code
+
'
;}
'
;
}
return
new
Hogan
.
Template
(
new
Function
(
'
c
'
,
'
p
'
,
'
i
'
,
code
),
text
,
Hogan
);
}
function
esc
(
s
)
{
return
s
.
replace
(
rSlash
,
'
\\\\
'
)
.
replace
(
rQuot
,
'
\\\
"
'
)
.
replace
(
rNewline
,
'
\\
n
'
)
.
replace
(
rCr
,
'
\\
r
'
);
}
function
chooseMethod
(
s
)
{
return
(
~
s
.
indexOf
(
'
.
'
))
?
'
d
'
:
'
f
'
;
}
function
walk
(
tree
)
{
var
code
=
''
;
for
(
var
i
=
0
,
l
=
tree
.
length
;
i
<
l
;
i
++
)
{
var
tag
=
tree
[
i
].
tag
;
if
(
tag
==
'
#
'
)
{
code
+=
section
(
tree
[
i
].
nodes
,
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
),
tree
[
i
].
i
,
tree
[
i
].
end
,
tree
[
i
].
otag
+
"
"
+
tree
[
i
].
ctag
);
}
else
if
(
tag
==
'
^
'
)
{
code
+=
invertedSection
(
tree
[
i
].
nodes
,
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
==
'
<
'
||
tag
==
'
>
'
)
{
code
+=
partial
(
tree
[
i
]);
}
else
if
(
tag
==
'
{
'
||
tag
==
'
&
'
)
{
code
+=
tripleStache
(
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
==
'
\n
'
)
{
code
+=
text
(
'
"
\\
n"
'
+
(
tree
.
length
-
1
==
i
?
''
:
'
+ i
'
));
}
else
if
(
tag
==
'
_v
'
)
{
code
+=
variable
(
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
===
undefined
)
{
code
+=
text
(
'
"
'
+
esc
(
tree
[
i
])
+
'
"
'
);
}
}
return
code
;
}
function
section
(
nodes
,
id
,
method
,
start
,
end
,
tags
)
{
return
'
if(_.s(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,1),
'
+
'
c,p,0,
'
+
start
+
'
,
'
+
end
+
'
, "
'
+
tags
+
'
")){
'
+
'
b += _.rs(c,p,
'
+
'
function(c,p){ var b = "";
'
+
walk
(
nodes
)
+
'
return b;});c.pop();}
'
+
'
else{b += _.b; _.b = ""};
'
;
}
function
invertedSection
(
nodes
,
id
,
method
)
{
return
'
if (!_.s(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,1),c,p,1,0,0,"")){
'
+
walk
(
nodes
)
+
'
};
'
;
}
function
partial
(
tok
)
{
return
'
b += _.rp("
'
+
esc
(
tok
.
n
)
+
'
",c,p,"
'
+
(
tok
.
indent
||
''
)
+
'
");
'
;
}
function
tripleStache
(
id
,
method
)
{
return
'
b += (_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,0));
'
;
}
function
variable
(
id
,
method
)
{
return
'
b += (_.v(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,0)));
'
;
}
function
text
(
id
)
{
return
'
b +=
'
+
id
+
'
;
'
;
}
Hogan
.
parse
=
function
(
tokens
,
options
)
{
options
=
options
||
{};
return
buildTree
(
tokens
,
''
,
[],
options
.
sectionTags
||
[]);
},
Hogan
.
cache
=
{};
Hogan
.
compile
=
function
(
text
,
options
)
{
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
// delimiters: A string that overrides the default delimiters.
// Example: "<% %>"
//
options
=
options
||
{};
var
key
=
text
+
'
||
'
+
!!
options
.
asString
;
var
t
=
this
.
cache
[
key
];
if
(
t
)
{
return
t
;
}
t
=
this
.
generate
(
writeCode
(
this
.
parse
(
this
.
scan
(
text
,
options
.
delimiters
),
options
)),
text
,
options
);
return
this
.
cache
[
key
]
=
t
;
};
})(
typeof
exports
!==
'
undefined
'
?
exports
:
Hogan
);
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.amd.js
0 → 100644
+
5
-
0
View file @
f764aee4
/**
* @preserve Copyright 2012 Twitter, Inc.
* @license http://www.apache.org/licenses/LICENSE-2.0.txt
*/
var
Hogan
=
{};(
function
(
a
){
function
h
(
a
){
return
a
=
String
(
a
===
null
||
a
===
undefined
?
""
:
a
),
g
.
test
(
a
)?
a
.
replace
(
b
,
"
&
"
).
replace
(
c
,
"
<
"
).
replace
(
d
,
"
>
"
).
replace
(
e
,
"
'
"
).
replace
(
f
,
"
"
"
):
a
}
a
.
Template
=
function
j
(
a
,
b
,
c
){
a
&&
(
this
.
r
=
a
),
this
.
c
=
c
,
this
.
text
=
b
||
""
},
a
.
Template
.
prototype
=
{
r
:
function
(
a
,
b
,
c
){
return
""
},
v
:
h
,
render
:
function
(
b
,
c
,
d
){
return
this
.
ri
([
b
],
c
||
{},
d
)},
ri
:
function
(
a
,
b
,
c
){
return
this
.
r
(
a
,
b
,
c
)},
rp
:
function
(
a
,
b
,
c
,
d
){
var
e
=
c
[
a
];
return
e
?(
this
.
c
&&
typeof
e
==
"
string
"
&&
(
e
=
this
.
c
.
compile
(
e
)),
e
.
ri
(
b
,
c
,
d
)):
""
},
rs
:
function
(
a
,
b
,
c
){
var
d
=
""
,
e
=
a
[
a
.
length
-
1
];
if
(
!
i
(
e
))
return
d
=
c
(
a
,
b
);
for
(
var
f
=
0
;
f
<
e
.
length
;
f
++
)
a
.
push
(
e
[
f
]),
d
+=
c
(
a
,
b
),
a
.
pop
();
return
d
},
s
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
var
h
;
return
i
(
a
)
&&
a
.
length
===
0
?
!
1
:(
typeof
a
==
"
function
"
&&
(
a
=
this
.
ls
(
a
,
b
,
c
,
d
,
e
,
f
,
g
)),
h
=
a
===
""
||!!
a
,
!
d
&&
h
&&
b
&&
b
.
push
(
typeof
a
==
"
object
"
?
a
:
b
[
b
.
length
-
1
]),
h
)},
d
:
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
split
(
"
.
"
),
f
=
this
.
f
(
e
[
0
],
b
,
c
,
d
),
g
=
null
;
if
(
a
===
"
.
"
&&
i
(
b
[
b
.
length
-
2
]))
return
b
[
b
.
length
-
1
];
for
(
var
h
=
1
;
h
<
e
.
length
;
h
++
)
f
&&
typeof
f
==
"
object
"
&&
e
[
h
]
in
f
?(
g
=
f
,
f
=
f
[
e
[
h
]]):
f
=
""
;
return
d
&&!
f
?
!
1
:(
!
d
&&
typeof
f
==
"
function
"
&&
(
b
.
push
(
g
),
f
=
this
.
lv
(
f
,
b
,
c
),
b
.
pop
()),
f
)},
f
:
function
(
a
,
b
,
c
,
d
){
var
e
=!
1
,
f
=
null
,
g
=!
1
;
for
(
var
h
=
b
.
length
-
1
;
h
>=
0
;
h
--
){
f
=
b
[
h
];
if
(
f
&&
typeof
f
==
"
object
"
&&
a
in
f
){
e
=
f
[
a
],
g
=!
0
;
break
}}
return
g
?(
!
d
&&
typeof
e
==
"
function
"
&&
(
e
=
this
.
lv
(
e
,
b
,
c
)),
e
):
d
?
!
1
:
""
},
ho
:
function
(
a
,
b
,
c
,
d
,
e
){
var
f
=
this
.
c
,
g
=
a
.
call
(
b
,
d
,
function
(
a
){
return
f
.
compile
(
a
,{
delimiters
:
e
}).
render
(
b
,
c
)}),
h
=
f
.
compile
(
g
.
toString
(),{
delimiters
:
e
}).
render
(
b
,
c
);
return
this
.
b
=
h
,
!
1
},
b
:
""
,
ls
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
var
h
=
b
[
b
.
length
-
1
],
i
=
null
;
if
(
!
d
&&
this
.
c
&&
a
.
length
>
0
)
return
this
.
ho
(
a
,
h
,
c
,
this
.
text
.
substring
(
e
,
f
),
g
);
i
=
a
.
call
(
h
);
if
(
typeof
i
==
"
function
"
){
if
(
d
)
return
!
0
;
if
(
this
.
c
)
return
this
.
ho
(
i
,
h
,
c
,
this
.
text
.
substring
(
e
,
f
),
g
)}
return
i
},
lv
:
function
(
a
,
b
,
c
){
var
d
=
b
[
b
.
length
-
1
],
e
=
a
.
call
(
d
);
return
typeof
e
==
"
function
"
&&
(
e
=
e
.
call
(
d
)),
e
=
e
.
toString
(),
this
.
c
&&~
e
.
indexOf
(
"
{{
"
)?
this
.
c
.
compile
(
e
).
render
(
d
,
c
):
e
}};
var
b
=
/&/g
,
c
=
/</g
,
d
=
/>/g
,
e
=
/
\'
/g
,
f
=
/
\"
/g
,
g
=
/
[
&<>
\"\']
/
,
i
=
Array
.
isArray
||
function
(
a
){
return
Object
.
prototype
.
toString
.
call
(
a
)
===
"
[object Array]
"
}})(
typeof
exports
!=
"
undefined
"
?
exports
:
Hogan
),
function
(
a
){
function
h
(
a
){
a
.
n
.
substr
(
a
.
n
.
length
-
1
)
===
"
}
"
&&
(
a
.
n
=
a
.
n
.
substring
(
0
,
a
.
n
.
length
-
1
))}
function
i
(
a
){
return
a
.
trim
?
a
.
trim
():
a
.
replace
(
/^
\s
*|
\s
*$/g
,
""
)}
function
j
(
a
,
b
,
c
){
if
(
b
.
charAt
(
c
)
!=
a
.
charAt
(
0
))
return
!
1
;
for
(
var
d
=
1
,
e
=
a
.
length
;
d
<
e
;
d
++
)
if
(
b
.
charAt
(
c
+
d
)
!=
a
.
charAt
(
d
))
return
!
1
;
return
!
0
}
function
k
(
a
,
b
,
c
,
d
){
var
e
=
[],
f
=
null
,
g
=
null
;
while
(
a
.
length
>
0
){
g
=
a
.
shift
();
if
(
g
.
tag
==
"
#
"
||
g
.
tag
==
"
^
"
||
l
(
g
,
d
))
c
.
push
(
g
),
g
.
nodes
=
k
(
a
,
g
.
tag
,
c
,
d
),
e
.
push
(
g
);
else
{
if
(
g
.
tag
==
"
/
"
){
if
(
c
.
length
===
0
)
throw
new
Error
(
"
Closing tag without opener: /
"
+
g
.
n
);
f
=
c
.
pop
();
if
(
g
.
n
!=
f
.
n
&&!
m
(
g
.
n
,
f
.
n
,
d
))
throw
new
Error
(
"
Nesting error:
"
+
f
.
n
+
"
vs.
"
+
g
.
n
);
return
f
.
end
=
g
.
i
,
e
}
e
.
push
(
g
)}}
if
(
c
.
length
>
0
)
throw
new
Error
(
"
missing closing tag:
"
+
c
.
pop
().
n
);
return
e
}
function
l
(
a
,
b
){
for
(
var
c
=
0
,
d
=
b
.
length
;
c
<
d
;
c
++
)
if
(
b
[
c
].
o
==
a
.
n
)
return
a
.
tag
=
"
#
"
,
!
0
}
function
m
(
a
,
b
,
c
){
for
(
var
d
=
0
,
e
=
c
.
length
;
d
<
e
;
d
++
)
if
(
c
[
d
].
c
==
a
&&
c
[
d
].
o
==
b
)
return
!
0
}
function
n
(
a
){
return
'
i = i || "";var b = i + "";var _ = this;
'
+
q
(
a
)
+
"
return b;
"
}
function
o
(
a
){
return
a
.
replace
(
f
,
"
\\\\
"
).
replace
(
c
,
'
\\
"
'
).
replace
(
d
,
"
\\
n
"
).
replace
(
e
,
"
\\
r
"
)}
function
p
(
a
){
return
~
a
.
indexOf
(
"
.
"
)?
"
d
"
:
"
f
"
}
function
q
(
a
){
var
b
=
""
;
for
(
var
c
=
0
,
d
=
a
.
length
;
c
<
d
;
c
++
){
var
e
=
a
[
c
].
tag
;
e
==
"
#
"
?
b
+=
r
(
a
[
c
].
nodes
,
a
[
c
].
n
,
p
(
a
[
c
].
n
),
a
[
c
].
i
,
a
[
c
].
end
,
a
[
c
].
otag
+
"
"
+
a
[
c
].
ctag
):
e
==
"
^
"
?
b
+=
s
(
a
[
c
].
nodes
,
a
[
c
].
n
,
p
(
a
[
c
].
n
)):
e
==
"
<
"
||
e
==
"
>
"
?
b
+=
t
(
a
[
c
]):
e
==
"
{
"
||
e
==
"
&
"
?
b
+=
u
(
a
[
c
].
n
,
p
(
a
[
c
].
n
)):
e
==
"
\n
"
?
b
+=
w
(
'
"
\\
n"
'
+
(
a
.
length
-
1
==
c
?
""
:
"
+ i
"
)):
e
==
"
_v
"
?
b
+=
v
(
a
[
c
].
n
,
p
(
a
[
c
].
n
)):
e
===
undefined
&&
(
b
+=
w
(
'
"
'
+
o
(
a
[
c
])
+
'
"
'
))}
return
b
}
function
r
(
a
,
b
,
c
,
d
,
e
,
f
){
return
"
if(_.s(_.
"
+
c
+
'
("
'
+
o
(
b
)
+
'
",c,p,1),
'
+
"
c,p,0,
"
+
d
+
"
,
"
+
e
+
'
, "
'
+
f
+
'
")){
'
+
"
b += _.rs(c,p,
"
+
'
function(c,p){ var b = "";
'
+
q
(
a
)
+
"
return b;});c.pop();}
"
+
'
else{b += _.b; _.b = ""};
'
}
function
s
(
a
,
b
,
c
){
return
"
if (!_.s(_.
"
+
c
+
'
("
'
+
o
(
b
)
+
'
",c,p,1),c,p,1,0,0,"")){
'
+
q
(
a
)
+
"
};
"
}
function
t
(
a
){
return
'
b += _.rp("
'
+
o
(
a
.
n
)
+
'
",c,p,"
'
+
(
a
.
indent
||
""
)
+
'
");
'
}
function
u
(
a
,
b
){
return
"
b += (_.
"
+
b
+
'
("
'
+
o
(
a
)
+
'
",c,p,0));
'
}
function
v
(
a
,
b
){
return
"
b += (_.v(_.
"
+
b
+
'
("
'
+
o
(
a
)
+
'
",c,p,0)));
'
}
function
w
(
a
){
return
"
b +=
"
+
a
+
"
;
"
}
var
b
=
/
\S
/
,
c
=
/
\"
/g
,
d
=
/
\n
/g
,
e
=
/
\r
/g
,
f
=
/
\\
/g
,
g
=
{
"
#
"
:
1
,
"
^
"
:
2
,
"
/
"
:
3
,
"
!
"
:
4
,
"
>
"
:
5
,
"
<
"
:
6
,
"
=
"
:
7
,
_v
:
8
,
"
{
"
:
9
,
"
&
"
:
10
};
a
.
scan
=
function
(
c
,
d
){
function
w
(){
p
.
length
>
0
&&
(
q
.
push
(
new
String
(
p
)),
p
=
""
)}
function
x
(){
var
a
=!
0
;
for
(
var
c
=
t
;
c
<
q
.
length
;
c
++
){
a
=
q
[
c
].
tag
&&
g
[
q
[
c
].
tag
]
<
g
.
_v
||!
q
[
c
].
tag
&&
q
[
c
].
match
(
b
)
===
null
;
if
(
!
a
)
return
!
1
}
return
a
}
function
y
(
a
,
b
){
w
();
if
(
a
&&
x
())
for
(
var
c
=
t
,
d
;
c
<
q
.
length
;
c
++
)
q
[
c
].
tag
||
((
d
=
q
[
c
+
1
])
&&
d
.
tag
==
"
>
"
&&
(
d
.
indent
=
q
[
c
].
toString
()),
q
.
splice
(
c
,
1
));
else
b
||
q
.
push
({
tag
:
"
\n
"
});
r
=!
1
,
t
=
q
.
length
}
function
z
(
a
,
b
){
var
c
=
"
=
"
+
v
,
d
=
a
.
indexOf
(
c
,
b
),
e
=
i
(
a
.
substring
(
a
.
indexOf
(
"
=
"
,
b
)
+
1
,
d
)).
split
(
"
"
);
return
u
=
e
[
0
],
v
=
e
[
1
],
d
+
c
.
length
-
1
}
var
e
=
c
.
length
,
f
=
0
,
k
=
1
,
l
=
2
,
m
=
f
,
n
=
null
,
o
=
null
,
p
=
""
,
q
=
[],
r
=!
1
,
s
=
0
,
t
=
0
,
u
=
"
{{
"
,
v
=
"
}}
"
;
d
&&
(
d
=
d
.
split
(
"
"
),
u
=
d
[
0
],
v
=
d
[
1
]);
for
(
s
=
0
;
s
<
e
;
s
++
)
m
==
f
?
j
(
u
,
c
,
s
)?(
--
s
,
w
(),
m
=
k
):
c
.
charAt
(
s
)
==
"
\n
"
?
y
(
r
):
p
+=
c
.
charAt
(
s
):
m
==
k
?(
s
+=
u
.
length
-
1
,
o
=
g
[
c
.
charAt
(
s
+
1
)],
n
=
o
?
c
.
charAt
(
s
+
1
):
"
_v
"
,
n
==
"
=
"
?(
s
=
z
(
c
,
s
),
m
=
f
):(
o
&&
s
++
,
m
=
l
),
r
=
s
):
j
(
v
,
c
,
s
)?(
q
.
push
({
tag
:
n
,
n
:
i
(
p
),
otag
:
u
,
ctag
:
v
,
i
:
n
==
"
/
"
?
r
-
v
.
length
:
s
+
u
.
length
}),
p
=
""
,
s
+=
v
.
length
-
1
,
m
=
f
,
n
==
"
{
"
&&
(
v
==
"
}}
"
?
s
++
:
h
(
q
[
q
.
length
-
1
]))):
p
+=
c
.
charAt
(
s
);
return
y
(
r
,
!
0
),
q
},
a
.
generate
=
function
(
b
,
c
,
d
){
return
d
.
asString
?
"
function(c,p,i){
"
+
b
+
"
;}
"
:
new
a
.
Template
(
new
Function
(
"
c
"
,
"
p
"
,
"
i
"
,
b
),
c
,
a
)},
a
.
parse
=
function
(
a
,
b
){
return
b
=
b
||
{},
k
(
a
,
""
,[],
b
.
sectionTags
||
[])},
a
.
cache
=
{},
a
.
compile
=
function
(
a
,
b
){
b
=
b
||
{};
var
c
=
a
+
"
||
"
+!!
b
.
asString
,
d
=
this
.
cache
[
c
];
return
d
?
d
:(
d
=
this
.
generate
(
n
(
this
.
parse
(
this
.
scan
(
a
,
b
.
delimiters
),
b
)),
a
,
b
),
this
.
cache
[
c
]
=
d
)}}(
typeof
exports
!=
"
undefined
"
?
exports
:
Hogan
),
typeof
define
==
"
function
"
&&
define
.
amd
&&
define
(
Hogan
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.common.js
0 → 100644
+
5
-
0
View file @
f764aee4
/**
* @preserve Copyright 2012 Twitter, Inc.
* @license http://www.apache.org/licenses/LICENSE-2.0.txt
*/
var
Hogan
=
{};(
function
(
a
){
function
h
(
a
){
return
a
=
String
(
a
===
null
||
a
===
undefined
?
""
:
a
),
g
.
test
(
a
)?
a
.
replace
(
b
,
"
&
"
).
replace
(
c
,
"
<
"
).
replace
(
d
,
"
>
"
).
replace
(
e
,
"
'
"
).
replace
(
f
,
"
"
"
):
a
}
a
.
Template
=
function
j
(
a
,
b
,
c
){
a
&&
(
this
.
r
=
a
),
this
.
c
=
c
,
this
.
text
=
b
||
""
},
a
.
Template
.
prototype
=
{
r
:
function
(
a
,
b
,
c
){
return
""
},
v
:
h
,
render
:
function
(
b
,
c
,
d
){
return
this
.
ri
([
b
],
c
||
{},
d
)},
ri
:
function
(
a
,
b
,
c
){
return
this
.
r
(
a
,
b
,
c
)},
rp
:
function
(
a
,
b
,
c
,
d
){
var
e
=
c
[
a
];
return
e
?(
this
.
c
&&
typeof
e
==
"
string
"
&&
(
e
=
this
.
c
.
compile
(
e
)),
e
.
ri
(
b
,
c
,
d
)):
""
},
rs
:
function
(
a
,
b
,
c
){
var
d
=
""
,
e
=
a
[
a
.
length
-
1
];
if
(
!
i
(
e
))
return
d
=
c
(
a
,
b
);
for
(
var
f
=
0
;
f
<
e
.
length
;
f
++
)
a
.
push
(
e
[
f
]),
d
+=
c
(
a
,
b
),
a
.
pop
();
return
d
},
s
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
var
h
;
return
i
(
a
)
&&
a
.
length
===
0
?
!
1
:(
typeof
a
==
"
function
"
&&
(
a
=
this
.
ls
(
a
,
b
,
c
,
d
,
e
,
f
,
g
)),
h
=
a
===
""
||!!
a
,
!
d
&&
h
&&
b
&&
b
.
push
(
typeof
a
==
"
object
"
?
a
:
b
[
b
.
length
-
1
]),
h
)},
d
:
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
split
(
"
.
"
),
f
=
this
.
f
(
e
[
0
],
b
,
c
,
d
),
g
=
null
;
if
(
a
===
"
.
"
&&
i
(
b
[
b
.
length
-
2
]))
return
b
[
b
.
length
-
1
];
for
(
var
h
=
1
;
h
<
e
.
length
;
h
++
)
f
&&
typeof
f
==
"
object
"
&&
e
[
h
]
in
f
?(
g
=
f
,
f
=
f
[
e
[
h
]]):
f
=
""
;
return
d
&&!
f
?
!
1
:(
!
d
&&
typeof
f
==
"
function
"
&&
(
b
.
push
(
g
),
f
=
this
.
lv
(
f
,
b
,
c
),
b
.
pop
()),
f
)},
f
:
function
(
a
,
b
,
c
,
d
){
var
e
=!
1
,
f
=
null
,
g
=!
1
;
for
(
var
h
=
b
.
length
-
1
;
h
>=
0
;
h
--
){
f
=
b
[
h
];
if
(
f
&&
typeof
f
==
"
object
"
&&
a
in
f
){
e
=
f
[
a
],
g
=!
0
;
break
}}
return
g
?(
!
d
&&
typeof
e
==
"
function
"
&&
(
e
=
this
.
lv
(
e
,
b
,
c
)),
e
):
d
?
!
1
:
""
},
ho
:
function
(
a
,
b
,
c
,
d
,
e
){
var
f
=
this
.
c
,
g
=
a
.
call
(
b
,
d
,
function
(
a
){
return
f
.
compile
(
a
,{
delimiters
:
e
}).
render
(
b
,
c
)}),
h
=
f
.
compile
(
g
.
toString
(),{
delimiters
:
e
}).
render
(
b
,
c
);
return
this
.
b
=
h
,
!
1
},
b
:
""
,
ls
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
var
h
=
b
[
b
.
length
-
1
],
i
=
null
;
if
(
!
d
&&
this
.
c
&&
a
.
length
>
0
)
return
this
.
ho
(
a
,
h
,
c
,
this
.
text
.
substring
(
e
,
f
),
g
);
i
=
a
.
call
(
h
);
if
(
typeof
i
==
"
function
"
){
if
(
d
)
return
!
0
;
if
(
this
.
c
)
return
this
.
ho
(
i
,
h
,
c
,
this
.
text
.
substring
(
e
,
f
),
g
)}
return
i
},
lv
:
function
(
a
,
b
,
c
){
var
d
=
b
[
b
.
length
-
1
],
e
=
a
.
call
(
d
);
return
typeof
e
==
"
function
"
&&
(
e
=
e
.
call
(
d
)),
e
=
e
.
toString
(),
this
.
c
&&~
e
.
indexOf
(
"
{{
"
)?
this
.
c
.
compile
(
e
).
render
(
d
,
c
):
e
}};
var
b
=
/&/g
,
c
=
/</g
,
d
=
/>/g
,
e
=
/
\'
/g
,
f
=
/
\"
/g
,
g
=
/
[
&<>
\"\']
/
,
i
=
Array
.
isArray
||
function
(
a
){
return
Object
.
prototype
.
toString
.
call
(
a
)
===
"
[object Array]
"
}})(
typeof
exports
!=
"
undefined
"
?
exports
:
Hogan
),
function
(
a
){
function
h
(
a
){
a
.
n
.
substr
(
a
.
n
.
length
-
1
)
===
"
}
"
&&
(
a
.
n
=
a
.
n
.
substring
(
0
,
a
.
n
.
length
-
1
))}
function
i
(
a
){
return
a
.
trim
?
a
.
trim
():
a
.
replace
(
/^
\s
*|
\s
*$/g
,
""
)}
function
j
(
a
,
b
,
c
){
if
(
b
.
charAt
(
c
)
!=
a
.
charAt
(
0
))
return
!
1
;
for
(
var
d
=
1
,
e
=
a
.
length
;
d
<
e
;
d
++
)
if
(
b
.
charAt
(
c
+
d
)
!=
a
.
charAt
(
d
))
return
!
1
;
return
!
0
}
function
k
(
a
,
b
,
c
,
d
){
var
e
=
[],
f
=
null
,
g
=
null
;
while
(
a
.
length
>
0
){
g
=
a
.
shift
();
if
(
g
.
tag
==
"
#
"
||
g
.
tag
==
"
^
"
||
l
(
g
,
d
))
c
.
push
(
g
),
g
.
nodes
=
k
(
a
,
g
.
tag
,
c
,
d
),
e
.
push
(
g
);
else
{
if
(
g
.
tag
==
"
/
"
){
if
(
c
.
length
===
0
)
throw
new
Error
(
"
Closing tag without opener: /
"
+
g
.
n
);
f
=
c
.
pop
();
if
(
g
.
n
!=
f
.
n
&&!
m
(
g
.
n
,
f
.
n
,
d
))
throw
new
Error
(
"
Nesting error:
"
+
f
.
n
+
"
vs.
"
+
g
.
n
);
return
f
.
end
=
g
.
i
,
e
}
e
.
push
(
g
)}}
if
(
c
.
length
>
0
)
throw
new
Error
(
"
missing closing tag:
"
+
c
.
pop
().
n
);
return
e
}
function
l
(
a
,
b
){
for
(
var
c
=
0
,
d
=
b
.
length
;
c
<
d
;
c
++
)
if
(
b
[
c
].
o
==
a
.
n
)
return
a
.
tag
=
"
#
"
,
!
0
}
function
m
(
a
,
b
,
c
){
for
(
var
d
=
0
,
e
=
c
.
length
;
d
<
e
;
d
++
)
if
(
c
[
d
].
c
==
a
&&
c
[
d
].
o
==
b
)
return
!
0
}
function
n
(
a
){
return
'
i = i || "";var b = i + "";var _ = this;
'
+
q
(
a
)
+
"
return b;
"
}
function
o
(
a
){
return
a
.
replace
(
f
,
"
\\\\
"
).
replace
(
c
,
'
\\
"
'
).
replace
(
d
,
"
\\
n
"
).
replace
(
e
,
"
\\
r
"
)}
function
p
(
a
){
return
~
a
.
indexOf
(
"
.
"
)?
"
d
"
:
"
f
"
}
function
q
(
a
){
var
b
=
""
;
for
(
var
c
=
0
,
d
=
a
.
length
;
c
<
d
;
c
++
){
var
e
=
a
[
c
].
tag
;
e
==
"
#
"
?
b
+=
r
(
a
[
c
].
nodes
,
a
[
c
].
n
,
p
(
a
[
c
].
n
),
a
[
c
].
i
,
a
[
c
].
end
,
a
[
c
].
otag
+
"
"
+
a
[
c
].
ctag
):
e
==
"
^
"
?
b
+=
s
(
a
[
c
].
nodes
,
a
[
c
].
n
,
p
(
a
[
c
].
n
)):
e
==
"
<
"
||
e
==
"
>
"
?
b
+=
t
(
a
[
c
]):
e
==
"
{
"
||
e
==
"
&
"
?
b
+=
u
(
a
[
c
].
n
,
p
(
a
[
c
].
n
)):
e
==
"
\n
"
?
b
+=
w
(
'
"
\\
n"
'
+
(
a
.
length
-
1
==
c
?
""
:
"
+ i
"
)):
e
==
"
_v
"
?
b
+=
v
(
a
[
c
].
n
,
p
(
a
[
c
].
n
)):
e
===
undefined
&&
(
b
+=
w
(
'
"
'
+
o
(
a
[
c
])
+
'
"
'
))}
return
b
}
function
r
(
a
,
b
,
c
,
d
,
e
,
f
){
return
"
if(_.s(_.
"
+
c
+
'
("
'
+
o
(
b
)
+
'
",c,p,1),
'
+
"
c,p,0,
"
+
d
+
"
,
"
+
e
+
'
, "
'
+
f
+
'
")){
'
+
"
b += _.rs(c,p,
"
+
'
function(c,p){ var b = "";
'
+
q
(
a
)
+
"
return b;});c.pop();}
"
+
'
else{b += _.b; _.b = ""};
'
}
function
s
(
a
,
b
,
c
){
return
"
if (!_.s(_.
"
+
c
+
'
("
'
+
o
(
b
)
+
'
",c,p,1),c,p,1,0,0,"")){
'
+
q
(
a
)
+
"
};
"
}
function
t
(
a
){
return
'
b += _.rp("
'
+
o
(
a
.
n
)
+
'
",c,p,"
'
+
(
a
.
indent
||
""
)
+
'
");
'
}
function
u
(
a
,
b
){
return
"
b += (_.
"
+
b
+
'
("
'
+
o
(
a
)
+
'
",c,p,0));
'
}
function
v
(
a
,
b
){
return
"
b += (_.v(_.
"
+
b
+
'
("
'
+
o
(
a
)
+
'
",c,p,0)));
'
}
function
w
(
a
){
return
"
b +=
"
+
a
+
"
;
"
}
var
b
=
/
\S
/
,
c
=
/
\"
/g
,
d
=
/
\n
/g
,
e
=
/
\r
/g
,
f
=
/
\\
/g
,
g
=
{
"
#
"
:
1
,
"
^
"
:
2
,
"
/
"
:
3
,
"
!
"
:
4
,
"
>
"
:
5
,
"
<
"
:
6
,
"
=
"
:
7
,
_v
:
8
,
"
{
"
:
9
,
"
&
"
:
10
};
a
.
scan
=
function
(
c
,
d
){
function
w
(){
p
.
length
>
0
&&
(
q
.
push
(
new
String
(
p
)),
p
=
""
)}
function
x
(){
var
a
=!
0
;
for
(
var
c
=
t
;
c
<
q
.
length
;
c
++
){
a
=
q
[
c
].
tag
&&
g
[
q
[
c
].
tag
]
<
g
.
_v
||!
q
[
c
].
tag
&&
q
[
c
].
match
(
b
)
===
null
;
if
(
!
a
)
return
!
1
}
return
a
}
function
y
(
a
,
b
){
w
();
if
(
a
&&
x
())
for
(
var
c
=
t
,
d
;
c
<
q
.
length
;
c
++
)
q
[
c
].
tag
||
((
d
=
q
[
c
+
1
])
&&
d
.
tag
==
"
>
"
&&
(
d
.
indent
=
q
[
c
].
toString
()),
q
.
splice
(
c
,
1
));
else
b
||
q
.
push
({
tag
:
"
\n
"
});
r
=!
1
,
t
=
q
.
length
}
function
z
(
a
,
b
){
var
c
=
"
=
"
+
v
,
d
=
a
.
indexOf
(
c
,
b
),
e
=
i
(
a
.
substring
(
a
.
indexOf
(
"
=
"
,
b
)
+
1
,
d
)).
split
(
"
"
);
return
u
=
e
[
0
],
v
=
e
[
1
],
d
+
c
.
length
-
1
}
var
e
=
c
.
length
,
f
=
0
,
k
=
1
,
l
=
2
,
m
=
f
,
n
=
null
,
o
=
null
,
p
=
""
,
q
=
[],
r
=!
1
,
s
=
0
,
t
=
0
,
u
=
"
{{
"
,
v
=
"
}}
"
;
d
&&
(
d
=
d
.
split
(
"
"
),
u
=
d
[
0
],
v
=
d
[
1
]);
for
(
s
=
0
;
s
<
e
;
s
++
)
m
==
f
?
j
(
u
,
c
,
s
)?(
--
s
,
w
(),
m
=
k
):
c
.
charAt
(
s
)
==
"
\n
"
?
y
(
r
):
p
+=
c
.
charAt
(
s
):
m
==
k
?(
s
+=
u
.
length
-
1
,
o
=
g
[
c
.
charAt
(
s
+
1
)],
n
=
o
?
c
.
charAt
(
s
+
1
):
"
_v
"
,
n
==
"
=
"
?(
s
=
z
(
c
,
s
),
m
=
f
):(
o
&&
s
++
,
m
=
l
),
r
=
s
):
j
(
v
,
c
,
s
)?(
q
.
push
({
tag
:
n
,
n
:
i
(
p
),
otag
:
u
,
ctag
:
v
,
i
:
n
==
"
/
"
?
r
-
v
.
length
:
s
+
u
.
length
}),
p
=
""
,
s
+=
v
.
length
-
1
,
m
=
f
,
n
==
"
{
"
&&
(
v
==
"
}}
"
?
s
++
:
h
(
q
[
q
.
length
-
1
]))):
p
+=
c
.
charAt
(
s
);
return
y
(
r
,
!
0
),
q
},
a
.
generate
=
function
(
b
,
c
,
d
){
return
d
.
asString
?
"
function(c,p,i){
"
+
b
+
"
;}
"
:
new
a
.
Template
(
new
Function
(
"
c
"
,
"
p
"
,
"
i
"
,
b
),
c
,
a
)},
a
.
parse
=
function
(
a
,
b
){
return
b
=
b
||
{},
k
(
a
,
""
,[],
b
.
sectionTags
||
[])},
a
.
cache
=
{},
a
.
compile
=
function
(
a
,
b
){
b
=
b
||
{};
var
c
=
a
+
"
||
"
+!!
b
.
asString
,
d
=
this
.
cache
[
c
];
return
d
?
d
:(
d
=
this
.
generate
(
n
(
this
.
parse
(
this
.
scan
(
a
,
b
.
delimiters
),
b
)),
a
,
b
),
this
.
cache
[
c
]
=
d
)}}(
typeof
exports
!=
"
undefined
"
?
exports
:
Hogan
),
typeof
module
!=
"
undefined
"
&&
module
.
exports
&&
(
module
.
exports
=
Hogan
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.js
0 → 100644
+
5
-
0
View file @
f764aee4
/**
* @preserve Copyright 2012 Twitter, Inc.
* @license http://www.apache.org/licenses/LICENSE-2.0.txt
*/
var
Hogan
=
{};(
function
(
a
){
function
h
(
a
){
return
a
=
String
(
a
===
null
||
a
===
undefined
?
""
:
a
),
g
.
test
(
a
)?
a
.
replace
(
b
,
"
&
"
).
replace
(
c
,
"
<
"
).
replace
(
d
,
"
>
"
).
replace
(
e
,
"
'
"
).
replace
(
f
,
"
"
"
):
a
}
a
.
Template
=
function
j
(
a
,
b
,
c
){
a
&&
(
this
.
r
=
a
),
this
.
c
=
c
,
this
.
text
=
b
||
""
},
a
.
Template
.
prototype
=
{
r
:
function
(
a
,
b
,
c
){
return
""
},
v
:
h
,
render
:
function
(
b
,
c
,
d
){
return
this
.
ri
([
b
],
c
||
{},
d
)},
ri
:
function
(
a
,
b
,
c
){
return
this
.
r
(
a
,
b
,
c
)},
rp
:
function
(
a
,
b
,
c
,
d
){
var
e
=
c
[
a
];
return
e
?(
this
.
c
&&
typeof
e
==
"
string
"
&&
(
e
=
this
.
c
.
compile
(
e
)),
e
.
ri
(
b
,
c
,
d
)):
""
},
rs
:
function
(
a
,
b
,
c
){
var
d
=
""
,
e
=
a
[
a
.
length
-
1
];
if
(
!
i
(
e
))
return
d
=
c
(
a
,
b
);
for
(
var
f
=
0
;
f
<
e
.
length
;
f
++
)
a
.
push
(
e
[
f
]),
d
+=
c
(
a
,
b
),
a
.
pop
();
return
d
},
s
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
var
h
;
return
i
(
a
)
&&
a
.
length
===
0
?
!
1
:(
typeof
a
==
"
function
"
&&
(
a
=
this
.
ls
(
a
,
b
,
c
,
d
,
e
,
f
,
g
)),
h
=
a
===
""
||!!
a
,
!
d
&&
h
&&
b
&&
b
.
push
(
typeof
a
==
"
object
"
?
a
:
b
[
b
.
length
-
1
]),
h
)},
d
:
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
split
(
"
.
"
),
f
=
this
.
f
(
e
[
0
],
b
,
c
,
d
),
g
=
null
;
if
(
a
===
"
.
"
&&
i
(
b
[
b
.
length
-
2
]))
return
b
[
b
.
length
-
1
];
for
(
var
h
=
1
;
h
<
e
.
length
;
h
++
)
f
&&
typeof
f
==
"
object
"
&&
e
[
h
]
in
f
?(
g
=
f
,
f
=
f
[
e
[
h
]]):
f
=
""
;
return
d
&&!
f
?
!
1
:(
!
d
&&
typeof
f
==
"
function
"
&&
(
b
.
push
(
g
),
f
=
this
.
lv
(
f
,
b
,
c
),
b
.
pop
()),
f
)},
f
:
function
(
a
,
b
,
c
,
d
){
var
e
=!
1
,
f
=
null
,
g
=!
1
;
for
(
var
h
=
b
.
length
-
1
;
h
>=
0
;
h
--
){
f
=
b
[
h
];
if
(
f
&&
typeof
f
==
"
object
"
&&
a
in
f
){
e
=
f
[
a
],
g
=!
0
;
break
}}
return
g
?(
!
d
&&
typeof
e
==
"
function
"
&&
(
e
=
this
.
lv
(
e
,
b
,
c
)),
e
):
d
?
!
1
:
""
},
ho
:
function
(
a
,
b
,
c
,
d
,
e
){
var
f
=
this
.
c
,
g
=
a
.
call
(
b
,
d
,
function
(
a
){
return
f
.
compile
(
a
,{
delimiters
:
e
}).
render
(
b
,
c
)}),
h
=
f
.
compile
(
g
.
toString
(),{
delimiters
:
e
}).
render
(
b
,
c
);
return
this
.
b
=
h
,
!
1
},
b
:
""
,
ls
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
var
h
=
b
[
b
.
length
-
1
],
i
=
null
;
if
(
!
d
&&
this
.
c
&&
a
.
length
>
0
)
return
this
.
ho
(
a
,
h
,
c
,
this
.
text
.
substring
(
e
,
f
),
g
);
i
=
a
.
call
(
h
);
if
(
typeof
i
==
"
function
"
){
if
(
d
)
return
!
0
;
if
(
this
.
c
)
return
this
.
ho
(
i
,
h
,
c
,
this
.
text
.
substring
(
e
,
f
),
g
)}
return
i
},
lv
:
function
(
a
,
b
,
c
){
var
d
=
b
[
b
.
length
-
1
],
e
=
a
.
call
(
d
);
return
typeof
e
==
"
function
"
&&
(
e
=
e
.
call
(
d
)),
e
=
e
.
toString
(),
this
.
c
&&~
e
.
indexOf
(
"
{{
"
)?
this
.
c
.
compile
(
e
).
render
(
d
,
c
):
e
}};
var
b
=
/&/g
,
c
=
/</g
,
d
=
/>/g
,
e
=
/
\'
/g
,
f
=
/
\"
/g
,
g
=
/
[
&<>
\"\']
/
,
i
=
Array
.
isArray
||
function
(
a
){
return
Object
.
prototype
.
toString
.
call
(
a
)
===
"
[object Array]
"
}})(
typeof
exports
!=
"
undefined
"
?
exports
:
Hogan
),
function
(
a
){
function
h
(
a
){
a
.
n
.
substr
(
a
.
n
.
length
-
1
)
===
"
}
"
&&
(
a
.
n
=
a
.
n
.
substring
(
0
,
a
.
n
.
length
-
1
))}
function
i
(
a
){
return
a
.
trim
?
a
.
trim
():
a
.
replace
(
/^
\s
*|
\s
*$/g
,
""
)}
function
j
(
a
,
b
,
c
){
if
(
b
.
charAt
(
c
)
!=
a
.
charAt
(
0
))
return
!
1
;
for
(
var
d
=
1
,
e
=
a
.
length
;
d
<
e
;
d
++
)
if
(
b
.
charAt
(
c
+
d
)
!=
a
.
charAt
(
d
))
return
!
1
;
return
!
0
}
function
k
(
a
,
b
,
c
,
d
){
var
e
=
[],
f
=
null
,
g
=
null
;
while
(
a
.
length
>
0
){
g
=
a
.
shift
();
if
(
g
.
tag
==
"
#
"
||
g
.
tag
==
"
^
"
||
l
(
g
,
d
))
c
.
push
(
g
),
g
.
nodes
=
k
(
a
,
g
.
tag
,
c
,
d
),
e
.
push
(
g
);
else
{
if
(
g
.
tag
==
"
/
"
){
if
(
c
.
length
===
0
)
throw
new
Error
(
"
Closing tag without opener: /
"
+
g
.
n
);
f
=
c
.
pop
();
if
(
g
.
n
!=
f
.
n
&&!
m
(
g
.
n
,
f
.
n
,
d
))
throw
new
Error
(
"
Nesting error:
"
+
f
.
n
+
"
vs.
"
+
g
.
n
);
return
f
.
end
=
g
.
i
,
e
}
e
.
push
(
g
)}}
if
(
c
.
length
>
0
)
throw
new
Error
(
"
missing closing tag:
"
+
c
.
pop
().
n
);
return
e
}
function
l
(
a
,
b
){
for
(
var
c
=
0
,
d
=
b
.
length
;
c
<
d
;
c
++
)
if
(
b
[
c
].
o
==
a
.
n
)
return
a
.
tag
=
"
#
"
,
!
0
}
function
m
(
a
,
b
,
c
){
for
(
var
d
=
0
,
e
=
c
.
length
;
d
<
e
;
d
++
)
if
(
c
[
d
].
c
==
a
&&
c
[
d
].
o
==
b
)
return
!
0
}
function
n
(
a
){
return
'
i = i || "";var b = i + "";var _ = this;
'
+
q
(
a
)
+
"
return b;
"
}
function
o
(
a
){
return
a
.
replace
(
f
,
"
\\\\
"
).
replace
(
c
,
'
\\
"
'
).
replace
(
d
,
"
\\
n
"
).
replace
(
e
,
"
\\
r
"
)}
function
p
(
a
){
return
~
a
.
indexOf
(
"
.
"
)?
"
d
"
:
"
f
"
}
function
q
(
a
){
var
b
=
""
;
for
(
var
c
=
0
,
d
=
a
.
length
;
c
<
d
;
c
++
){
var
e
=
a
[
c
].
tag
;
e
==
"
#
"
?
b
+=
r
(
a
[
c
].
nodes
,
a
[
c
].
n
,
p
(
a
[
c
].
n
),
a
[
c
].
i
,
a
[
c
].
end
,
a
[
c
].
otag
+
"
"
+
a
[
c
].
ctag
):
e
==
"
^
"
?
b
+=
s
(
a
[
c
].
nodes
,
a
[
c
].
n
,
p
(
a
[
c
].
n
)):
e
==
"
<
"
||
e
==
"
>
"
?
b
+=
t
(
a
[
c
]):
e
==
"
{
"
||
e
==
"
&
"
?
b
+=
u
(
a
[
c
].
n
,
p
(
a
[
c
].
n
)):
e
==
"
\n
"
?
b
+=
w
(
'
"
\\
n"
'
+
(
a
.
length
-
1
==
c
?
""
:
"
+ i
"
)):
e
==
"
_v
"
?
b
+=
v
(
a
[
c
].
n
,
p
(
a
[
c
].
n
)):
e
===
undefined
&&
(
b
+=
w
(
'
"
'
+
o
(
a
[
c
])
+
'
"
'
))}
return
b
}
function
r
(
a
,
b
,
c
,
d
,
e
,
f
){
return
"
if(_.s(_.
"
+
c
+
'
("
'
+
o
(
b
)
+
'
",c,p,1),
'
+
"
c,p,0,
"
+
d
+
"
,
"
+
e
+
'
, "
'
+
f
+
'
")){
'
+
"
b += _.rs(c,p,
"
+
'
function(c,p){ var b = "";
'
+
q
(
a
)
+
"
return b;});c.pop();}
"
+
'
else{b += _.b; _.b = ""};
'
}
function
s
(
a
,
b
,
c
){
return
"
if (!_.s(_.
"
+
c
+
'
("
'
+
o
(
b
)
+
'
",c,p,1),c,p,1,0,0,"")){
'
+
q
(
a
)
+
"
};
"
}
function
t
(
a
){
return
'
b += _.rp("
'
+
o
(
a
.
n
)
+
'
",c,p,"
'
+
(
a
.
indent
||
""
)
+
'
");
'
}
function
u
(
a
,
b
){
return
"
b += (_.
"
+
b
+
'
("
'
+
o
(
a
)
+
'
",c,p,0));
'
}
function
v
(
a
,
b
){
return
"
b += (_.v(_.
"
+
b
+
'
("
'
+
o
(
a
)
+
'
",c,p,0)));
'
}
function
w
(
a
){
return
"
b +=
"
+
a
+
"
;
"
}
var
b
=
/
\S
/
,
c
=
/
\"
/g
,
d
=
/
\n
/g
,
e
=
/
\r
/g
,
f
=
/
\\
/g
,
g
=
{
"
#
"
:
1
,
"
^
"
:
2
,
"
/
"
:
3
,
"
!
"
:
4
,
"
>
"
:
5
,
"
<
"
:
6
,
"
=
"
:
7
,
_v
:
8
,
"
{
"
:
9
,
"
&
"
:
10
};
a
.
scan
=
function
(
c
,
d
){
function
w
(){
p
.
length
>
0
&&
(
q
.
push
(
new
String
(
p
)),
p
=
""
)}
function
x
(){
var
a
=!
0
;
for
(
var
c
=
t
;
c
<
q
.
length
;
c
++
){
a
=
q
[
c
].
tag
&&
g
[
q
[
c
].
tag
]
<
g
.
_v
||!
q
[
c
].
tag
&&
q
[
c
].
match
(
b
)
===
null
;
if
(
!
a
)
return
!
1
}
return
a
}
function
y
(
a
,
b
){
w
();
if
(
a
&&
x
())
for
(
var
c
=
t
,
d
;
c
<
q
.
length
;
c
++
)
q
[
c
].
tag
||
((
d
=
q
[
c
+
1
])
&&
d
.
tag
==
"
>
"
&&
(
d
.
indent
=
q
[
c
].
toString
()),
q
.
splice
(
c
,
1
));
else
b
||
q
.
push
({
tag
:
"
\n
"
});
r
=!
1
,
t
=
q
.
length
}
function
z
(
a
,
b
){
var
c
=
"
=
"
+
v
,
d
=
a
.
indexOf
(
c
,
b
),
e
=
i
(
a
.
substring
(
a
.
indexOf
(
"
=
"
,
b
)
+
1
,
d
)).
split
(
"
"
);
return
u
=
e
[
0
],
v
=
e
[
1
],
d
+
c
.
length
-
1
}
var
e
=
c
.
length
,
f
=
0
,
k
=
1
,
l
=
2
,
m
=
f
,
n
=
null
,
o
=
null
,
p
=
""
,
q
=
[],
r
=!
1
,
s
=
0
,
t
=
0
,
u
=
"
{{
"
,
v
=
"
}}
"
;
d
&&
(
d
=
d
.
split
(
"
"
),
u
=
d
[
0
],
v
=
d
[
1
]);
for
(
s
=
0
;
s
<
e
;
s
++
)
m
==
f
?
j
(
u
,
c
,
s
)?(
--
s
,
w
(),
m
=
k
):
c
.
charAt
(
s
)
==
"
\n
"
?
y
(
r
):
p
+=
c
.
charAt
(
s
):
m
==
k
?(
s
+=
u
.
length
-
1
,
o
=
g
[
c
.
charAt
(
s
+
1
)],
n
=
o
?
c
.
charAt
(
s
+
1
):
"
_v
"
,
n
==
"
=
"
?(
s
=
z
(
c
,
s
),
m
=
f
):(
o
&&
s
++
,
m
=
l
),
r
=
s
):
j
(
v
,
c
,
s
)?(
q
.
push
({
tag
:
n
,
n
:
i
(
p
),
otag
:
u
,
ctag
:
v
,
i
:
n
==
"
/
"
?
r
-
v
.
length
:
s
+
u
.
length
}),
p
=
""
,
s
+=
v
.
length
-
1
,
m
=
f
,
n
==
"
{
"
&&
(
v
==
"
}}
"
?
s
++
:
h
(
q
[
q
.
length
-
1
]))):
p
+=
c
.
charAt
(
s
);
return
y
(
r
,
!
0
),
q
},
a
.
generate
=
function
(
b
,
c
,
d
){
return
d
.
asString
?
"
function(c,p,i){
"
+
b
+
"
;}
"
:
new
a
.
Template
(
new
Function
(
"
c
"
,
"
p
"
,
"
i
"
,
b
),
c
,
a
)},
a
.
parse
=
function
(
a
,
b
){
return
b
=
b
||
{},
k
(
a
,
""
,[],
b
.
sectionTags
||
[])},
a
.
cache
=
{},
a
.
compile
=
function
(
a
,
b
){
b
=
b
||
{};
var
c
=
a
+
"
||
"
+!!
b
.
asString
,
d
=
this
.
cache
[
c
];
return
d
?
d
:(
d
=
this
.
generate
(
n
(
this
.
parse
(
this
.
scan
(
a
,
b
.
delimiters
),
b
)),
a
,
b
),
this
.
cache
[
c
]
=
d
)}}(
typeof
exports
!=
"
undefined
"
?
exports
:
Hogan
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.min.mustache.js
0 → 100644
+
5
-
0
View file @
f764aee4
/**
* @preserve Copyright 2012 Twitter, Inc.
* @license http://www.apache.org/licenses/LICENSE-2.0.txt
*/
var
Hogan
=
{};(
function
(
a
){
function
h
(
a
){
return
a
=
String
(
a
===
null
||
a
===
undefined
?
""
:
a
),
g
.
test
(
a
)?
a
.
replace
(
b
,
"
&
"
).
replace
(
c
,
"
<
"
).
replace
(
d
,
"
>
"
).
replace
(
e
,
"
'
"
).
replace
(
f
,
"
"
"
):
a
}
a
.
Template
=
function
j
(
a
,
b
,
c
){
a
&&
(
this
.
r
=
a
),
this
.
c
=
c
,
this
.
text
=
b
||
""
},
a
.
Template
.
prototype
=
{
r
:
function
(
a
,
b
,
c
){
return
""
},
v
:
h
,
render
:
function
(
b
,
c
,
d
){
return
this
.
ri
([
b
],
c
||
{},
d
)},
ri
:
function
(
a
,
b
,
c
){
return
this
.
r
(
a
,
b
,
c
)},
rp
:
function
(
a
,
b
,
c
,
d
){
var
e
=
c
[
a
];
return
e
?(
this
.
c
&&
typeof
e
==
"
string
"
&&
(
e
=
this
.
c
.
compile
(
e
)),
e
.
ri
(
b
,
c
,
d
)):
""
},
rs
:
function
(
a
,
b
,
c
){
var
d
=
""
,
e
=
a
[
a
.
length
-
1
];
if
(
!
i
(
e
))
return
d
=
c
(
a
,
b
);
for
(
var
f
=
0
;
f
<
e
.
length
;
f
++
)
a
.
push
(
e
[
f
]),
d
+=
c
(
a
,
b
),
a
.
pop
();
return
d
},
s
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
var
h
;
return
i
(
a
)
&&
a
.
length
===
0
?
!
1
:(
typeof
a
==
"
function
"
&&
(
a
=
this
.
ls
(
a
,
b
,
c
,
d
,
e
,
f
,
g
)),
h
=
a
===
""
||!!
a
,
!
d
&&
h
&&
b
&&
b
.
push
(
typeof
a
==
"
object
"
?
a
:
b
[
b
.
length
-
1
]),
h
)},
d
:
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
split
(
"
.
"
),
f
=
this
.
f
(
e
[
0
],
b
,
c
,
d
),
g
=
null
;
if
(
a
===
"
.
"
&&
i
(
b
[
b
.
length
-
2
]))
return
b
[
b
.
length
-
1
];
for
(
var
h
=
1
;
h
<
e
.
length
;
h
++
)
f
&&
typeof
f
==
"
object
"
&&
e
[
h
]
in
f
?(
g
=
f
,
f
=
f
[
e
[
h
]]):
f
=
""
;
return
d
&&!
f
?
!
1
:(
!
d
&&
typeof
f
==
"
function
"
&&
(
b
.
push
(
g
),
f
=
this
.
lv
(
f
,
b
,
c
),
b
.
pop
()),
f
)},
f
:
function
(
a
,
b
,
c
,
d
){
var
e
=!
1
,
f
=
null
,
g
=!
1
;
for
(
var
h
=
b
.
length
-
1
;
h
>=
0
;
h
--
){
f
=
b
[
h
];
if
(
f
&&
typeof
f
==
"
object
"
&&
a
in
f
){
e
=
f
[
a
],
g
=!
0
;
break
}}
return
g
?(
!
d
&&
typeof
e
==
"
function
"
&&
(
e
=
this
.
lv
(
e
,
b
,
c
)),
e
):
d
?
!
1
:
""
},
ho
:
function
(
a
,
b
,
c
,
d
,
e
){
var
f
=
this
.
c
,
g
=
a
.
call
(
b
,
d
,
function
(
a
){
return
f
.
compile
(
a
,{
delimiters
:
e
}).
render
(
b
,
c
)}),
h
=
f
.
compile
(
g
.
toString
(),{
delimiters
:
e
}).
render
(
b
,
c
);
return
this
.
b
=
h
,
!
1
},
b
:
""
,
ls
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
var
h
=
b
[
b
.
length
-
1
],
i
=
null
;
if
(
!
d
&&
this
.
c
&&
a
.
length
>
0
)
return
this
.
ho
(
a
,
h
,
c
,
this
.
text
.
substring
(
e
,
f
),
g
);
i
=
a
.
call
(
h
);
if
(
typeof
i
==
"
function
"
){
if
(
d
)
return
!
0
;
if
(
this
.
c
)
return
this
.
ho
(
i
,
h
,
c
,
this
.
text
.
substring
(
e
,
f
),
g
)}
return
i
},
lv
:
function
(
a
,
b
,
c
){
var
d
=
b
[
b
.
length
-
1
],
e
=
a
.
call
(
d
);
return
typeof
e
==
"
function
"
&&
(
e
=
e
.
call
(
d
)),
e
=
e
.
toString
(),
this
.
c
&&~
e
.
indexOf
(
"
{{
"
)?
this
.
c
.
compile
(
e
).
render
(
d
,
c
):
e
}};
var
b
=
/&/g
,
c
=
/</g
,
d
=
/>/g
,
e
=
/
\'
/g
,
f
=
/
\"
/g
,
g
=
/
[
&<>
\"\']
/
,
i
=
Array
.
isArray
||
function
(
a
){
return
Object
.
prototype
.
toString
.
call
(
a
)
===
"
[object Array]
"
}})(
typeof
exports
!=
"
undefined
"
?
exports
:
Hogan
),
function
(
a
){
function
h
(
a
){
a
.
n
.
substr
(
a
.
n
.
length
-
1
)
===
"
}
"
&&
(
a
.
n
=
a
.
n
.
substring
(
0
,
a
.
n
.
length
-
1
))}
function
i
(
a
){
return
a
.
trim
?
a
.
trim
():
a
.
replace
(
/^
\s
*|
\s
*$/g
,
""
)}
function
j
(
a
,
b
,
c
){
if
(
b
.
charAt
(
c
)
!=
a
.
charAt
(
0
))
return
!
1
;
for
(
var
d
=
1
,
e
=
a
.
length
;
d
<
e
;
d
++
)
if
(
b
.
charAt
(
c
+
d
)
!=
a
.
charAt
(
d
))
return
!
1
;
return
!
0
}
function
k
(
a
,
b
,
c
,
d
){
var
e
=
[],
f
=
null
,
g
=
null
;
while
(
a
.
length
>
0
){
g
=
a
.
shift
();
if
(
g
.
tag
==
"
#
"
||
g
.
tag
==
"
^
"
||
l
(
g
,
d
))
c
.
push
(
g
),
g
.
nodes
=
k
(
a
,
g
.
tag
,
c
,
d
),
e
.
push
(
g
);
else
{
if
(
g
.
tag
==
"
/
"
){
if
(
c
.
length
===
0
)
throw
new
Error
(
"
Closing tag without opener: /
"
+
g
.
n
);
f
=
c
.
pop
();
if
(
g
.
n
!=
f
.
n
&&!
m
(
g
.
n
,
f
.
n
,
d
))
throw
new
Error
(
"
Nesting error:
"
+
f
.
n
+
"
vs.
"
+
g
.
n
);
return
f
.
end
=
g
.
i
,
e
}
e
.
push
(
g
)}}
if
(
c
.
length
>
0
)
throw
new
Error
(
"
missing closing tag:
"
+
c
.
pop
().
n
);
return
e
}
function
l
(
a
,
b
){
for
(
var
c
=
0
,
d
=
b
.
length
;
c
<
d
;
c
++
)
if
(
b
[
c
].
o
==
a
.
n
)
return
a
.
tag
=
"
#
"
,
!
0
}
function
m
(
a
,
b
,
c
){
for
(
var
d
=
0
,
e
=
c
.
length
;
d
<
e
;
d
++
)
if
(
c
[
d
].
c
==
a
&&
c
[
d
].
o
==
b
)
return
!
0
}
function
n
(
a
){
return
'
i = i || "";var b = i + "";var _ = this;
'
+
q
(
a
)
+
"
return b;
"
}
function
o
(
a
){
return
a
.
replace
(
f
,
"
\\\\
"
).
replace
(
c
,
'
\\
"
'
).
replace
(
d
,
"
\\
n
"
).
replace
(
e
,
"
\\
r
"
)}
function
p
(
a
){
return
~
a
.
indexOf
(
"
.
"
)?
"
d
"
:
"
f
"
}
function
q
(
a
){
var
b
=
""
;
for
(
var
c
=
0
,
d
=
a
.
length
;
c
<
d
;
c
++
){
var
e
=
a
[
c
].
tag
;
e
==
"
#
"
?
b
+=
r
(
a
[
c
].
nodes
,
a
[
c
].
n
,
p
(
a
[
c
].
n
),
a
[
c
].
i
,
a
[
c
].
end
,
a
[
c
].
otag
+
"
"
+
a
[
c
].
ctag
):
e
==
"
^
"
?
b
+=
s
(
a
[
c
].
nodes
,
a
[
c
].
n
,
p
(
a
[
c
].
n
)):
e
==
"
<
"
||
e
==
"
>
"
?
b
+=
t
(
a
[
c
]):
e
==
"
{
"
||
e
==
"
&
"
?
b
+=
u
(
a
[
c
].
n
,
p
(
a
[
c
].
n
)):
e
==
"
\n
"
?
b
+=
w
(
'
"
\\
n"
'
+
(
a
.
length
-
1
==
c
?
""
:
"
+ i
"
)):
e
==
"
_v
"
?
b
+=
v
(
a
[
c
].
n
,
p
(
a
[
c
].
n
)):
e
===
undefined
&&
(
b
+=
w
(
'
"
'
+
o
(
a
[
c
])
+
'
"
'
))}
return
b
}
function
r
(
a
,
b
,
c
,
d
,
e
,
f
){
return
"
if(_.s(_.
"
+
c
+
'
("
'
+
o
(
b
)
+
'
",c,p,1),
'
+
"
c,p,0,
"
+
d
+
"
,
"
+
e
+
'
, "
'
+
f
+
'
")){
'
+
"
b += _.rs(c,p,
"
+
'
function(c,p){ var b = "";
'
+
q
(
a
)
+
"
return b;});c.pop();}
"
+
'
else{b += _.b; _.b = ""};
'
}
function
s
(
a
,
b
,
c
){
return
"
if (!_.s(_.
"
+
c
+
'
("
'
+
o
(
b
)
+
'
",c,p,1),c,p,1,0,0,"")){
'
+
q
(
a
)
+
"
};
"
}
function
t
(
a
){
return
'
b += _.rp("
'
+
o
(
a
.
n
)
+
'
",c,p,"
'
+
(
a
.
indent
||
""
)
+
'
");
'
}
function
u
(
a
,
b
){
return
"
b += (_.
"
+
b
+
'
("
'
+
o
(
a
)
+
'
",c,p,0));
'
}
function
v
(
a
,
b
){
return
"
b += (_.v(_.
"
+
b
+
'
("
'
+
o
(
a
)
+
'
",c,p,0)));
'
}
function
w
(
a
){
return
"
b +=
"
+
a
+
"
;
"
}
var
b
=
/
\S
/
,
c
=
/
\"
/g
,
d
=
/
\n
/g
,
e
=
/
\r
/g
,
f
=
/
\\
/g
,
g
=
{
"
#
"
:
1
,
"
^
"
:
2
,
"
/
"
:
3
,
"
!
"
:
4
,
"
>
"
:
5
,
"
<
"
:
6
,
"
=
"
:
7
,
_v
:
8
,
"
{
"
:
9
,
"
&
"
:
10
};
a
.
scan
=
function
(
c
,
d
){
function
w
(){
p
.
length
>
0
&&
(
q
.
push
(
new
String
(
p
)),
p
=
""
)}
function
x
(){
var
a
=!
0
;
for
(
var
c
=
t
;
c
<
q
.
length
;
c
++
){
a
=
q
[
c
].
tag
&&
g
[
q
[
c
].
tag
]
<
g
.
_v
||!
q
[
c
].
tag
&&
q
[
c
].
match
(
b
)
===
null
;
if
(
!
a
)
return
!
1
}
return
a
}
function
y
(
a
,
b
){
w
();
if
(
a
&&
x
())
for
(
var
c
=
t
,
d
;
c
<
q
.
length
;
c
++
)
q
[
c
].
tag
||
((
d
=
q
[
c
+
1
])
&&
d
.
tag
==
"
>
"
&&
(
d
.
indent
=
q
[
c
].
toString
()),
q
.
splice
(
c
,
1
));
else
b
||
q
.
push
({
tag
:
"
\n
"
});
r
=!
1
,
t
=
q
.
length
}
function
z
(
a
,
b
){
var
c
=
"
=
"
+
v
,
d
=
a
.
indexOf
(
c
,
b
),
e
=
i
(
a
.
substring
(
a
.
indexOf
(
"
=
"
,
b
)
+
1
,
d
)).
split
(
"
"
);
return
u
=
e
[
0
],
v
=
e
[
1
],
d
+
c
.
length
-
1
}
var
e
=
c
.
length
,
f
=
0
,
k
=
1
,
l
=
2
,
m
=
f
,
n
=
null
,
o
=
null
,
p
=
""
,
q
=
[],
r
=!
1
,
s
=
0
,
t
=
0
,
u
=
"
{{
"
,
v
=
"
}}
"
;
d
&&
(
d
=
d
.
split
(
"
"
),
u
=
d
[
0
],
v
=
d
[
1
]);
for
(
s
=
0
;
s
<
e
;
s
++
)
m
==
f
?
j
(
u
,
c
,
s
)?(
--
s
,
w
(),
m
=
k
):
c
.
charAt
(
s
)
==
"
\n
"
?
y
(
r
):
p
+=
c
.
charAt
(
s
):
m
==
k
?(
s
+=
u
.
length
-
1
,
o
=
g
[
c
.
charAt
(
s
+
1
)],
n
=
o
?
c
.
charAt
(
s
+
1
):
"
_v
"
,
n
==
"
=
"
?(
s
=
z
(
c
,
s
),
m
=
f
):(
o
&&
s
++
,
m
=
l
),
r
=
s
):
j
(
v
,
c
,
s
)?(
q
.
push
({
tag
:
n
,
n
:
i
(
p
),
otag
:
u
,
ctag
:
v
,
i
:
n
==
"
/
"
?
r
-
v
.
length
:
s
+
u
.
length
}),
p
=
""
,
s
+=
v
.
length
-
1
,
m
=
f
,
n
==
"
{
"
&&
(
v
==
"
}}
"
?
s
++
:
h
(
q
[
q
.
length
-
1
]))):
p
+=
c
.
charAt
(
s
);
return
y
(
r
,
!
0
),
q
},
a
.
generate
=
function
(
b
,
c
,
d
){
return
d
.
asString
?
"
function(c,p,i){
"
+
b
+
"
;}
"
:
new
a
.
Template
(
new
Function
(
"
c
"
,
"
p
"
,
"
i
"
,
b
),
c
,
a
)},
a
.
parse
=
function
(
a
,
b
){
return
b
=
b
||
{},
k
(
a
,
""
,[],
b
.
sectionTags
||
[])},
a
.
cache
=
{},
a
.
compile
=
function
(
a
,
b
){
b
=
b
||
{};
var
c
=
a
+
"
||
"
+!!
b
.
asString
,
d
=
this
.
cache
[
c
];
return
d
?
d
:(
d
=
this
.
generate
(
n
(
this
.
parse
(
this
.
scan
(
a
,
b
.
delimiters
),
b
)),
a
,
b
),
this
.
cache
[
c
]
=
d
)}}(
typeof
exports
!=
"
undefined
"
?
exports
:
Hogan
);
var
Mustache
=
function
(
a
){
function
b
(
b
,
c
,
d
,
e
){
var
f
=
this
.
f
(
b
,
c
,
d
,
0
),
g
=
c
;
return
f
&&
(
g
=
g
.
concat
(
f
)),
a
.
Template
.
prototype
.
rp
.
call
(
this
,
b
,
g
,
d
,
e
)}
var
c
=
function
(
c
,
d
,
e
){
this
.
rp
=
b
,
a
.
Template
.
call
(
this
,
c
,
d
,
e
)};
c
.
prototype
=
a
.
Template
.
prototype
;
var
d
,
e
=
function
(){
this
.
cache
=
{},
this
.
generate
=
function
(
a
,
b
,
e
){
return
new
c
(
new
Function
(
"
c
"
,
"
p
"
,
"
i
"
,
a
),
b
,
d
)}};
return
e
.
prototype
=
a
,
d
=
new
e
,{
to_html
:
function
(
a
,
b
,
c
,
e
){
var
f
=
d
.
compile
(
a
),
g
=
f
.
render
(
b
,
c
);
if
(
!
e
)
return
g
;
e
(
g
)}}}(
Hogan
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/builds/1.0.5/hogan-1.0.5.mustache.js
0 → 100644
+
619
-
0
View file @
f764aee4
/*
* Copyright 2011 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// A wrapper for compatibility with Mustache.js, quirks and all
var
Hogan
=
{};
(
function
(
Hogan
)
{
Hogan
.
Template
=
function
constructor
(
renderFunc
,
text
,
compiler
)
{
if
(
renderFunc
)
{
this
.
r
=
renderFunc
;
}
this
.
c
=
compiler
;
this
.
text
=
text
||
''
;
}
Hogan
.
Template
.
prototype
=
{
// render: replaced by generated code.
r
:
function
(
context
,
partials
,
indent
)
{
return
''
;
},
// variable escaping
v
:
hoganEscape
,
render
:
function
render
(
context
,
partials
,
indent
)
{
return
this
.
ri
([
context
],
partials
||
{},
indent
);
},
// render internal -- a hook for overrides that catches partials too
ri
:
function
(
context
,
partials
,
indent
)
{
return
this
.
r
(
context
,
partials
,
indent
);
},
// tries to find a partial in the curent scope and render it
rp
:
function
(
name
,
context
,
partials
,
indent
)
{
var
partial
=
partials
[
name
];
if
(
!
partial
)
{
return
''
;
}
if
(
this
.
c
&&
typeof
partial
==
'
string
'
)
{
partial
=
this
.
c
.
compile
(
partial
);
}
return
partial
.
ri
(
context
,
partials
,
indent
);
},
// render a section
rs
:
function
(
context
,
partials
,
section
)
{
var
buf
=
''
,
tail
=
context
[
context
.
length
-
1
];
if
(
!
isArray
(
tail
))
{
return
buf
=
section
(
context
,
partials
);
}
for
(
var
i
=
0
;
i
<
tail
.
length
;
i
++
)
{
context
.
push
(
tail
[
i
]);
buf
+=
section
(
context
,
partials
);
context
.
pop
();
}
return
buf
;
},
// maybe start a section
s
:
function
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
)
{
var
pass
;
if
(
isArray
(
val
)
&&
val
.
length
===
0
)
{
return
false
;
}
if
(
typeof
val
==
'
function
'
)
{
val
=
this
.
ls
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
);
}
pass
=
(
val
===
''
)
||
!!
val
;
if
(
!
inverted
&&
pass
&&
ctx
)
{
ctx
.
push
((
typeof
val
==
'
object
'
)
?
val
:
ctx
[
ctx
.
length
-
1
]);
}
return
pass
;
},
// find values with dotted names
d
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
var
names
=
key
.
split
(
'
.
'
),
val
=
this
.
f
(
names
[
0
],
ctx
,
partials
,
returnFound
),
cx
=
null
;
if
(
key
===
'
.
'
&&
isArray
(
ctx
[
ctx
.
length
-
2
]))
{
return
ctx
[
ctx
.
length
-
1
];
}
for
(
var
i
=
1
;
i
<
names
.
length
;
i
++
)
{
if
(
val
&&
typeof
val
==
'
object
'
&&
names
[
i
]
in
val
)
{
cx
=
val
;
val
=
val
[
names
[
i
]];
}
else
{
val
=
''
;
}
}
if
(
returnFound
&&
!
val
)
{
return
false
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
ctx
.
push
(
cx
);
val
=
this
.
lv
(
val
,
ctx
,
partials
);
ctx
.
pop
();
}
return
val
;
},
// find values with normal names
f
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
var
val
=
false
,
v
=
null
,
found
=
false
;
for
(
var
i
=
ctx
.
length
-
1
;
i
>=
0
;
i
--
)
{
v
=
ctx
[
i
];
if
(
v
&&
typeof
v
==
'
object
'
&&
key
in
v
)
{
val
=
v
[
key
];
found
=
true
;
break
;
}
}
if
(
!
found
)
{
return
(
returnFound
)
?
false
:
""
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
val
=
this
.
lv
(
val
,
ctx
,
partials
);
}
return
val
;
},
// higher order templates
ho
:
function
(
val
,
cx
,
partials
,
text
,
tags
)
{
var
compiler
=
this
.
c
;
var
t
=
val
.
call
(
cx
,
text
,
function
(
t
)
{
return
compiler
.
compile
(
t
,
{
delimiters
:
tags
}).
render
(
cx
,
partials
);
});
var
s
=
compiler
.
compile
(
t
.
toString
(),
{
delimiters
:
tags
}).
render
(
cx
,
partials
);
this
.
b
=
s
;
return
false
;
},
// higher order template result buffer
b
:
''
,
// lambda replace section
ls
:
function
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
],
t
=
null
;
if
(
!
inverted
&&
this
.
c
&&
val
.
length
>
0
)
{
return
this
.
ho
(
val
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
),
tags
);
}
t
=
val
.
call
(
cx
);
if
(
typeof
t
==
'
function
'
)
{
if
(
inverted
)
{
return
true
;
}
else
if
(
this
.
c
)
{
return
this
.
ho
(
t
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
),
tags
);
}
}
return
t
;
},
// lambda replace variable
lv
:
function
(
val
,
ctx
,
partials
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
];
var
result
=
val
.
call
(
cx
);
if
(
typeof
result
==
'
function
'
)
{
result
=
result
.
call
(
cx
);
}
result
=
result
.
toString
();
if
(
this
.
c
&&
~
result
.
indexOf
(
"
{{
"
))
{
return
this
.
c
.
compile
(
result
).
render
(
cx
,
partials
);
}
return
result
;
}
};
var
rAmp
=
/&/g
,
rLt
=
/</g
,
rGt
=
/>/g
,
rApos
=
/
\'
/g
,
rQuot
=
/
\"
/g
,
hChars
=
/
[
&<>
\"\']
/
;
function
hoganEscape
(
str
)
{
str
=
String
((
str
===
null
||
str
===
undefined
)
?
''
:
str
);
return
hChars
.
test
(
str
)
?
str
.
replace
(
rAmp
,
'
&
'
)
.
replace
(
rLt
,
'
<
'
)
.
replace
(
rGt
,
'
>
'
)
.
replace
(
rApos
,
'
'
'
)
.
replace
(
rQuot
,
'
"
'
)
:
str
;
}
var
isArray
=
Array
.
isArray
||
function
(
a
)
{
return
Object
.
prototype
.
toString
.
call
(
a
)
===
'
[object Array]
'
;
};
})(
typeof
exports
!==
'
undefined
'
?
exports
:
Hogan
);
(
function
(
Hogan
)
{
// Setup regex assignments
// remove whitespace according to Mustache spec
var
rIsWhitespace
=
/
\S
/
,
rQuot
=
/
\"
/g
,
rNewline
=
/
\n
/g
,
rCr
=
/
\r
/g
,
rSlash
=
/
\\
/g
,
tagTypes
=
{
'
#
'
:
1
,
'
^
'
:
2
,
'
/
'
:
3
,
'
!
'
:
4
,
'
>
'
:
5
,
'
<
'
:
6
,
'
=
'
:
7
,
'
_v
'
:
8
,
'
{
'
:
9
,
'
&
'
:
10
};
Hogan
.
scan
=
function
scan
(
text
,
delimiters
)
{
var
len
=
text
.
length
,
IN_TEXT
=
0
,
IN_TAG_TYPE
=
1
,
IN_TAG
=
2
,
state
=
IN_TEXT
,
tagType
=
null
,
tag
=
null
,
buf
=
''
,
tokens
=
[],
seenTag
=
false
,
i
=
0
,
lineStart
=
0
,
otag
=
'
{{
'
,
ctag
=
'
}}
'
;
function
addBuf
()
{
if
(
buf
.
length
>
0
)
{
tokens
.
push
(
new
String
(
buf
));
buf
=
''
;
}
}
function
lineIsWhitespace
()
{
var
isAllWhitespace
=
true
;
for
(
var
j
=
lineStart
;
j
<
tokens
.
length
;
j
++
)
{
isAllWhitespace
=
(
tokens
[
j
].
tag
&&
tagTypes
[
tokens
[
j
].
tag
]
<
tagTypes
[
'
_v
'
])
||
(
!
tokens
[
j
].
tag
&&
tokens
[
j
].
match
(
rIsWhitespace
)
===
null
);
if
(
!
isAllWhitespace
)
{
return
false
;
}
}
return
isAllWhitespace
;
}
function
filterLine
(
haveSeenTag
,
noNewLine
)
{
addBuf
();
if
(
haveSeenTag
&&
lineIsWhitespace
())
{
for
(
var
j
=
lineStart
,
next
;
j
<
tokens
.
length
;
j
++
)
{
if
(
!
tokens
[
j
].
tag
)
{
if
((
next
=
tokens
[
j
+
1
])
&&
next
.
tag
==
'
>
'
)
{
// set indent to token value
next
.
indent
=
tokens
[
j
].
toString
()
}
tokens
.
splice
(
j
,
1
);
}
}
}
else
if
(
!
noNewLine
)
{
tokens
.
push
({
tag
:
'
\n
'
});
}
seenTag
=
false
;
lineStart
=
tokens
.
length
;
}
function
changeDelimiters
(
text
,
index
)
{
var
close
=
'
=
'
+
ctag
,
closeIndex
=
text
.
indexOf
(
close
,
index
),
delimiters
=
trim
(
text
.
substring
(
text
.
indexOf
(
'
=
'
,
index
)
+
1
,
closeIndex
)
).
split
(
'
'
);
otag
=
delimiters
[
0
];
ctag
=
delimiters
[
1
];
return
closeIndex
+
close
.
length
-
1
;
}
if
(
delimiters
)
{
delimiters
=
delimiters
.
split
(
'
'
);
otag
=
delimiters
[
0
];
ctag
=
delimiters
[
1
];
}
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
state
==
IN_TEXT
)
{
if
(
tagChange
(
otag
,
text
,
i
))
{
--
i
;
addBuf
();
state
=
IN_TAG_TYPE
;
}
else
{
if
(
text
.
charAt
(
i
)
==
'
\n
'
)
{
filterLine
(
seenTag
);
}
else
{
buf
+=
text
.
charAt
(
i
);
}
}
}
else
if
(
state
==
IN_TAG_TYPE
)
{
i
+=
otag
.
length
-
1
;
tag
=
tagTypes
[
text
.
charAt
(
i
+
1
)];
tagType
=
tag
?
text
.
charAt
(
i
+
1
)
:
'
_v
'
;
if
(
tagType
==
'
=
'
)
{
i
=
changeDelimiters
(
text
,
i
);
state
=
IN_TEXT
;
}
else
{
if
(
tag
)
{
i
++
;
}
state
=
IN_TAG
;
}
seenTag
=
i
;
}
else
{
if
(
tagChange
(
ctag
,
text
,
i
))
{
tokens
.
push
({
tag
:
tagType
,
n
:
trim
(
buf
),
otag
:
otag
,
ctag
:
ctag
,
i
:
(
tagType
==
'
/
'
)
?
seenTag
-
ctag
.
length
:
i
+
otag
.
length
});
buf
=
''
;
i
+=
ctag
.
length
-
1
;
state
=
IN_TEXT
;
if
(
tagType
==
'
{
'
)
{
if
(
ctag
==
'
}}
'
)
{
i
++
;
}
else
{
cleanTripleStache
(
tokens
[
tokens
.
length
-
1
]);
}
}
}
else
{
buf
+=
text
.
charAt
(
i
);
}
}
}
filterLine
(
seenTag
,
true
);
return
tokens
;
}
function
cleanTripleStache
(
token
)
{
if
(
token
.
n
.
substr
(
token
.
n
.
length
-
1
)
===
'
}
'
)
{
token
.
n
=
token
.
n
.
substring
(
0
,
token
.
n
.
length
-
1
);
}
}
function
trim
(
s
)
{
if
(
s
.
trim
)
{
return
s
.
trim
();
}
return
s
.
replace
(
/^
\s
*|
\s
*$/g
,
''
);
}
function
tagChange
(
tag
,
text
,
index
)
{
if
(
text
.
charAt
(
index
)
!=
tag
.
charAt
(
0
))
{
return
false
;
}
for
(
var
i
=
1
,
l
=
tag
.
length
;
i
<
l
;
i
++
)
{
if
(
text
.
charAt
(
index
+
i
)
!=
tag
.
charAt
(
i
))
{
return
false
;
}
}
return
true
;
}
function
buildTree
(
tokens
,
kind
,
stack
,
customTags
)
{
var
instructions
=
[],
opener
=
null
,
token
=
null
;
while
(
tokens
.
length
>
0
)
{
token
=
tokens
.
shift
();
if
(
token
.
tag
==
'
#
'
||
token
.
tag
==
'
^
'
||
isOpener
(
token
,
customTags
))
{
stack
.
push
(
token
);
token
.
nodes
=
buildTree
(
tokens
,
token
.
tag
,
stack
,
customTags
);
instructions
.
push
(
token
);
}
else
if
(
token
.
tag
==
'
/
'
)
{
if
(
stack
.
length
===
0
)
{
throw
new
Error
(
'
Closing tag without opener: /
'
+
token
.
n
);
}
opener
=
stack
.
pop
();
if
(
token
.
n
!=
opener
.
n
&&
!
isCloser
(
token
.
n
,
opener
.
n
,
customTags
))
{
throw
new
Error
(
'
Nesting error:
'
+
opener
.
n
+
'
vs.
'
+
token
.
n
);
}
opener
.
end
=
token
.
i
;
return
instructions
;
}
else
{
instructions
.
push
(
token
);
}
}
if
(
stack
.
length
>
0
)
{
throw
new
Error
(
'
missing closing tag:
'
+
stack
.
pop
().
n
);
}
return
instructions
;
}
function
isOpener
(
token
,
tags
)
{
for
(
var
i
=
0
,
l
=
tags
.
length
;
i
<
l
;
i
++
)
{
if
(
tags
[
i
].
o
==
token
.
n
)
{
token
.
tag
=
'
#
'
;
return
true
;
}
}
}
function
isCloser
(
close
,
open
,
tags
)
{
for
(
var
i
=
0
,
l
=
tags
.
length
;
i
<
l
;
i
++
)
{
if
(
tags
[
i
].
c
==
close
&&
tags
[
i
].
o
==
open
)
{
return
true
;
}
}
}
function
writeCode
(
tree
)
{
return
'
i = i || "";var b = i + "";var _ = this;
'
+
walk
(
tree
)
+
'
return b;
'
;
}
Hogan
.
generate
=
function
(
code
,
text
,
options
)
{
if
(
options
.
asString
)
{
return
'
function(c,p,i){
'
+
code
+
'
;}
'
;
}
return
new
Hogan
.
Template
(
new
Function
(
'
c
'
,
'
p
'
,
'
i
'
,
code
),
text
,
Hogan
);
}
function
esc
(
s
)
{
return
s
.
replace
(
rSlash
,
'
\\\\
'
)
.
replace
(
rQuot
,
'
\\\
"
'
)
.
replace
(
rNewline
,
'
\\
n
'
)
.
replace
(
rCr
,
'
\\
r
'
);
}
function
chooseMethod
(
s
)
{
return
(
~
s
.
indexOf
(
'
.
'
))
?
'
d
'
:
'
f
'
;
}
function
walk
(
tree
)
{
var
code
=
''
;
for
(
var
i
=
0
,
l
=
tree
.
length
;
i
<
l
;
i
++
)
{
var
tag
=
tree
[
i
].
tag
;
if
(
tag
==
'
#
'
)
{
code
+=
section
(
tree
[
i
].
nodes
,
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
),
tree
[
i
].
i
,
tree
[
i
].
end
,
tree
[
i
].
otag
+
"
"
+
tree
[
i
].
ctag
);
}
else
if
(
tag
==
'
^
'
)
{
code
+=
invertedSection
(
tree
[
i
].
nodes
,
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
==
'
<
'
||
tag
==
'
>
'
)
{
code
+=
partial
(
tree
[
i
]);
}
else
if
(
tag
==
'
{
'
||
tag
==
'
&
'
)
{
code
+=
tripleStache
(
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
==
'
\n
'
)
{
code
+=
text
(
'
"
\\
n"
'
+
(
tree
.
length
-
1
==
i
?
''
:
'
+ i
'
));
}
else
if
(
tag
==
'
_v
'
)
{
code
+=
variable
(
tree
[
i
].
n
,
chooseMethod
(
tree
[
i
].
n
));
}
else
if
(
tag
===
undefined
)
{
code
+=
text
(
'
"
'
+
esc
(
tree
[
i
])
+
'
"
'
);
}
}
return
code
;
}
function
section
(
nodes
,
id
,
method
,
start
,
end
,
tags
)
{
return
'
if(_.s(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,1),
'
+
'
c,p,0,
'
+
start
+
'
,
'
+
end
+
'
, "
'
+
tags
+
'
")){
'
+
'
b += _.rs(c,p,
'
+
'
function(c,p){ var b = "";
'
+
walk
(
nodes
)
+
'
return b;});c.pop();}
'
+
'
else{b += _.b; _.b = ""};
'
;
}
function
invertedSection
(
nodes
,
id
,
method
)
{
return
'
if (!_.s(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,1),c,p,1,0,0,"")){
'
+
walk
(
nodes
)
+
'
};
'
;
}
function
partial
(
tok
)
{
return
'
b += _.rp("
'
+
esc
(
tok
.
n
)
+
'
",c,p,"
'
+
(
tok
.
indent
||
''
)
+
'
");
'
;
}
function
tripleStache
(
id
,
method
)
{
return
'
b += (_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,0));
'
;
}
function
variable
(
id
,
method
)
{
return
'
b += (_.v(_.
'
+
method
+
'
("
'
+
esc
(
id
)
+
'
",c,p,0)));
'
;
}
function
text
(
id
)
{
return
'
b +=
'
+
id
+
'
;
'
;
}
Hogan
.
parse
=
function
(
tokens
,
options
)
{
options
=
options
||
{};
return
buildTree
(
tokens
,
''
,
[],
options
.
sectionTags
||
[]);
},
Hogan
.
cache
=
{};
Hogan
.
compile
=
function
(
text
,
options
)
{
// options
//
// asString: false (default)
//
// sectionTags: [{o: '_foo', c: 'foo'}]
// An array of object with o and c fields that indicate names for custom
// section tags. The example above allows parsing of {{_foo}}{{/foo}}.
//
// delimiters: A string that overrides the default delimiters.
// Example: "<% %>"
//
options
=
options
||
{};
var
key
=
text
+
'
||
'
+
!!
options
.
asString
;
var
t
=
this
.
cache
[
key
];
if
(
t
)
{
return
t
;
}
t
=
this
.
generate
(
writeCode
(
this
.
parse
(
this
.
scan
(
text
,
options
.
delimiters
),
options
)),
text
,
options
);
return
this
.
cache
[
key
]
=
t
;
};
})(
typeof
exports
!==
'
undefined
'
?
exports
:
Hogan
);
var
Mustache
=
(
function
(
Hogan
)
{
// Mustache.js has non-spec partial context behavior
function
mustachePartial
(
name
,
context
,
partials
,
indent
)
{
var
partialScope
=
this
.
f
(
name
,
context
,
partials
,
0
);
var
cx
=
context
;
if
(
partialScope
)
{
cx
=
cx
.
concat
(
partialScope
);
}
return
Hogan
.
Template
.
prototype
.
rp
.
call
(
this
,
name
,
cx
,
partials
,
indent
);
}
var
HoganTemplateWrapper
=
function
(
renderFunc
,
text
,
compiler
){
this
.
rp
=
mustachePartial
;
Hogan
.
Template
.
call
(
this
,
renderFunc
,
text
,
compiler
);
};
HoganTemplateWrapper
.
prototype
=
Hogan
.
Template
.
prototype
;
// Add a wrapper for Hogan's generate method. Mustache and Hogan keep
// separate caches, and Mustache returns wrapped templates.
var
wrapper
;
var
HoganWrapper
=
function
(){
this
.
cache
=
{};
this
.
generate
=
function
(
code
,
text
,
options
)
{
return
new
HoganTemplateWrapper
(
new
Function
(
'
c
'
,
'
p
'
,
'
i
'
,
code
),
text
,
wrapper
);
}
};
HoganWrapper
.
prototype
=
Hogan
;
wrapper
=
new
HoganWrapper
();
return
{
to_html
:
function
(
text
,
data
,
partials
,
sendFun
)
{
var
template
=
wrapper
.
compile
(
text
);
var
result
=
template
.
render
(
data
,
partials
);
if
(
!
sendFun
)
{
return
result
;
}
sendFun
(
result
);
}
}
})(
Hogan
);
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/builds/1.0.5/template-1.0.5.js
0 → 100644
+
233
-
0
View file @
f764aee4
/*
* Copyright 2011 Twitter, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var
Hogan
=
{};
(
function
(
Hogan
)
{
Hogan
.
Template
=
function
constructor
(
renderFunc
,
text
,
compiler
)
{
if
(
renderFunc
)
{
this
.
r
=
renderFunc
;
}
this
.
c
=
compiler
;
this
.
text
=
text
||
''
;
}
Hogan
.
Template
.
prototype
=
{
// render: replaced by generated code.
r
:
function
(
context
,
partials
,
indent
)
{
return
''
;
},
// variable escaping
v
:
hoganEscape
,
render
:
function
render
(
context
,
partials
,
indent
)
{
return
this
.
ri
([
context
],
partials
||
{},
indent
);
},
// render internal -- a hook for overrides that catches partials too
ri
:
function
(
context
,
partials
,
indent
)
{
return
this
.
r
(
context
,
partials
,
indent
);
},
// tries to find a partial in the curent scope and render it
rp
:
function
(
name
,
context
,
partials
,
indent
)
{
var
partial
=
partials
[
name
];
if
(
!
partial
)
{
return
''
;
}
if
(
this
.
c
&&
typeof
partial
==
'
string
'
)
{
partial
=
this
.
c
.
compile
(
partial
);
}
return
partial
.
ri
(
context
,
partials
,
indent
);
},
// render a section
rs
:
function
(
context
,
partials
,
section
)
{
var
buf
=
''
,
tail
=
context
[
context
.
length
-
1
];
if
(
!
isArray
(
tail
))
{
return
buf
=
section
(
context
,
partials
);
}
for
(
var
i
=
0
;
i
<
tail
.
length
;
i
++
)
{
context
.
push
(
tail
[
i
]);
buf
+=
section
(
context
,
partials
);
context
.
pop
();
}
return
buf
;
},
// maybe start a section
s
:
function
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
)
{
var
pass
;
if
(
isArray
(
val
)
&&
val
.
length
===
0
)
{
return
false
;
}
if
(
typeof
val
==
'
function
'
)
{
val
=
this
.
ls
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
);
}
pass
=
(
val
===
''
)
||
!!
val
;
if
(
!
inverted
&&
pass
&&
ctx
)
{
ctx
.
push
((
typeof
val
==
'
object
'
)
?
val
:
ctx
[
ctx
.
length
-
1
]);
}
return
pass
;
},
// find values with dotted names
d
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
var
names
=
key
.
split
(
'
.
'
),
val
=
this
.
f
(
names
[
0
],
ctx
,
partials
,
returnFound
),
cx
=
null
;
if
(
key
===
'
.
'
&&
isArray
(
ctx
[
ctx
.
length
-
2
]))
{
return
ctx
[
ctx
.
length
-
1
];
}
for
(
var
i
=
1
;
i
<
names
.
length
;
i
++
)
{
if
(
val
&&
typeof
val
==
'
object
'
&&
names
[
i
]
in
val
)
{
cx
=
val
;
val
=
val
[
names
[
i
]];
}
else
{
val
=
''
;
}
}
if
(
returnFound
&&
!
val
)
{
return
false
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
ctx
.
push
(
cx
);
val
=
this
.
lv
(
val
,
ctx
,
partials
);
ctx
.
pop
();
}
return
val
;
},
// find values with normal names
f
:
function
(
key
,
ctx
,
partials
,
returnFound
)
{
var
val
=
false
,
v
=
null
,
found
=
false
;
for
(
var
i
=
ctx
.
length
-
1
;
i
>=
0
;
i
--
)
{
v
=
ctx
[
i
];
if
(
v
&&
typeof
v
==
'
object
'
&&
key
in
v
)
{
val
=
v
[
key
];
found
=
true
;
break
;
}
}
if
(
!
found
)
{
return
(
returnFound
)
?
false
:
""
;
}
if
(
!
returnFound
&&
typeof
val
==
'
function
'
)
{
val
=
this
.
lv
(
val
,
ctx
,
partials
);
}
return
val
;
},
// higher order templates
ho
:
function
(
val
,
cx
,
partials
,
text
,
tags
)
{
var
compiler
=
this
.
c
;
var
t
=
val
.
call
(
cx
,
text
,
function
(
t
)
{
return
compiler
.
compile
(
t
,
{
delimiters
:
tags
}).
render
(
cx
,
partials
);
});
var
s
=
compiler
.
compile
(
t
.
toString
(),
{
delimiters
:
tags
}).
render
(
cx
,
partials
);
this
.
b
=
s
;
return
false
;
},
// higher order template result buffer
b
:
''
,
// lambda replace section
ls
:
function
(
val
,
ctx
,
partials
,
inverted
,
start
,
end
,
tags
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
],
t
=
null
;
if
(
!
inverted
&&
this
.
c
&&
val
.
length
>
0
)
{
return
this
.
ho
(
val
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
),
tags
);
}
t
=
val
.
call
(
cx
);
if
(
typeof
t
==
'
function
'
)
{
if
(
inverted
)
{
return
true
;
}
else
if
(
this
.
c
)
{
return
this
.
ho
(
t
,
cx
,
partials
,
this
.
text
.
substring
(
start
,
end
),
tags
);
}
}
return
t
;
},
// lambda replace variable
lv
:
function
(
val
,
ctx
,
partials
)
{
var
cx
=
ctx
[
ctx
.
length
-
1
];
var
result
=
val
.
call
(
cx
);
if
(
typeof
result
==
'
function
'
)
{
result
=
result
.
call
(
cx
);
}
result
=
result
.
toString
();
if
(
this
.
c
&&
~
result
.
indexOf
(
"
{{
"
))
{
return
this
.
c
.
compile
(
result
).
render
(
cx
,
partials
);
}
return
result
;
}
};
var
rAmp
=
/&/g
,
rLt
=
/</g
,
rGt
=
/>/g
,
rApos
=
/
\'
/g
,
rQuot
=
/
\"
/g
,
hChars
=
/
[
&<>
\"\']
/
;
function
hoganEscape
(
str
)
{
str
=
String
((
str
===
null
||
str
===
undefined
)
?
''
:
str
);
return
hChars
.
test
(
str
)
?
str
.
replace
(
rAmp
,
'
&
'
)
.
replace
(
rLt
,
'
<
'
)
.
replace
(
rGt
,
'
>
'
)
.
replace
(
rApos
,
'
'
'
)
.
replace
(
rQuot
,
'
"
'
)
:
str
;
}
var
isArray
=
Array
.
isArray
||
function
(
a
)
{
return
Object
.
prototype
.
toString
.
call
(
a
)
===
'
[object Array]
'
;
};
})(
typeof
exports
!==
'
undefined
'
?
exports
:
Hogan
);
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/builds/1.0.5/template-1.0.5.min.js
0 → 100644
+
5
-
0
View file @
f764aee4
/**
* @preserve Copyright 2012 Twitter, Inc.
* @license http://www.apache.org/licenses/LICENSE-2.0.txt
*/
var
Hogan
=
{};(
function
(
a
){
function
h
(
a
){
return
a
=
String
(
a
===
null
||
a
===
undefined
?
""
:
a
),
g
.
test
(
a
)?
a
.
replace
(
b
,
"
&
"
).
replace
(
c
,
"
<
"
).
replace
(
d
,
"
>
"
).
replace
(
e
,
"
'
"
).
replace
(
f
,
"
"
"
):
a
}
a
.
Template
=
function
j
(
a
,
b
,
c
){
a
&&
(
this
.
r
=
a
),
this
.
c
=
c
,
this
.
text
=
b
||
""
},
a
.
Template
.
prototype
=
{
r
:
function
(
a
,
b
,
c
){
return
""
},
v
:
h
,
render
:
function
(
b
,
c
,
d
){
return
this
.
ri
([
b
],
c
||
{},
d
)},
ri
:
function
(
a
,
b
,
c
){
return
this
.
r
(
a
,
b
,
c
)},
rp
:
function
(
a
,
b
,
c
,
d
){
var
e
=
c
[
a
];
return
e
?(
this
.
c
&&
typeof
e
==
"
string
"
&&
(
e
=
this
.
c
.
compile
(
e
)),
e
.
ri
(
b
,
c
,
d
)):
""
},
rs
:
function
(
a
,
b
,
c
){
var
d
=
""
,
e
=
a
[
a
.
length
-
1
];
if
(
!
i
(
e
))
return
d
=
c
(
a
,
b
);
for
(
var
f
=
0
;
f
<
e
.
length
;
f
++
)
a
.
push
(
e
[
f
]),
d
+=
c
(
a
,
b
),
a
.
pop
();
return
d
},
s
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
var
h
;
return
i
(
a
)
&&
a
.
length
===
0
?
!
1
:(
typeof
a
==
"
function
"
&&
(
a
=
this
.
ls
(
a
,
b
,
c
,
d
,
e
,
f
,
g
)),
h
=
a
===
""
||!!
a
,
!
d
&&
h
&&
b
&&
b
.
push
(
typeof
a
==
"
object
"
?
a
:
b
[
b
.
length
-
1
]),
h
)},
d
:
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
split
(
"
.
"
),
f
=
this
.
f
(
e
[
0
],
b
,
c
,
d
),
g
=
null
;
if
(
a
===
"
.
"
&&
i
(
b
[
b
.
length
-
2
]))
return
b
[
b
.
length
-
1
];
for
(
var
h
=
1
;
h
<
e
.
length
;
h
++
)
f
&&
typeof
f
==
"
object
"
&&
e
[
h
]
in
f
?(
g
=
f
,
f
=
f
[
e
[
h
]]):
f
=
""
;
return
d
&&!
f
?
!
1
:(
!
d
&&
typeof
f
==
"
function
"
&&
(
b
.
push
(
g
),
f
=
this
.
lv
(
f
,
b
,
c
),
b
.
pop
()),
f
)},
f
:
function
(
a
,
b
,
c
,
d
){
var
e
=!
1
,
f
=
null
,
g
=!
1
;
for
(
var
h
=
b
.
length
-
1
;
h
>=
0
;
h
--
){
f
=
b
[
h
];
if
(
f
&&
typeof
f
==
"
object
"
&&
a
in
f
){
e
=
f
[
a
],
g
=!
0
;
break
}}
return
g
?(
!
d
&&
typeof
e
==
"
function
"
&&
(
e
=
this
.
lv
(
e
,
b
,
c
)),
e
):
d
?
!
1
:
""
},
ho
:
function
(
a
,
b
,
c
,
d
,
e
){
var
f
=
this
.
c
,
g
=
a
.
call
(
b
,
d
,
function
(
a
){
return
f
.
compile
(
a
,{
delimiters
:
e
}).
render
(
b
,
c
)}),
h
=
f
.
compile
(
g
.
toString
(),{
delimiters
:
e
}).
render
(
b
,
c
);
return
this
.
b
=
h
,
!
1
},
b
:
""
,
ls
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
var
h
=
b
[
b
.
length
-
1
],
i
=
null
;
if
(
!
d
&&
this
.
c
&&
a
.
length
>
0
)
return
this
.
ho
(
a
,
h
,
c
,
this
.
text
.
substring
(
e
,
f
),
g
);
i
=
a
.
call
(
h
);
if
(
typeof
i
==
"
function
"
){
if
(
d
)
return
!
0
;
if
(
this
.
c
)
return
this
.
ho
(
i
,
h
,
c
,
this
.
text
.
substring
(
e
,
f
),
g
)}
return
i
},
lv
:
function
(
a
,
b
,
c
){
var
d
=
b
[
b
.
length
-
1
],
e
=
a
.
call
(
d
);
return
typeof
e
==
"
function
"
&&
(
e
=
e
.
call
(
d
)),
e
=
e
.
toString
(),
this
.
c
&&~
e
.
indexOf
(
"
{{
"
)?
this
.
c
.
compile
(
e
).
render
(
d
,
c
):
e
}};
var
b
=
/&/g
,
c
=
/</g
,
d
=
/>/g
,
e
=
/
\'
/g
,
f
=
/
\"
/g
,
g
=
/
[
&<>
\"\']
/
,
i
=
Array
.
isArray
||
function
(
a
){
return
Object
.
prototype
.
toString
.
call
(
a
)
===
"
[object Array]
"
}})(
typeof
exports
!=
"
undefined
"
?
exports
:
Hogan
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/favicon.ico
0 → 100644
+
0
-
0
View file @
f764aee4
1.12 KB
This diff is collapsed.
Click to expand it.
docs/build/node_modules/hogan.js/web/images/logo.png
0 → 100644
+
0
-
0
View file @
f764aee4
3.31 KB
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
5
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets