Skip to content
Browse files

First version of the documentation

  • Loading branch information...
1 parent 81b8849 commit 4ee6db1d43725a732e3c6a969a068dffcd56527f dfrancisco committed
Showing with 254 additions and 0 deletions.
  1. +63 −0 README.html
  2. +38 −0 README.textile
  3. +153 −0 javascripts/textile.js
View
63 README.html
@@ -0,0 +1,63 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+
+ <!-- This file uses a javascript library to convert the 'readme.textile' file to html -->
+
+ <title> </title>
+
+ <!-- Some CSS -->
+ <style>
+ body { padding-left:25px; font-family:Helvetica,Arial,sans-serif; font-size:10pt; width:860px; }
+ a { color: black; }
+ p { margin-top: 7px; margin-bottom: 7px; }
+ h1 { padding-top:25px; padding-bottom:10px; }
+ h2 { padding-top:25px; text-decoration: underline; }
+ li { list-style: none; }
+ img { -webkit-box-shadow:0 1px 3px rgba(0, 0, 0, 0.4); -moz-box-shadow:0 1px 3px rgba(0, 0, 0, 0.4);
+ box-shadow:0 1px 3px rgba(0, 0, 0, 0.4); margin-top: 10px; margin-bottom: 10px; }
+ #preview { height:100%; }
+ </style>
+
+ <script src="javascripts/textile.js"></script>
+ <script language="javascript">
+ var filename = "README.textile" // Change the source file here
+
+ function do_convert(html) {
+ document.getElementById('preview').innerHTML = convert(html);
+ }
+
+ var http = createRequestObject();
+
+ function createRequestObject() {
+ if (navigator.appName == "Microsoft Internet Explorer")
+ return new ActiveXObject("Microsoft.XMLHTTP");
+ else
+ return new XMLHttpRequest();
+ }
+
+ function getNewContent() {
+ http.open('get', filename);
+ http.onreadystatechange = updateNewContent;
+ http.send(null);
+ return false;
+ }
+
+ function updateNewContent() {
+ if (http.readyState == 4)
+ do_convert(http.responseText);
+ }
+
+ getNewContent();
+ updateNewContent();
+ </script>
+</head>
+
+<body>
+ <h1><img src="http://dl.dropbox.com/u/1745359/activo/logo.png" style="margin-top:0px;margin-bottom:0px;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;" /> is a theme for <em>Web-app-theme</em>, <em>Formtastic</em> and <em>Attrtastic</em> *</h1>
+ <div id="preview"></div>
+</body>
+
+</html>
View
38 README.textile
@@ -0,0 +1,38 @@
+
+p. Activo was originally developed as a theme for the web-app-theme plugin. It was extended and now includes two extra stylesheets - one for formtastic and the other for attrtastic. It also has a seamless style for the jQuery DatePicker plugin. You should use only the ones you need.
+
+!http://dl.dropbox.com/u/1745359/activo/1.jpg!
+
+!http://dl.dropbox.com/u/1745359/activo/2.jpg!
+
+!http://dl.dropbox.com/u/1745359/activo/3.jpg!
+
+!http://dl.dropbox.com/u/1745359/activo/4.jpg!
+
+p. * "Web App Theme":http://github.com/pilu/web-app-theme is a Rails plugin that generates a complete web application layout.
+p. * "Formtastic":http://github.com/justinfrench/formtastic makes things easier to create HTML forms in your Rails applications.
+p. * "Attrtastic":http://github.com/MBO/attrtastic is similar in usage to formtastic and ease of displaying AR record informations. It helps creating show/index pages.
+
+
+h2. Main contents
+
+
+p. +stylesheets+
+
+* +base.css+: This is an untouched copy of the web-app-theme main stylesheet, downloaded from its "main repository":http://github.com/pilu/web-app-theme
+
+* +activo+
+** +activo.sass+: Stylesheet of the theme that should be compiled to the activo.css file.
+** +activo.css+: Compiled version of activo.sass.
+
+* +activo-attrtastic+
+** +attrtastic_changes.css+: Stylesheet of the theme for the attrtastic plugin.
+
+* +activo-formtastic+
+** +formtastic_changes.css+: Stylesheet of the theme for the formtastic plugin.
+
+
+h2.
+
+p. 2010 David Francisco, released under the MIT license.
+p.
View
153 javascripts/textile.js
@@ -0,0 +1,153 @@
+/***************************************
+*
+* Javascript Textile->HTML conversion
+*
+* ben@ben-daglish.net (with thanks to John Hughes for improvements)
+* Issued under the "do what you like with it - I take no respnsibility" licence
+****************************************/
+
+var inpr,inbq,inbqq,html;
+var aliases = new Array;
+var alg={'>':'right','<':'left','=':'center','<>':'justify','~':'bottom','^':'top'};
+var ent={"'":"&#8217;"," - ":" &#8211; ","--":"&#8212;"," x ":" &#215; ","\\.\\.\\.":"&#8230;","\\(C\\)":"&#169;","\\(R\\)":"&#174;","\\(TM\\)":"&#8482;"};
+var tags={"b":"\\*\\*","i":"__","em":"_","strong":"\\*","cite":"\\?\\?","sup":"\\^","sub":"~","span":"\\%","del":"-","code":"@","ins":"\\+","del":"-"};
+var le="\n\n";
+var lstlev=0,lst="",elst="",intable=0,mm="";
+var para = /^p(\S*)\.\s*(.*)/;
+var rfn = /^fn(\d+)\.\s*(.*)/;
+var bq = /^bq\.(\.)?\s*/;
+var table=/^table\s*{(.*)}\..*/;
+var trstyle = /^\{(\S+)\}\.\s*\|/;
+
+function convert(t) {
+ var lines = t.split(/\r?\n/);
+ html="";
+ inpr=inbq=inbqq=0;
+ for(var i=0;i<lines.length;i++) {
+ if(lines[i].indexOf("[") == 0) {
+ var m = lines[i].indexOf("]");
+ aliases[lines[i].substring(1,m)]=lines[i].substring(m+1);
+ }
+ }
+ for(i=0;i<lines.length;i++) {
+ if (lines[i].indexOf("[") == 0) {continue;}
+ if(mm=para.exec(lines[i])){stp(1);inpr=1;html += lines[i].replace(para,"<p"+make_attr(mm[1])+">"+prep(mm[2]));continue;}
+ if(mm = /^h(\d)(\S*)\.\s*(.*)/.exec(lines[i])){stp(1);html += tag("h"+mm[1],make_attr(mm[2]),prep(mm[3]))+le;continue;}
+ if(mm=rfn.exec(lines[i])){stp(1);inpr=1;html+=lines[i].replace(rfn,'<p id="fn'+mm[1]+'"><sup>'+mm[1]+'<\/sup>'+prep(mm[2]));continue;}
+ if (lines[i].indexOf("*") == 0) {lst="<ul>";elst="<\/ul>";}
+ else if (lines[i].indexOf("#") == 0) {lst="<\ol>";elst="<\/ol>";}
+ else {while (lstlev > 0) {html += elst;if(lstlev > 1){html += "<\/li>";}else{html+="\n";}html+="\n";lstlev--;}lst="";}
+ if(lst) {
+ stp(1);
+ var m = /^([*#]+)\s*(.*)/.exec(lines[i]);
+ var lev = m[1].length;
+ while(lev < lstlev) {html += elst+"<\/li>\n";lstlev--;}
+ while(lstlev < lev) {html=html.replace(/<\/li>\n$/,"\n");html += lst;lstlev++;}
+ html += tag("li","",prep(m[2]))+"\n";
+ continue;
+ }
+ if (lines[i].match(table)){stp(1);intable=1;html += lines[i].replace(table,'<table style="$1;">\n');continue;}
+ if ((lines[i].indexOf("|") == 0) || (lines[i].match(trstyle)) ) {
+ stp(1);
+ if(!intable) {html += "<table>\n";intable=1;}
+ var rowst="";var trow="";
+ var ts=trstyle.exec(lines[i]);
+ if(ts){rowst=qat('style',ts[1]);lines[i]=lines[i].replace(trstyle,"\|");}
+ var cells = lines[i].split("|");
+ for(j=1;j<cells.length-1;j++) {
+ var ttag="td";
+ if(cells[j].indexOf("_.")==0) {ttag="th";cells[j]=cells[j].substring(2);}
+ cells[j]=prep(cells[j]);
+ var al=/^([<>=^~\/\\\{]+.*?)\.(.*)/.exec(cells[j]);
+ var at="",st="";
+ if(al != null) {
+ cells[j]=al[2];
+ var cs= /\\(\d+)/.exec(al[1]);if(cs != null){at +=qat('colspan',cs[1]);}
+ var rs= /\/(\d+)/.exec(al[1]);if(rs != null){at +=qat('rowspan',rs[1]);}
+ var va= /([\^~])/.exec(al[1]);if(va != null){st +="vertical-align:"+alg[va[1]]+";";}
+ var ta= /(<>|=|<|>)/.exec(al[1]);if(ta != null){st +="text-align:"+alg[ta[1]]+";";}
+ var is= /\{([^\}]+)\}/.exec(al[1]);if(is != null){st +=is[1];}
+ if(st != ""){at+=qat('style',st);}
+ }
+ trow += tag(ttag,at,cells[j]);
+ }
+ html += "\t"+tag("tr",rowst,trow)+"\n";
+ continue;
+ }
+ if(intable) {html += "<\/table>"+le;intable=0;}
+
+ if (lines[i]=="") {stp();}
+ else if (!inpr) {
+ if(mm=bq.exec(lines[i])){lines[i]=lines[i].replace(bq,"");html +="<blockquote>";inbq=1;if(mm[1]) {inbqq=1;}}
+ html += "<p>"+prep(lines[i]);inpr=1;
+ }
+ else {html += prep(lines[i]);}
+ }
+ stp();
+ return html;
+}
+
+function prep(m){
+ for(i in ent) {m=m.replace(new RegExp(i,"g"),ent[i]);}
+ for(i in tags) {
+ m = make_tag(m,RegExp("^"+tags[i]+"(.+?)"+tags[i]),i,"");
+ m = make_tag(m,RegExp(" "+tags[i]+"(.+?)"+tags[i]),i," ");
+ }
+ m=m.replace(/\[(\d+)\]/g,'<sup><a href="#fn$1">$1<\/a><\/sup>');
+ m=m.replace(/([A-Z]+)\((.*?)\)/g,'<acronym title="$2">$1<\/acronym>');
+ m=m.replace(/\"([^\"]+)\":((http|https|mailto):\S+)/g,'<a href="$2">$1<\/a>');
+ m = make_image(m,/!([^!\s]+)!:(\S+)/);
+ m = make_image(m,/!([^!\s]+)!/);
+ m=m.replace(/"([^\"]+)":(\S+)/g,function($0,$1,$2){return tag("a",qat('href',aliases[$2]),$1)});
+ m=m.replace(/(=)?"([^\"]+)"/g,function($0,$1,$2){return ($1)?$0:"&#8220;"+$2+"&#8221;"});
+ return m;
+}
+
+function make_tag(s,re,t,sp) {
+ while(m = re.exec(s)) {
+ var st = make_attr(m[1]);
+ m[1]=m[1].replace(/^[\[\{\(]\S+[\]\}\)]/g,"");
+ m[1]=m[1].replace(/^[<>=()]+/,"");
+ s = s.replace(re,sp+tag(t,st,m[1]));
+ }
+ return s;
+}
+
+function make_image(m,re) {
+ var ma = re.exec(m);
+ if(ma != null) {
+ var attr="";var st="";
+ var at = /\((.*)\)$/.exec(ma[1]);
+ if(at != null) {attr = qat('alt',at[1])+qat("title",at[1]);ma[1]=ma[1].replace(/\((.*)\)$/,"");}
+ if(ma[1].match(/^[><]/)) {st = "float:"+((ma[1].indexOf(">")==0)?"right;":"left;");ma[1]=ma[1].replace(/^[><]/,"");}
+ var pdl = /(\(+)/.exec(ma[1]);if(pdl){st+="padding-left:"+pdl[1].length+"em;";}
+ var pdr = /(\)+)/.exec(ma[1]);if(pdr){st+="padding-right:"+pdr[1].length+"em;";}
+ if(st){attr += qat('style',st);}
+ var im = '<img src="'+ma[1]+'"'+attr+" />";
+ if(ma.length >2) {im=tag('a',qat('href',ma[2]),im);}
+ m = m.replace(re,im);
+ }
+ return m;
+}
+
+function make_attr(s) {
+ var st="";var at="";
+ if(!s){return "";}
+ var l=/\[(\w\w)\]/.exec(s);
+ if(l != null) {at += qat('lang',l[1]);}
+ var ci=/\((\S+)\)/.exec(s);
+ if(ci != null) {
+ s = s.replace(/\((\S+)\)/,"");
+ at += ci[1].replace(/#(.*)$/,' id="$1"').replace(/^(\S+)/,' class="$1"');
+ }
+ var ta= /(<>|=|<|>)/.exec(s);if(ta){st +="text-align:"+alg[ta[1]]+";";}
+ var ss=/\{(\S+)\}/.exec(s);if(ss){st += ss[1];if(!ss[1].match(/;$/)){st+= ";";}}
+ var pdl = /(\(+)/.exec(s);if(pdl){st+="padding-left:"+pdl[1].length+"em;";}
+ var pdr = /(\)+)/.exec(s);if(pdr){st+="padding-right:"+pdr[1].length+"em;";}
+ if(st) {at += qat('style',st);}
+ return at;
+}
+
+function qat(a,v){return ' '+a+'="'+v+'"';}
+function tag(t,a,c) {return "<"+t+a+">"+c+"</"+t+">";}
+function stp(b){if(b){inbqq=0;}if(inpr){html+="<\/p>"+le;inpr=0;}if(inbq && !inbqq){html+="<\/blockquote>"+le;inbq=0;}}

0 comments on commit 4ee6db1

Please sign in to comment.
Something went wrong with that request. Please try again.