vebdew 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/README.md +5 -2
  2. data/VERSION +1 -1
  3. data/bin/vebdew +2 -1
  4. data/lib/template/css/{styles.css → style.css} +28 -1
  5. data/lib/template/css/zenburn.css +115 -0
  6. data/lib/template/js/highlight.js +5 -0
  7. data/lib/template/js/index.js +1 -6
  8. data/lib/template/js/sample.js +49 -27
  9. data/lib/template/vew/sample.vew +30 -61
  10. data/lib/vebdew/parser.rb +27 -18
  11. data/lib/vebdew/runner.rb +10 -5
  12. data/test/test_parser.rb +15 -1
  13. data/vebdew.gemspec +6 -23
  14. metadata +49 -36
  15. data/lib/template/css/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  16. data/lib/template/css/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  17. data/lib/template/css/images/ui-bg_gloss-wave_16_121212_500x100.png +0 -0
  18. data/lib/template/css/images/ui-bg_highlight-hard_15_888888_1x100.png +0 -0
  19. data/lib/template/css/images/ui-bg_highlight-hard_55_555555_1x100.png +0 -0
  20. data/lib/template/css/images/ui-bg_highlight-soft_35_adadad_1x100.png +0 -0
  21. data/lib/template/css/images/ui-bg_highlight-soft_60_dddddd_1x100.png +0 -0
  22. data/lib/template/css/images/ui-bg_inset-soft_15_121212_1x100.png +0 -0
  23. data/lib/template/css/images/ui-icons_666666_256x240.png +0 -0
  24. data/lib/template/css/images/ui-icons_aaaaaa_256x240.png +0 -0
  25. data/lib/template/css/images/ui-icons_bbbbbb_256x240.png +0 -0
  26. data/lib/template/css/images/ui-icons_c98000_256x240.png +0 -0
  27. data/lib/template/css/images/ui-icons_cccccc_256x240.png +0 -0
  28. data/lib/template/css/images/ui-icons_cd0a0a_256x240.png +0 -0
  29. data/lib/template/css/images/ui-icons_f29a00_256x240.png +0 -0
  30. data/lib/template/css/jquery-ui.css +0 -306
  31. data/lib/template/css/ruler.css +0 -34
  32. data/lib/template/js/jquery-ui.min.js +0 -76
  33. data/lib/template/js/ruler.js +0 -9
data/README.md CHANGED
@@ -5,12 +5,15 @@ Converts vew files (markdown like syntax) into HTML5 slides.
5
5
 
6
6
  ## Library used
7
7
  - reveal.js: for the slides animation
8
+ - highlight.js: for syntax highlight
8
9
  - erubis: for the template
9
10
  - htmlentities: for escaping the HTML
10
11
 
11
- ## Install
12
+ ## Quick start
12
13
  ```
13
- gem install vebdew
14
+ gem install vebdew # install the gem
15
+ vebdew new # create project
16
+ vebdew generate # generate HTML slide
14
17
  ```
15
18
 
16
19
  ## Usage
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/bin/vebdew CHANGED
@@ -14,6 +14,7 @@ Directory:
14
14
 
15
15
  Commands:
16
16
  new \# Create a new slide project
17
+ \# [PROJECT NAME]
17
18
  generate \# Generate slides for current directory (shortcut: g)
18
19
  compile \# Compiles single file into HTML5 slides (shortcut: c)
19
20
  \# [VEW FILE] [ERB TEMPLATE] [HTML SLIDE]
@@ -21,7 +22,7 @@ Commands:
21
22
 
22
23
  case ARGV[0]
23
24
  when /new/
24
- Vebdew::Runner.create
25
+ Vebdew::Runner.create ARGV[1]
25
26
  when /generate|g/
26
27
  Vebdew::Runner.generate
27
28
  when /compile|c/
@@ -1,3 +1,4 @@
1
+ @charset "UTF-8";
1
2
  #reveal .nav li {
2
3
  display: -moz-inline-box;
3
4
  -moz-box-orient: vertical;
@@ -14,6 +15,9 @@
14
15
  #reveal .nav li:last-child {
15
16
  border: 0;
16
17
  }
18
+ #reveal ul ul {
19
+ margin-left: 1em;
20
+ }
17
21
  #reveal section.html5 {
18
22
  overflow: hidden;
19
23
  }
@@ -54,7 +58,7 @@
54
58
  #reveal .sample-container code {
55
59
  color: inherit;
56
60
  }
57
- #reveal .sample-container.small pre {
61
+ #reveal .sample-container.small pre, #reveal pre.small {
58
62
  font-size: 11px;
59
63
  line-height: 16px;
60
64
  }
@@ -73,6 +77,7 @@
73
77
  position: absolute;
74
78
  }
75
79
  #reveal .img-board .box {
80
+ /* in HTML slides */
76
81
  position: absolute;
77
82
  border: 4px solid black;
78
83
  -moz-border-radius: 15px;
@@ -100,3 +105,25 @@
100
105
  top: 100%;
101
106
  content: "</" attr(data-name) ">";
102
107
  }
108
+ #reveal .three-column, #reveal .two-column {
109
+ display: -moz-inline-box;
110
+ -moz-box-orient: vertical;
111
+ display: inline-block;
112
+ vertical-align: middle;
113
+ *vertical-align: auto;
114
+ vertical-align: top;
115
+ margin: 0 1%;
116
+ }
117
+ #reveal .three-column, #reveal .two-column {
118
+ *display: inline;
119
+ }
120
+ #reveal .three-column {
121
+ width: 30%;
122
+ }
123
+ #reveal .two-column {
124
+ width: 45%;
125
+ }
126
+ #reveal .sample-container.demo-dom-native pre, #reveal .sample-container.demo-dom-jquery pre, #reveal .sample-container.maxheight pre {
127
+ max-height: 350px;
128
+ overflow: auto;
129
+ }
@@ -0,0 +1,115 @@
1
+ /*
2
+
3
+ Zenburn style from voldmar.ru (c) Vladimir Epifanov <voldmar@voldmar.ru>
4
+ based on dark.css by Ivan Sagalaev
5
+
6
+ */
7
+
8
+ pre code {
9
+ display: block; padding: 0.5em;
10
+ background: #3F3F3F;
11
+ color: #DCDCDC;
12
+ }
13
+
14
+ pre .keyword,
15
+ pre .tag,
16
+ pre .django .tag,
17
+ pre .django .keyword,
18
+ pre .css .class,
19
+ pre .css .id,
20
+ pre .lisp .title {
21
+ color: #E3CEAB;
22
+ }
23
+
24
+ pre .django .template_tag,
25
+ pre .django .variable,
26
+ pre .django .filter .argument {
27
+ color: #DCDCDC;
28
+ }
29
+
30
+ pre .number,
31
+ pre .date {
32
+ color: #8CD0D3;
33
+ }
34
+
35
+ pre .dos .envvar,
36
+ pre .dos .stream,
37
+ pre .variable,
38
+ pre .apache .sqbracket {
39
+ color: #EFDCBC;
40
+ }
41
+
42
+ pre .dos .flow,
43
+ pre .diff .change,
44
+ pre .python .exception,
45
+ pre .python .built_in,
46
+ pre .literal,
47
+ pre .tex .special {
48
+ color: #EFEFAF;
49
+ }
50
+
51
+ pre .diff .chunk,
52
+ pre .ruby .subst {
53
+ color: #8F8F8F;
54
+ }
55
+
56
+ pre .dos .keyword,
57
+ pre .python .decorator,
58
+ pre .class .title,
59
+ pre .haskell .label,
60
+ pre .function .title,
61
+ pre .ini .title,
62
+ pre .diff .header,
63
+ pre .ruby .class .parent,
64
+ pre .apache .tag,
65
+ pre .nginx .built_in,
66
+ pre .tex .command,
67
+ pre .input_number {
68
+ color: #efef8f;
69
+ }
70
+
71
+ pre .dos .winutils,
72
+ pre .ruby .symbol,
73
+ pre .ruby .symbol .string,
74
+ pre .ruby .symbol .keyword,
75
+ pre .ruby .symbol .keymethods,
76
+ pre .ruby .string,
77
+ pre .ruby .instancevar {
78
+ color: #DCA3A3;
79
+ }
80
+
81
+ pre .diff .deletion,
82
+ pre .string,
83
+ pre .tag .value,
84
+ pre .preprocessor,
85
+ pre .built_in,
86
+ pre .sql .aggregate,
87
+ pre .javadoc,
88
+ pre .smalltalk .class,
89
+ pre .smalltalk .localvars,
90
+ pre .smalltalk .array,
91
+ pre .css .rules .value,
92
+ pre .attr_selector,
93
+ pre .pseudo,
94
+ pre .apache .cbracket,
95
+ pre .tex .formula {
96
+ color: #CC9393;
97
+ }
98
+
99
+ pre .shebang,
100
+ pre .diff .addition,
101
+ pre .comment,
102
+ pre .java .annotation,
103
+ pre .template_comment,
104
+ pre .pi,
105
+ pre .doctype {
106
+ color: #7F9F7F;
107
+ }
108
+
109
+ pre .xml .css,
110
+ pre .xml .javascript,
111
+ pre .xml .vbscript,
112
+ pre .tex .formula {
113
+ opacity: 0.7;
114
+ }
115
+
@@ -0,0 +1,5 @@
1
+ /*
2
+ Syntax highlighting with language autodetection.
3
+ http://softwaremaniacs.org/soft/highlight/
4
+ */
5
+ var hljs=new function(){function m(p){return p.replace(/&/gm,"&amp;").replace(/</gm,"&lt;")}function c(r,q,p){return RegExp(q,"m"+(r.cI?"i":"")+(p?"g":""))}function j(r){for(var p=0;p<r.childNodes.length;p++){var q=r.childNodes[p];if(q.nodeName=="CODE"){return q}if(!(q.nodeType==3&&q.nodeValue.match(/\s+/))){break}}}function g(t,s){var r="";for(var q=0;q<t.childNodes.length;q++){if(t.childNodes[q].nodeType==3){var p=t.childNodes[q].nodeValue;if(s){p=p.replace(/\n/g,"")}r+=p}else{if(t.childNodes[q].nodeName=="BR"){r+="\n"}else{r+=g(t.childNodes[q])}}}if(/MSIE [678]/.test(navigator.userAgent)){r=r.replace(/\r/g,"\n")}return r}function a(s){var q=s.className.split(/\s+/);q=q.concat(s.parentNode.className.split(/\s+/));for(var p=0;p<q.length;p++){var r=q[p].replace(/^language-/,"");if(d[r]||r=="no-highlight"){return r}}}function b(p){var q=[];(function(s,t){for(var r=0;r<s.childNodes.length;r++){if(s.childNodes[r].nodeType==3){t+=s.childNodes[r].nodeValue.length}else{if(s.childNodes[r].nodeName=="BR"){t+=1}else{q.push({event:"start",offset:t,node:s.childNodes[r]});t=arguments.callee(s.childNodes[r],t);q.push({event:"stop",offset:t,node:s.childNodes[r]})}}}return t})(p,0);return q}function l(y,z,x){var r=0;var w="";var t=[];function u(){if(y.length&&z.length){if(y[0].offset!=z[0].offset){return(y[0].offset<z[0].offset)?y:z}else{return z[0].event=="start"?y:z}}else{return y.length?y:z}}function s(C){var D="<"+C.nodeName.toLowerCase();for(var A=0;A<C.attributes.length;A++){var B=C.attributes[A];D+=" "+B.nodeName.toLowerCase();if(B.nodeValue!=undefined&&B.nodeValue!=false&&B.nodeValue!=null){D+='="'+m(B.nodeValue)+'"'}}return D+">"}while(y.length||z.length){var v=u().splice(0,1)[0];w+=m(x.substr(r,v.offset-r));r=v.offset;if(v.event=="start"){w+=s(v.node);t.push(v.node)}else{if(v.event=="stop"){var q=t.length;do{q--;var p=t[q];w+=("</"+p.nodeName.toLowerCase()+">")}while(p!=v.node);t.splice(q,1);while(q<t.length){w+=s(t[q]);q++}}}}w+=x.substr(r);return w}function i(){function p(u,t,v){if(u.compiled){return}if(!v){u.bR=c(t,u.b?u.b:"\\B|\\b");if(!u.e&&!u.eW){u.e="\\B|\\b"}if(u.e){u.eR=c(t,u.e)}}if(u.i){u.iR=c(t,u.i)}if(u.r==undefined){u.r=1}if(u.k){u.lR=c(t,u.l||hljs.IR,true)}for(var s in u.k){if(!u.k.hasOwnProperty(s)){continue}if(u.k[s] instanceof Object){u.kG=u.k}else{u.kG={keyword:u.k}}break}if(!u.c){u.c=[]}u.compiled=true;for(var r=0;r<u.c.length;r++){p(u.c[r],t,false)}if(u.starts){p(u.starts,t,false)}}for(var q in d){if(!d.hasOwnProperty(q)){continue}p(d[q].dM,d[q],true)}}function e(J,D){if(!i.called){i();i.called=true}function z(r,M){for(var L=0;L<M.c.length;L++){if(M.c[L].bR.test(r)){return M.c[L]}}}function w(L,r){if(C[L].e&&C[L].eR.test(r)){return 1}if(C[L].eW){var M=w(L-1,r);return M?M+1:0}return 0}function x(r,L){return L.iR&&L.iR.test(r)}function A(O,N){var M=[];for(var L=0;L<O.c.length;L++){M.push(O.c[L].b)}var r=C.length-1;do{if(C[r].e){M.push(C[r].e)}r--}while(C[r+1].eW);if(O.i){M.push(O.i)}return c(N,"("+M.join("|")+")",true)}function s(M,L){var N=C[C.length-1];if(!N.t){N.t=A(N,H)}N.t.lastIndex=L;var r=N.t.exec(M);if(r){return[M.substr(L,r.index-L),r[0],false]}else{return[M.substr(L),"",true]}}function p(O,r){var L=H.cI?r[0].toLowerCase():r[0];for(var N in O.kG){if(!O.kG.hasOwnProperty(N)){continue}var M=O.kG[N].hasOwnProperty(L);if(M){return[N,M]}}return false}function F(M,O){if(!O.k){return m(M)}var N="";var P=0;O.lR.lastIndex=0;var L=O.lR.exec(M);while(L){N+=m(M.substr(P,L.index-P));var r=p(O,L);if(r){t+=r[1];N+='<span class="'+r[0]+'">'+m(L[0])+"</span>"}else{N+=m(L[0])}P=O.lR.lastIndex;L=O.lR.exec(M)}N+=m(M.substr(P,M.length-P));return N}function K(r,M){if(M.sL&&d[M.sL]){var L=e(M.sL,r);t+=L.keyword_count;return L.value}else{return F(r,M)}}function I(M,r){var L=M.cN?'<span class="'+M.cN+'">':"";if(M.rB){q+=L;M.buffer=""}else{if(M.eB){q+=m(r)+L;M.buffer=""}else{q+=L;M.buffer=r}}C.push(M);B+=M.r}function E(O,L,Q){var R=C[C.length-1];if(Q){q+=K(R.buffer+O,R);return false}var M=z(L,R);if(M){q+=K(R.buffer+O,R);I(M,L);return M.rB}var r=w(C.length-1,L);if(r){var N=R.cN?"</span>":"";if(R.rE){q+=K(R.buffer+O,R)+N}else{if(R.eE){q+=K(R.buffer+O,R)+N+m(L)}else{q+=K(R.buffer+O+L,R)+N}}while(r>1){N=C[C.length-2].cN?"</span>":"";q+=N;r--;C.length--}var P=C[C.length-1];C.length--;C[C.length-1].buffer="";if(P.starts){I(P.starts,"")}return R.rE}if(x(L,R)){throw"Illegal"}}var H=d[J];var C=[H.dM];var B=0;var t=0;var q="";try{var v=0;H.dM.buffer="";do{var y=s(D,v);var u=E(y[0],y[1],y[2]);v+=y[0].length;if(!u){v+=y[1].length}}while(!y[2]);if(C.length>1){throw"Illegal"}return{r:B,keyword_count:t,value:q}}catch(G){if(G=="Illegal"){return{r:0,keyword_count:0,value:m(D)}}else{throw G}}}function f(t){var r={keyword_count:0,r:0,value:m(t)};var q=r;for(var p in d){if(!d.hasOwnProperty(p)){continue}var s=e(p,t);s.language=p;if(s.keyword_count+s.r>q.keyword_count+q.r){q=s}if(s.keyword_count+s.r>r.keyword_count+r.r){q=r;r=s}}if(q.language){r.second_best=q}return r}function h(r,q,p){if(q){r=r.replace(/^((<[^>]+>|\t)+)/gm,function(t,w,v,u){return w.replace(/\t/g,q)})}if(p){r=r.replace(/\n/g,"<br>")}return r}function o(u,x,q){var y=g(u,q);var s=a(u);if(s=="no-highlight"){return}if(s){var w=e(s,y)}else{var w=f(y);s=w.language}var p=b(u);if(p.length){var r=document.createElement("pre");r.innerHTML=w.value;w.value=l(p,b(r),y)}w.value=h(w.value,x,q);var t=u.className;if(!t.match("(\\s|^)(language-)?"+s+"(\\s|$)")){t=t?(t+" "+s):s}if(/MSIE [678]/.test(navigator.userAgent)&&u.tagName=="CODE"&&u.parentNode.tagName=="PRE"){var r=u.parentNode;var v=document.createElement("div");v.innerHTML="<pre><code>"+w.value+"</code></pre>";u=v.firstChild.firstChild;v.firstChild.cN=r.cN;r.parentNode.replaceChild(v.firstChild,r)}else{u.innerHTML=w.value}u.className=t;u.result={language:s,kw:w.keyword_count,re:w.r};if(w.second_best){u.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function k(){if(k.called){return}k.called=true;var r=document.getElementsByTagName("pre");for(var p=0;p<r.length;p++){var q=j(r[p]);if(q){o(q,hljs.tabReplace)}}}function n(){if(window.addEventListener){window.addEventListener("DOMContentLoaded",k,false);window.addEventListener("load",k,false)}else{if(window.attachEvent){window.attachEvent("onload",k)}else{window.onload=k}}}var d={};this.LANGUAGES=d;this.highlight=e;this.highlightAuto=f;this.fixMarkup=h;this.highlightBlock=o;this.initHighlighting=k;this.initHighlightingOnLoad=n;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="\\b(0x[A-Za-z0-9]+|\\d+(\\.\\d+)?)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\.",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.inherit=function(p,s){var r={};for(var q in p){r[q]=p[q]}if(s){for(var q in s){r[q]=s[q]}}return r}}();hljs.LANGUAGES.cs={dM:{k:{"abstract":1,as:1,base:1,bool:1,"break":1,"byte":1,"case":1,"catch":1,"char":1,checked:1,"class":1,"const":1,"continue":1,decimal:1,"default":1,delegate:1,"do":1,"do":1,"double":1,"else":1,"enum":1,event:1,explicit:1,extern:1,"false":1,"finally":1,fixed:1,"float":1,"for":1,foreach:1,"goto":1,"if":1,implicit:1,"in":1,"int":1,"interface":1,internal:1,is:1,lock:1,"long":1,namespace:1,"new":1,"null":1,object:1,operator:1,out:1,override:1,params:1,"private":1,"protected":1,"public":1,readonly:1,ref:1,"return":1,sbyte:1,sealed:1,"short":1,sizeof:1,stackalloc:1,"static":1,string:1,struct:1,"switch":1,"this":1,"throw":1,"true":1,"try":1,"typeof":1,uint:1,ulong:1,unchecked:1,unsafe:1,ushort:1,using:1,virtual:1,"volatile":1,"void":1,"while":1,ascending:1,descending:1,from:1,get:1,group:1,into:1,join:1,let:1,orderby:1,partial:1,select:1,set:1,value:1,"var":1,where:1,yield:1},c:[{cN:"comment",b:"///",e:"$",rB:true,c:[{cN:"xmlDocTag",b:"///|<!--|-->"},{cN:"xmlDocTag",b:"</?",e:">"}]},hljs.CLCM,hljs.CBLCLM,{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},hljs.ASM,hljs.QSM,hljs.CNM]}};hljs.LANGUAGES.ruby=function(){var g="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?";var a="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var n={keyword:{and:1,"false":1,then:1,defined:1,module:1,"in":1,"return":1,redo:1,"if":1,BEGIN:1,retry:1,end:1,"for":1,"true":1,self:1,when:1,next:1,until:1,"do":1,begin:1,unless:1,END:1,rescue:1,nil:1,"else":1,"break":1,undef:1,not:1,"super":1,"class":1,"case":1,require:1,yield:1,alias:1,"while":1,ensure:1,elsif:1,or:1,def:1},keymethods:{__id__:1,__send__:1,abort:1,abs:1,"all?":1,allocate:1,ancestors:1,"any?":1,arity:1,assoc:1,at:1,at_exit:1,autoload:1,"autoload?":1,"between?":1,binding:1,binmode:1,"block_given?":1,call:1,callcc:1,caller:1,capitalize:1,"capitalize!":1,casecmp:1,"catch":1,ceil:1,center:1,chomp:1,"chomp!":1,chop:1,"chop!":1,chr:1,"class":1,class_eval:1,"class_variable_defined?":1,class_variables:1,clear:1,clone:1,close:1,close_read:1,close_write:1,"closed?":1,coerce:1,collect:1,"collect!":1,compact:1,"compact!":1,concat:1,"const_defined?":1,const_get:1,const_missing:1,const_set:1,constants:1,count:1,crypt:1,"default":1,default_proc:1,"delete":1,"delete!":1,delete_at:1,delete_if:1,detect:1,display:1,div:1,divmod:1,downcase:1,"downcase!":1,downto:1,dump:1,dup:1,each:1,each_byte:1,each_index:1,each_key:1,each_line:1,each_pair:1,each_value:1,each_with_index:1,"empty?":1,entries:1,eof:1,"eof?":1,"eql?":1,"equal?":1,"eval":1,exec:1,exit:1,"exit!":1,extend:1,fail:1,fcntl:1,fetch:1,fileno:1,fill:1,find:1,find_all:1,first:1,flatten:1,"flatten!":1,floor:1,flush:1,for_fd:1,foreach:1,fork:1,format:1,freeze:1,"frozen?":1,fsync:1,getc:1,gets:1,global_variables:1,grep:1,gsub:1,"gsub!":1,"has_key?":1,"has_value?":1,hash:1,hex:1,id:1,include:1,"include?":1,included_modules:1,index:1,indexes:1,indices:1,induced_from:1,inject:1,insert:1,inspect:1,instance_eval:1,instance_method:1,instance_methods:1,"instance_of?":1,"instance_variable_defined?":1,instance_variable_get:1,instance_variable_set:1,instance_variables:1,"integer?":1,intern:1,invert:1,ioctl:1,"is_a?":1,isatty:1,"iterator?":1,join:1,"key?":1,keys:1,"kind_of?":1,lambda:1,last:1,length:1,lineno:1,ljust:1,load:1,local_variables:1,loop:1,lstrip:1,"lstrip!":1,map:1,"map!":1,match:1,max:1,"member?":1,merge:1,"merge!":1,method:1,"method_defined?":1,method_missing:1,methods:1,min:1,module_eval:1,modulo:1,name:1,nesting:1,"new":1,next:1,"next!":1,"nil?":1,nitems:1,"nonzero?":1,object_id:1,oct:1,open:1,pack:1,partition:1,pid:1,pipe:1,pop:1,popen:1,pos:1,prec:1,prec_f:1,prec_i:1,print:1,printf:1,private_class_method:1,private_instance_methods:1,"private_method_defined?":1,private_methods:1,proc:1,protected_instance_methods:1,"protected_method_defined?":1,protected_methods:1,public_class_method:1,public_instance_methods:1,"public_method_defined?":1,public_methods:1,push:1,putc:1,puts:1,quo:1,raise:1,rand:1,rassoc:1,read:1,read_nonblock:1,readchar:1,readline:1,readlines:1,readpartial:1,rehash:1,reject:1,"reject!":1,remainder:1,reopen:1,replace:1,require:1,"respond_to?":1,reverse:1,"reverse!":1,reverse_each:1,rewind:1,rindex:1,rjust:1,round:1,rstrip:1,"rstrip!":1,scan:1,seek:1,select:1,send:1,set_trace_func:1,shift:1,singleton_method_added:1,singleton_methods:1,size:1,sleep:1,slice:1,"slice!":1,sort:1,"sort!":1,sort_by:1,split:1,sprintf:1,squeeze:1,"squeeze!":1,srand:1,stat:1,step:1,store:1,strip:1,"strip!":1,sub:1,"sub!":1,succ:1,"succ!":1,sum:1,superclass:1,swapcase:1,"swapcase!":1,sync:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,taint:1,"tainted?":1,tell:1,test:1,"throw":1,times:1,to_a:1,to_ary:1,to_f:1,to_hash:1,to_i:1,to_int:1,to_io:1,to_proc:1,to_s:1,to_str:1,to_sym:1,tr:1,"tr!":1,tr_s:1,"tr_s!":1,trace_var:1,transpose:1,trap:1,truncate:1,"tty?":1,type:1,ungetc:1,uniq:1,"uniq!":1,unpack:1,unshift:1,untaint:1,untrace_var:1,upcase:1,"upcase!":1,update:1,upto:1,"value?":1,values:1,values_at:1,warn:1,write:1,write_nonblock:1,"zero?":1,zip:1}};var h={cN:"yardoctag",b:"@[A-Za-z]+"};var d={cN:"comment",b:"#",e:"$",c:[h]};var c={cN:"comment",b:"^\\=begin",e:"^\\=end",c:[h],r:10};var b={cN:"comment",b:"^__END__",e:"\\n$"};var u={cN:"subst",b:"#\\{",e:"}",l:g,k:n};var p=[hljs.BE,u];var s={cN:"string",b:"'",e:"'",c:p,r:0};var r={cN:"string",b:'"',e:'"',c:p,r:0};var q={cN:"string",b:"%[qw]?\\(",e:"\\)",c:p,r:10};var o={cN:"string",b:"%[qw]?\\[",e:"\\]",c:p,r:10};var m={cN:"string",b:"%[qw]?{",e:"}",c:p,r:10};var l={cN:"string",b:"%[qw]?<",e:">",c:p,r:10};var k={cN:"string",b:"%[qw]?/",e:"/",c:p,r:10};var j={cN:"string",b:"%[qw]?%",e:"%",c:p,r:10};var i={cN:"string",b:"%[qw]?-",e:"-",c:p,r:10};var t={cN:"string",b:"%[qw]?\\|",e:"\\|",c:p,r:10};var e={cN:"function",b:"\\bdef\\s+",e:" |$|;",l:g,k:n,c:[{cN:"title",b:a,l:g,k:n},{cN:"params",b:"\\(",e:"\\)",l:g,k:n},d,c,b]};var f={cN:"identifier",b:g,l:g,k:n,r:0};var v=[d,c,b,s,r,q,o,m,l,k,j,i,t,{cN:"class",b:"\\b(class|module)\\b",e:"$|;",k:{"class":1,module:1},c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+hljs.IR+"::)?"+hljs.IR}]},d,c,b]},e,{cN:"constant",b:"(::)?([A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:[s,r,q,o,m,l,k,j,i,t,f],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},f,{b:"("+hljs.RSR+")\\s*",c:[d,c,b,{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[hljs.BE]}],r:0}];u.c=v;e.c[1].c=v;return{dM:{l:g,k:n,c:v}}}();hljs.LANGUAGES.javascript={dM:{k:{keyword:{"in":1,"if":1,"for":1,"while":1,"finally":1,"var":1,"new":1,"function":1,"do":1,"return":1,"void":1,"else":1,"break":1,"catch":1,"instanceof":1,"with":1,"throw":1,"case":1,"default":1,"try":1,"this":1,"switch":1,"continue":1,"typeof":1,"delete":1},literal:{"true":1,"false":1,"null":1}},c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM,hljs.CNM,{b:"("+hljs.RSR+"|case|return|throw)\\s*",k:{"return":1,"throw":1,"case":1},c:[hljs.CLCM,hljs.CBLCLM,{cN:"regexp",b:"/",e:"/[gim]*",c:[{b:"\\\\/"}]}],r:0},{cN:"function",b:"\\bfunction\\b",e:"{",k:{"function":1},c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[hljs.ASM,hljs.QSM,hljs.CLCM,hljs.CBLCLM]}]}]}};hljs.LANGUAGES.css=function(){var a={cN:"function",b:hljs.IR+"\\(",e:"\\)",c:[{eW:true,eE:true,c:[hljs.NM,hljs.ASM,hljs.QSM]}]};return{cI:true,dM:{i:"[=/|']",c:[hljs.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:{"font-face":1,page:1}},{cN:"at_rule",b:"@",e:"[{;]",eE:true,k:{"import":1,page:1,media:1,charset:1},c:[a,hljs.ASM,hljs.QSM,hljs.NM]},{cN:"tag",b:hljs.IR,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[hljs.CBLCLM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[a,hljs.NM,hljs.QSM,hljs.ASM,hljs.CBLCLM,{cN:"hexcolor",b:"\\#[0-9A-F]+"},{cN:"important",b:"!important"}]}}]}]}]}}}();hljs.LANGUAGES.xml=function(){var b="[A-Za-z0-9\\._:-]+";var a={eW:true,c:[{cN:"attribute",b:b,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,dM:{c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style",e:">",k:{title:{style:1}},c:[a],starts:{cN:"css",e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script",e:">",k:{title:{script:1}},c:[a],starts:{cN:"javascript",e:"<\/script>",rE:true,sL:"javascript"}},{cN:"vbscript",b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ />]+"},a]}]}}}();hljs.LANGUAGES.java={dM:{k:{"false":1,"synchronized":1,"int":1,"abstract":1,"float":1,"private":1,"char":1,"interface":1,"boolean":1,"static":1,"null":1,"if":1,"const":1,"for":1,"true":1,"while":1,"long":1,"throw":1,strictfp:1,"finally":1,"protected":1,"extends":1,"import":1,"native":1,"final":1,"implements":1,"return":1,"void":1,"enum":1,"else":1,"break":1,"transient":1,"new":1,"catch":1,"instanceof":1,"byte":1,"super":1,"class":1,"volatile":1,"case":1,assert:1,"short":1,"package":1,"default":1,"double":1,"public":1,"try":1,"this":1,"switch":1,"continue":1,"throws":1},c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"@[A-Za-z]+"}],r:10},hljs.CLCM,hljs.CBLCLM,hljs.ASM,hljs.QSM,{cN:"class",b:"(class |interface )",e:"{",k:{"class":1,"interface":1},i:":",c:[{b:"(implements|extends)",k:{"extends":1,"implements":1},r:10},{cN:"title",b:hljs.UIR}]},hljs.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}};hljs.LANGUAGES.php={cI:true,dM:{k:{and:1,include_once:1,list:1,"abstract":1,global:1,"private":1,echo:1,"interface":1,as:1,"static":1,endswitch:1,array:1,"null":1,"if":1,endwhile:1,or:1,"const":1,"for":1,endforeach:1,self:1,"var":1,"while":1,isset:1,"public":1,"protected":1,exit:1,foreach:1,"throw":1,elseif:1,"extends":1,include:1,__FILE__:1,empty:1,require_once:1,"function":1,"do":1,xor:1,"return":1,"implements":1,parent:1,clone:1,use:1,__CLASS__:1,__LINE__:1,"else":1,"break":1,print:1,"eval":1,"new":1,"catch":1,__METHOD__:1,"class":1,"case":1,exception:1,php_user_filter:1,"default":1,die:1,require:1,__FUNCTION__:1,enddeclare:1,"final":1,"try":1,"this":1,"switch":1,"continue":1,endfor:1,endif:1,declare:1,unset:1,"true":1,"false":1,namespace:1},c:[hljs.CLCM,hljs.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+",r:10}]},hljs.CNM,hljs.inherit(hljs.ASM,{i:null}),hljs.inherit(hljs.QSM,{i:null}),{cN:"variable",b:"\\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"},{cN:"preprocessor",b:"<\\?php",r:10},{cN:"preprocessor",b:"\\?>"}]}};hljs.LANGUAGES.python=function(){var c={cN:"string",b:"(u|b)?r?'''",e:"'''",r:10};var b={cN:"string",b:'(u|b)?r?"""',e:'"""',r:10};var a={cN:"string",b:"(u|r|ur|b|br)'",e:"'",c:[hljs.BE],r:10};var f={cN:"string",b:'(u|r|ur|b|br)"',e:'"',c:[hljs.BE],r:10};var d={cN:"title",b:hljs.UIR};var e={cN:"params",b:"\\(",e:"\\)",c:[c,b,a,f,hljs.ASM,hljs.QSM]};return{dM:{k:{keyword:{and:1,elif:1,is:1,global:1,as:1,"in":1,"if":1,from:1,raise:1,"for":1,except:1,"finally":1,print:1,"import":1,pass:1,"return":1,exec:1,"else":1,"break":1,not:1,"with":1,"class":1,assert:1,yield:1,"try":1,"while":1,"continue":1,del:1,or:1,def:1,lambda:1,nonlocal:10},built_in:{None:1,True:1,False:1,Ellipsis:1,NotImplemented:1}},i:"(</|->|\\?)",c:[hljs.HCM,c,b,a,f,hljs.ASM,hljs.QSM,{cN:"function",b:"\\bdef ",e:":",i:"$",k:{def:1},c:[d,e],r:10},{cN:"class",b:"\\bclass ",e:":",i:"[${]",k:{"class":1},c:[d,e],r:10},hljs.CNM,{cN:"decorator",b:"@",e:"$"}]}}}();hljs.LANGUAGES.perl=function(){var c={getpwent:1,getservent:1,quotemeta:1,msgrcv:1,scalar:1,kill:1,dbmclose:1,undef:1,lc:1,ma:1,syswrite:1,tr:1,send:1,umask:1,sysopen:1,shmwrite:1,vec:1,qx:1,utime:1,local:1,oct:1,semctl:1,localtime:1,readpipe:1,"do":1,"return":1,format:1,read:1,sprintf:1,dbmopen:1,pop:1,getpgrp:1,not:1,getpwnam:1,rewinddir:1,qq:1,fileno:1,qw:1,endprotoent:1,wait:1,sethostent:1,bless:1,s:1,opendir:1,"continue":1,each:1,sleep:1,endgrent:1,shutdown:1,dump:1,chomp:1,connect:1,getsockname:1,die:1,socketpair:1,close:1,flock:1,exists:1,index:1,shmget:1,sub:1,"for":1,endpwent:1,redo:1,lstat:1,msgctl:1,setpgrp:1,abs:1,exit:1,select:1,print:1,ref:1,gethostbyaddr:1,unshift:1,fcntl:1,syscall:1,"goto":1,getnetbyaddr:1,join:1,gmtime:1,symlink:1,semget:1,splice:1,x:1,getpeername:1,recv:1,log:1,setsockopt:1,cos:1,last:1,reverse:1,gethostbyname:1,getgrnam:1,study:1,formline:1,endhostent:1,times:1,chop:1,length:1,gethostent:1,getnetent:1,pack:1,getprotoent:1,getservbyname:1,rand:1,mkdir:1,pos:1,chmod:1,y:1,substr:1,endnetent:1,printf:1,next:1,open:1,msgsnd:1,readdir:1,use:1,unlink:1,getsockopt:1,getpriority:1,rindex:1,wantarray:1,hex:1,system:1,getservbyport:1,endservent:1,"int":1,chr:1,untie:1,rmdir:1,prototype:1,tell:1,listen:1,fork:1,shmread:1,ucfirst:1,setprotoent:1,"else":1,sysseek:1,link:1,getgrgid:1,shmctl:1,waitpid:1,unpack:1,getnetbyname:1,reset:1,chdir:1,grep:1,split:1,require:1,caller:1,lcfirst:1,until:1,warn:1,"while":1,values:1,shift:1,telldir:1,getpwuid:1,my:1,getprotobynumber:1,"delete":1,and:1,sort:1,uc:1,defined:1,srand:1,accept:1,"package":1,seekdir:1,getprotobyname:1,semop:1,our:1,rename:1,seek:1,"if":1,q:1,chroot:1,sysread:1,setpwent:1,no:1,crypt:1,getc:1,chown:1,sqrt:1,write:1,setnetent:1,setpriority:1,foreach:1,tie:1,sin:1,msgget:1,map:1,stat:1,getlogin:1,unless:1,elsif:1,truncate:1,exec:1,keys:1,glob:1,tied:1,closedir:1,ioctl:1,socket:1,readlink:1,"eval":1,xor:1,readline:1,binmode:1,setservent:1,eof:1,ord:1,bind:1,alarm:1,pipe:1,atan2:1,getgrent:1,exp:1,time:1,push:1,setgrent:1,gt:1,lt:1,or:1,ne:1,m:1};var d={cN:"subst",b:"[$@]\\{",e:"}",k:c,r:10};var b={cN:"variable",b:"\\$\\d"};var a={cN:"variable",b:"[\\$\\%\\@\\*](\\^\\w\\b|#\\w+(\\:\\:\\w+)*|[^\\s\\w{]|{\\w+}|\\w+(\\:\\:\\w*)*)"};var g=[hljs.BE,d,b,a];var f={b:"->",c:[{b:hljs.IR},{b:"{",e:"}"}]};var e=[b,a,hljs.HCM,{cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5},f,{cN:"string",b:"q[qwxr]?\\s*\\(",e:"\\)",c:g,r:5},{cN:"string",b:"q[qwxr]?\\s*\\[",e:"\\]",c:g,r:5},{cN:"string",b:"q[qwxr]?\\s*\\{",e:"\\}",c:g,r:5},{cN:"string",b:"q[qwxr]?\\s*\\|",e:"\\|",c:g,r:5},{cN:"string",b:"q[qwxr]?\\s*\\<",e:"\\>",c:g,r:5},{cN:"string",b:"qw\\s+q",e:"q",c:g,r:5},{cN:"string",b:"'",e:"'",c:[hljs.BE],r:0},{cN:"string",b:'"',e:'"',c:g,r:0},{cN:"string",b:"`",e:"`",c:[hljs.BE]},{cN:"string",b:"{\\w+}",r:0},{cN:"string",b:"-?\\w+\\s*\\=\\>",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[hljs.BE],r:0},{cN:"sub",b:"\\bsub\\b",e:"(\\s*\\(.*?\\))?[;{]",k:{sub:1},r:5},{cN:"operator",b:"-\\w\\b",r:0},{cN:"pod",b:"\\=\\w",e:"\\=cut"}];d.c=e;f.c[1].c=e;return{dM:{k:c,c:e}}}();hljs.LANGUAGES.cpp=function(){var b={keyword:{"false":1,"int":1,"float":1,"while":1,"private":1,"char":1,"catch":1,"export":1,virtual:1,operator:2,sizeof:2,dynamic_cast:2,typedef:2,const_cast:2,"const":1,struct:1,"for":1,static_cast:2,union:1,namespace:1,unsigned:1,"long":1,"throw":1,"volatile":2,"static":1,"protected":1,bool:1,template:1,mutable:1,"if":1,"public":1,friend:2,"do":1,"return":1,"goto":1,auto:1,"void":2,"enum":1,"else":1,"break":1,"new":1,extern:1,using:1,"true":1,"class":1,asm:1,"case":1,typeid:1,"short":1,reinterpret_cast:2,"default":1,"double":1,register:1,explicit:1,signed:1,typename:1,"try":1,"this":1,"switch":1,"continue":1,wchar_t:1,inline:1,"delete":1,alignof:1,char16_t:1,char32_t:1,constexpr:1,decltype:1,noexcept:1,nullptr:1,static_assert:1,thread_local:1},built_in:{std:1,string:1,cin:1,cout:1,cerr:1,clog:1,stringstream:1,istringstream:1,ostringstream:1,auto_ptr:1,deque:1,list:1,queue:1,stack:1,vector:1,map:1,set:1,bitset:1,multiset:1,multimap:1,unordered_set:1,unordered_map:1,unordered_multiset:1,unordered_multimap:1,array:1,shared_ptr:1}};var a={cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:b,r:10};a.c=[a];return{dM:{k:b,i:"</",c:[hljs.CLCM,hljs.CBLCLM,hljs.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},hljs.CNM,{cN:"preprocessor",b:"#",e:"$"},a]}}}();
@@ -46,12 +46,7 @@
46
46
  theme: 'default', // default/neon
47
47
 
48
48
  // Transition style
49
- transition: 'default', // default/cube/page/concave/linear(2d)
50
-
51
- update: function(indexh, indexv){
52
- // update sample code so that 'height' of iframe is correct
53
- $('section.present').not('.stack').find('script[type="text/x-sample"]').sample('update');
54
- }
49
+ transition: 'default' // default/cube/page/concave/linear(2d)
55
50
  });
56
51
 
57
52
  }(jQuery));
@@ -7,31 +7,14 @@
7
7
  $codeSrc = $('<code contenteditable></code>'),
8
8
  $preSrc = $('<pre></pre>'),
9
9
  $iframeSrc = $('<div class="iframe"><iframe></iframe></div>'),
10
- $updateBtnSrc = $('<button>&raquo;</button>'),
11
-
12
- updateIframe = function(iframe, $pre, wrapper){
13
- var doc = iframe.contentDocument, newiframe,
14
- height = $pre.height() || 200;
15
- if(!doc){ // if cannot get iframe content, create a new one
16
- newiframe = $('<iframe></iframe>').insertBefore(iframe).get(0);
17
- $(iframe).remove();
18
- iframe = newiframe; doc = iframe.contentDocument;
19
- }
20
- doc.open(); doc.writeln( wrapper($pre.text()) ); doc.close();
21
- $(iframe).height(height);
22
-
23
- // highligt the code
24
- var $code = $pre.find('code'), // get $code to get unhighlighted text
25
- ret = hljs.highlightAuto($code.text());
26
- $code.html(ret.value);
27
- $code.addClass(ret.language)
28
-
29
- return iframe; // return the (possibly new) iframe
30
- };
10
+ $updateBtnSrc = $('<button>&raquo;</button>');
31
11
 
32
12
  // example usage:
33
13
  // $('script[type=text/x-sample]').sample();
34
14
  //
15
+ // <script> tags within <script type="text/x-sample"> should be written as
16
+ // &lt;script&gt;
17
+ //
35
18
  $.fn.sample = function(options){
36
19
  // 'this' should be <script> jQuery object
37
20
  //
@@ -49,13 +32,45 @@
49
32
  options = $.extend({
50
33
  wrapper: function(lines){ // default wrapper: no-op
51
34
  return lines;
52
- }
35
+ },
36
+ preview: true
53
37
  }, options);
54
38
 
39
+ // update Iframe
40
+ var updateIframe = function(iframe, $pre, wrapper, lang){
41
+ if(!options.preview){
42
+ return;
43
+ }
44
+ var doc = iframe.contentDocument, newiframe,
45
+ height = $pre.height() || 200;
46
+ if(!doc){ // if cannot get iframe content, create a new one
47
+ newiframe = $('<iframe></iframe>').insertBefore(iframe).get(0);
48
+ $(iframe).remove();
49
+ iframe = newiframe; doc = iframe.contentDocument;
50
+ }
51
+ doc.open(); doc.writeln( wrapper($pre.text()) ); doc.close();
52
+ $(iframe).height(height);
53
+
54
+ // highligt the code
55
+ var $code = $pre.find('code'), ret // get $code to get unhighlighted text
56
+ if(lang){
57
+ ret = hljs.highlight(lang, $code.text());
58
+ }else{
59
+ ret = hljs.highlightAuto($code.text());
60
+ }
61
+ $code.html(ret.value);
62
+ $code.addClass(ret.language)
63
+
64
+ return iframe; // return the (possibly new) iframe
65
+ };
66
+
67
+
68
+
55
69
  this.each(function(){
56
70
  var
57
71
  indent = 100, // shortest indent
58
- lines = $(this).html().split('\n'); // lines of code
72
+ lines = $(this).html().split('\n'),// lines of code
73
+ lang = $(this).data('lang');
59
74
 
60
75
  // finding indent
61
76
  $.each(lines, function(){
@@ -81,6 +96,8 @@
81
96
  // join lines
82
97
  lines = lines.join('\n');
83
98
 
99
+ // substitute escaped <script> and </script> tags
100
+ lines = lines.replace(/&lt;(\/?script.*?)&gt;/g, "<$1>");
84
101
 
85
102
  // output stage
86
103
  //
@@ -98,23 +115,28 @@
98
115
  // previewing iframe
99
116
  var iframe = $iframeSrc.clone().appendTo($sampleContainer).find('iframe').get(0);
100
117
  $(iframe).ready(function(){
101
- updateIframe(iframe, $pre, options.wrapper);
118
+ updateIframe(iframe, $pre, options.wrapper, lang);
102
119
  });
103
120
 
104
121
  // update button
105
122
  var $updateBtn = $updateBtnSrc.clone().insertAfter($pre);
106
123
  $updateBtn.click(function(){
107
124
  // updating iframe and highlight the $pre again
108
- iframe = updateIframe(iframe, $pre, options.wrapper);
125
+ iframe = updateIframe(iframe, $pre, options.wrapper, lang);
109
126
  });
110
127
 
111
128
 
129
+ // intercept scroll within the plugin
130
+ $pre.on('mousewheel DOMMouseScroll', function(e){
131
+ e.stopPropagation();
132
+ });
133
+
112
134
  // install methods to data('sample')
113
135
  $(this).data('sample', {
114
136
  update: function(){
115
- iframe = updateIframe(iframe, $pre, options.wrapper);
137
+ iframe = updateIframe(iframe, $pre, options.wrapper, lang);
116
138
  }
117
139
  });
118
140
  });
119
141
  }
120
- }(jQuery));
142
+ }(jQuery));
@@ -1,84 +1,53 @@
1
- :title 學 CSS
1
+ :title Vebdew
2
2
 
3
- :description 不囉唆學 CSS。以 reveal.js 製作的 HTML / CSS / JS 投影片。
4
- :author MrOrz
5
- :email johnsonliang7@gmail.com
3
+ :description A Simple HTML5 Slide Generator
4
+ :author Andrew Liu
5
+ :email andrewliu33@gmail.com
6
6
 
7
- :stylesheet_link_tag css/main.css, css/style.css, css/sample.css, css/jquery-ui.css
8
- :stylesheet_link_tag css/ruler.css, css/zenburn.css
7
+ :stylesheet_link_tag css/main.css, css/style.css, css/sample.css
8
+ :stylesheet_link_tag css/zenburn.css
9
9
 
10
- :javascript_include_tag js/jquery.min.js
11
- :javascript_include_tag https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js
12
- :javascript_include_tag js/reveal.js, lib/highlight.js, js/ruler.js, js/sample.js
10
+ :javascript_include_tag js/jquery.min.js, js/reveal.js, js/highlight.js, js/sample.js
13
11
  :javascript_include_tag js/init.js, js/index.js
14
12
 
15
13
  !SLIDE
16
14
 
17
- CSS
15
+ Vebdew
18
16
  ===
19
17
  {:.nav}
20
- * [html.html](HTML)
21
- * Javascript
18
+ * Simple
19
+ * HTML generator
22
20
 
23
21
  !STACK
24
22
 
25
23
  !SLIDE
26
- 長這樣
27
- -----
28
- {:.nopreview}
29
- ~~~
30
- html, body {
31
- position: relative;
32
- padding: 0; margin: 0;
33
- overflow: hidden;
34
- font-family: '文泉驛微米黑', 'LiHei Pro', '微軟正黑體';
35
- font-weight: 200;
36
- letter-spacing: -0.02em;
37
- color: #eee; width: 100%; height: 100%;
38
- min-height: 400px;
39
- }
40
-
41
- table {
42
- border-collapse: collapse;
43
- border-spacing: 0;
44
- }
45
- ~~~
24
+ A Stack of slides
25
+ -----------------
26
+ * Show these
27
+ * In the same time
28
+ ** And then show this
46
29
 
47
30
  !SLIDE
48
- CSS Syntax
49
- ---
31
+ Image and Links
32
+ ---------------
50
33
 
51
- ![images/css/selector.gif](Selection and declaration)
52
-
53
- [http://w3schools.com/css/css_syntax.asp](Source: W3Schools)
34
+ ![http://s3.amazonaws.com/hakim-static/portfolio/images/rvl-js.jpg](reveal.js)
54
35
 
36
+ Powered by [http://lab.hakim.se/reveal-js/](reveal.js)
55
37
 
56
38
  !SLIDE
57
- 怎麼加進 HTML
58
- ------------
59
-
60
- 在 `<head>` 中加入
61
-
39
+ You can show code too!
40
+ ----------------------
62
41
  {:.nopreview}
63
- ~~~~~~~
64
- <link rel="stylesheet" type="text/css" href="path/to/style.css">
65
- ~~~~~~~
66
-
67
- 或直接把 CSS 寫在 `<style>` 裡;
68
-
69
- ~~~~~~~
70
- <style type="text/css">
71
- div {
72
- color: blue;
73
- }
74
- </style>
75
- <div>I am div!</div>
76
- ~~~~~~~
77
-
78
- `<style>` 可放在 `<head>` 或 `<body>` 均可。
42
+ ~~~
43
+ table {
44
+ border-collapse: collapse;
45
+ border-spacing: 0;
46
+ }
47
+ ~~~
79
48
 
80
49
  !ENDSTACK
81
50
 
82
- !SLIDE.chapter#attribute
83
- CSS Selectors
84
- ---
51
+ !SLIDE
52
+ Vebdew
53
+ ======