-
Notifications
You must be signed in to change notification settings - Fork 0
/
markup.app
45 lines (32 loc) · 2.19 KB
/
markup.app
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
module elib/elib-utils/markup
section markup
template header1(){ <h1> elements </h1> }
template header2(){ <h2> elements </h2> }
template header3(){ <h3> elements </h3> }
template header4(){ <h4> elements </h4> }
template header5(){ <h5> elements </h5> }
template header6(){ <h6> elements </h6> }
template anchorHeader1(){ var hashtext:=/\W/.replaceAll("-", rendertemplate(elements)); <h1><a href="#"+hashtext style="text-decoration:inherit; color:inherit;" name=hashtext class="anchor">elements</a></h1>}
template anchorHeader2(){ var hashtext:=/\W/.replaceAll("-", rendertemplate(elements)); <h2><a href="#"+hashtext style="text-decoration:inherit; color:inherit;" name=hashtext class="anchor">elements</a></h2>}
template anchorHeader3(){ var hashtext:=/\W/.replaceAll("-", rendertemplate(elements)); <h3><a href="#"+hashtext style="text-decoration:inherit; color:inherit;" name=hashtext class="anchor">elements</a></h3>}
template anchorHeader4(){ var hashtext:=/\W/.replaceAll("-", rendertemplate(elements)); <h4><a href="#"+hashtext style="text-decoration:inherit; color:inherit;" name=hashtext class="anchor">elements</a></h4>}
template anchorHeader5(){ var hashtext:=/\W/.replaceAll("-", rendertemplate(elements)); <h5><a href="#"+hashtext style="text-decoration:inherit; color:inherit;" name=hashtext class="anchor">elements</a></h5>}
template anchorHeader6(){ var hashtext:=/\W/.replaceAll("-", rendertemplate(elements)); <h6><a href="#"+hashtext style="text-decoration:inherit; color:inherit;" name=hashtext class="anchor">elements</a></h6>}
template hrule(){ <hr /> }
section dynamic styling
template contrastText(jquerySelector : String){
<script>
$('~jquerySelector').each(function(){
var rgb = $(this).css( "background-color" ).match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
//http://www.w3.org/TR/AERT#color-contrast
var o = Math.round(((parseInt(rgb[1]) * 299) + (parseInt(rgb[2]) * 587) + (parseInt(rgb[3]) * 114)) /1000);
if(o > 125) {
$(this).css('color', 'black');
}else{
$(this).css('color', 'white');
}
});
</script>
}
section forms
define save() { submit action{ } { "Save" } }