htmlp_parse
v1.0.1
Published
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>HTMLP_parse</title> <link rel="stylesheet" href="_/foghorn.css"> </head> <body> <h1>HTMLP_parse()</h1> <h2>Behavior</h2> <h3>Case 1</h3> <p>When Invoking HTMLP_
Downloads
3
Readme
<script type="text/coffeescript" <span style="color:blue; font-weight: bold;">data-htmlp="x.coffee"</span>>
<span style="color:red; font-weight: bold;">x = 42</span>
</script>
<code <span style="color:blue; font-weight: bold;">data-htmlp="x.coffee"</span>>
<span style="color:red; font-weight: bold;">console.log x is 42</span>
</code>
<code <span style="color:blue; font-weight: bold;">data-htmlp="y.coffee"</span>>
<span style="color:red; font-weight: bold;">y = false</span>
</code>
</body>
</html>
case_1_actual = htmlp_parse '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>My LP File</title></head><body><script type="text/coffeescript" data-htmlp="x.coffee">x = 42</script><code data-htmlp="x.coffee">console.log x is 42</code><code data-htmlp="y.coffee">y = false</code></body></html>'
case_1_expected = {
"x.coffee" : "x = 42\nconsole.log x is 42"
"y.coffee" : "y = false"
}
assert _.isEqual( case_1_actual, case_1_expected ), 'Case 1 failure'
### Case 2 ###
case_2_actual = htmlp_parse '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>My LP File</title></head><body><h1>No file exports here :)</h1></body></html>'
case_2_expected = {}
assert _.isEqual( case_1_actual, case_1_expected ), 'Case 2 failure'
_.each file_writes, (element) ->
if _.isString files[ element.file_name ]
files[ element.file_name ] += '\n' + element.text
else
files[ element.file_name ] = element.text