Initial import of stiki, the STasis wIKI.
This commit is contained in:
parent
0a551720c8
commit
3c4c4f0916
7 changed files with 916 additions and 0 deletions
43
src/apps/stiki/README.apache
Normal file
43
src/apps/stiki/README.apache
Normal file
|
@ -0,0 +1,43 @@
|
|||
There are a few apache configuration changes that you'll need to make:
|
||||
|
||||
# Set up FastCGI
|
||||
|
||||
Only one copy of stiki may be running at once. Stiki uses FastCGI for
|
||||
*correctness*, not performance.
|
||||
|
||||
Here's my /etc/apache2/mods-enabled/fastcgi.conf:
|
||||
|
||||
<IfModule mod_fastcgi.c>
|
||||
AddHandler fastcgi-script .fcgi
|
||||
#FastCgiWrapper /usr/lib/apache2/suexec
|
||||
FastCgiIpcDir /var/lib/apache2/fastcgi
|
||||
FastCgiServer /var/www/cgi-bin/stiki/index.fcgi -processes 1
|
||||
</IfModule>
|
||||
|
||||
and fastcgi.load:
|
||||
|
||||
LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so
|
||||
|
||||
# Set up mod_rewrite:
|
||||
|
||||
<Directory /var/www/stiki>
|
||||
Options FollowSymLinks
|
||||
RewriteEngine On
|
||||
RewriteBase /stiki
|
||||
RewriteRule (.*) /cgi-bin/stiki/index.fcgi?get=$1
|
||||
</Directory>
|
||||
|
||||
# Compile Stasis.pm
|
||||
|
||||
## Make sure you have no extra copies of libstasis.so laying around in
|
||||
your global path, and then set the environment varibale in index.fcgi
|
||||
accordingly.
|
||||
|
||||
## chown -R www-data.www-data /var/www/cgi-bin/stiki
|
||||
|
||||
www-data must be able to write to this directory, or compilation will
|
||||
fail.
|
||||
|
||||
## 'su - www-data', then './index.fcgi' in its installation directory.
|
||||
|
||||
With any luck, you now have a working Stiki installation.
|
50
src/apps/stiki/about.stiki
Normal file
50
src/apps/stiki/about.stiki
Normal file
|
@ -0,0 +1,50 @@
|
|||
= About Stiki
|
||||
Stiki is a proof-of-concept wiki based on [[http://cs.berkeley.edu/~sears/stasis|Stasis]]. It is designed for server side simplicity, and is the first application built using Stasis' Perl bindings.
|
||||
|
||||
Stiki makes use of a client-side JavaScript [[http://www.ivan.fomichev.name/2008/04/javascript-creole-10-wiki-markup-parser.html|implementation]] implementation of the [[WikiCreole:Main|Creole 1.0]] wiki markup language.
|
||||
|
||||
Here is the Stiki server's source code:
|
||||
|
||||
{{{
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use Stasis;
|
||||
use Carp;
|
||||
use CGI::Fast;
|
||||
|
||||
sub bootstrap {
|
||||
my $xid = Stasis::Tbegin();
|
||||
my $rid;
|
||||
if(Stasis::TrecordType($xid, Stasis::ROOT_RID()) == Stasis::INVALID_SLOT()) {
|
||||
$rid = Stasis::ThashCreate($xid);
|
||||
} else {
|
||||
$rid = Stasis::ROOT_RID();
|
||||
}
|
||||
Stasis::Tcommit($xid);
|
||||
return $rid;
|
||||
}
|
||||
|
||||
Stasis::Tinit();
|
||||
my $hash = bootstrap();
|
||||
|
||||
while(my $q = new CGI::Fast()) {
|
||||
my $pagename = $q->param('set') || $q->param('get') || 'Main';
|
||||
|
||||
if($q->param('set')) {
|
||||
my $xid = Stasis::Tbegin();
|
||||
Stasis::ThashInsert(($xid, $hash, $pagename, $q->param('content')));
|
||||
print $q->redirect("/stiki/$pagename");
|
||||
} else {
|
||||
my $template = `cat creole-test.html`;
|
||||
my $content = Stasis::ThashLookup(-1, $hash, $pagename) ||
|
||||
"= $pagename\nClick edit (on the right) to create this new page);";
|
||||
$template =~ s/__TITLE__/$pagename/g;
|
||||
$template =~ s/__CONTENT__/$content/g;
|
||||
print $q->header . $template;
|
||||
}
|
||||
}
|
||||
|
||||
Stasis::Tdeinit();
|
||||
|
||||
}}}
|
||||
|
107
src/apps/stiki/cgi-bin/creole-test.html
Normal file
107
src/apps/stiki/cgi-bin/creole-test.html
Normal file
|
@ -0,0 +1,107 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang="en" lang="en">
|
||||
<!-- xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'-->
|
||||
<head>
|
||||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
|
||||
<title>__TITLE__</title>
|
||||
<link href="/stiki-site/stiki.css" title="normal-page" type="text/css" rel="Stylesheet" media="screen"/>
|
||||
</head>
|
||||
<body>
|
||||
<table class="tbl" border ='0' width='100%'>
|
||||
<tr class="tbl">
|
||||
<th colspan='2' class="titlebar">
|
||||
<div class="titlebar"><div id='pagename' class="pagename">__TITLE__</div>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td class="sidebar">
|
||||
<div id='sidebar' class ="menu">
|
||||
<img src='http://tardis.cs.berkeley.edu/tardis.png' alt='Tardis'/>
|
||||
<ul class="menusection">
|
||||
<li><a class="menuitem" href="/stiki/Main">Main</a></li>
|
||||
<li><a class="menuitem" href="/stiki/About">About</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</td><td class='tbl'>
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
var toggleDisplay = function(id) {
|
||||
var it = $(id);
|
||||
if(it.style.display=='none') {
|
||||
it.style.display = 'inline';
|
||||
} else{
|
||||
it.style.display = 'none';
|
||||
}
|
||||
}
|
||||
--></script>
|
||||
|
||||
<div class="editbutton" id="editbutton" onclick="toggleDisplay('editform');">Edit</div>
|
||||
<form id='editform' action="/cgi-bin/stiki/index.fcgi">
|
||||
<p>
|
||||
<input type="hidden" name="set" value="__TITLE__"/>
|
||||
<textarea class="editbox" id="wikitext" name="content" rows="10" cols="72">
|
||||
__CONTENT__
|
||||
</textarea>
|
||||
|
||||
<input class="editsubmit" type="submit" value="Save"/>
|
||||
</p>
|
||||
|
||||
</form>
|
||||
<div class='bodytext' id="demo"></div>
|
||||
|
||||
<script type="text/javascript" src="/stiki-site/codeholic-creole-1.0.js"/>
|
||||
|
||||
<script id="go" type="text/javascript"><!--//--></script>
|
||||
|
||||
<script type="text/javascript"><!--
|
||||
|
||||
function $(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
var input = $('wikitext');
|
||||
var demo = $('demo');
|
||||
// eval(decodeEntities($('parser').innerHTML));
|
||||
var creole = new Parse.Simple.Creole( {
|
||||
interwiki: {
|
||||
WikiCreole: 'http://www.wikicreole.org/wiki/',
|
||||
Wikipedia: 'http://en.wikipedia.org/wiki/'
|
||||
},
|
||||
linkFormat: ''
|
||||
} );
|
||||
|
||||
var render = function() {
|
||||
demo.innerHTML = '';
|
||||
creole.parse(demo, input.value);
|
||||
};
|
||||
|
||||
var renderIt = function(id) {
|
||||
var it = $(id);
|
||||
var ittxt = it.innerHTML;
|
||||
it.innerHTML = '';
|
||||
creole.parse(it,ittxt);
|
||||
}
|
||||
|
||||
var renderOnce = function() {
|
||||
// renderIt('sidebar');
|
||||
// renderIt('pagename');
|
||||
}
|
||||
|
||||
input.onkeyup = function() {
|
||||
render();
|
||||
};
|
||||
|
||||
toggleDisplay('editform');
|
||||
renderOnce();
|
||||
render();
|
||||
|
||||
--></script>
|
||||
|
||||
|
||||
</td></tr></table>
|
||||
</body>
|
||||
</html>
|
||||
|
45
src/apps/stiki/cgi-bin/index.fcgi
Executable file
45
src/apps/stiki/cgi-bin/index.fcgi
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/perl -w
|
||||
BEGIN {
|
||||
$ENV{STASIS_DIR}="/home/sears/stasis";
|
||||
}
|
||||
use strict;
|
||||
use Stasis;
|
||||
use Carp;
|
||||
use CGI::Fast;
|
||||
|
||||
sub bootstrap {
|
||||
my $xid = Stasis::Tbegin();
|
||||
my $rid;
|
||||
if(Stasis::TrecordType($xid, Stasis::ROOT_RID())
|
||||
== Stasis::INVALID_SLOT()) {
|
||||
$rid = Stasis::ThashCreate($xid);
|
||||
} else {
|
||||
$rid = Stasis::ROOT_RID();
|
||||
}
|
||||
Stasis::Tcommit($xid);
|
||||
return $rid;
|
||||
}
|
||||
|
||||
Stasis::Tinit();
|
||||
my $hash = bootstrap();
|
||||
|
||||
while(my $q = new CGI::Fast()) {
|
||||
my $pagename = $q->param('set') || $q->param('get') || 'Main';
|
||||
|
||||
if($q->param('set')) {
|
||||
my $xid = Stasis::Tbegin();
|
||||
Stasis::ThashInsert(($xid, $hash, $pagename, $q->param('content')));
|
||||
print $q->redirect("/stiki/$pagename");
|
||||
Stasis::Tcommit($xid);
|
||||
} else {
|
||||
my $template = `cat creole-test.html`;
|
||||
my $content = Stasis::ThashLookup(-1, $hash, $pagename) ||
|
||||
"= $pagename\nClick edit (on the right) to create this new page);";
|
||||
$template =~ s/__TITLE__/$pagename/g;
|
||||
$template =~ s/__CONTENT__/$content/g;
|
||||
print $q->header . $template;
|
||||
}
|
||||
}
|
||||
|
||||
Stasis::Tdeinit();
|
||||
|
118
src/apps/stiki/creole-test.stiki
Normal file
118
src/apps/stiki/creole-test.stiki
Normal file
|
@ -0,0 +1,118 @@
|
|||
= Introduction to Creole
|
||||
What you see is a **live** demonstration of [[WikiCreole:Creole1.0|Creole 1.0]] parser, written entirely in [[Wikipedia:JavaScript|JavaScript]]. Creole is a wiki markup language, intended to be a cross standard for various wiki markup dialects.
|
||||
|
||||
* Modifying the text in the textarea below results in instant rendering XHTML without page reload.
|
||||
* Try it //right now//!
|
||||
|
||||
See [[WikiCreole:CheatSheet|Creole 1.0 Cheat Sheet]] for editing tips.
|
||||
|
||||
= Creole CSS formatting tests
|
||||
== H2
|
||||
=== H3
|
||||
==== H4
|
||||
===== H5
|
||||
====== H6
|
||||
|
||||
# //italic//
|
||||
# **bold**
|
||||
## //**bold italic**//
|
||||
|
||||
* [[wikipage]]
|
||||
* [[http://www.google.com|google]]
|
||||
** [[Wikipedia:wikipedia]]
|
||||
** [[Stiki:Goo|Goo]]
|
||||
|
||||
||Table||Table|
|
||||
|-||-|
|
||||
|Foo bar baz||This is a table, and is poorly formatted.|
|
||||
|
||||
new\\line
|
||||
|
||||
|=Header 1|=Header 2|=Header 3|
|
||||
|A|B|C|
|
||||
|1|2|3|
|
||||
| |THIS IS SOME\\LONG THING| woot!
|
||||
|
||||
{{{
|
||||
==[[I see non-wiki code!!]]==
|
||||
<a href="http://i.like.spam/"><BLINK><BlInK>CLICK ME<BlInK></BLINK></a>
|
||||
}}}
|
||||
|
||||
== List abuse:
|
||||
|
||||
# X
|
||||
# X
|
||||
# X
|
||||
## Y
|
||||
## Y
|
||||
## Y
|
||||
### Z
|
||||
### Z
|
||||
### Z
|
||||
### Z
|
||||
### Z
|
||||
### Z
|
||||
### Z
|
||||
### Z
|
||||
### Z
|
||||
#### a
|
||||
#### a
|
||||
#### a
|
||||
#### a
|
||||
#### a
|
||||
#### a
|
||||
#### a
|
||||
#### a
|
||||
#### a
|
||||
##### cjk
|
||||
##### b
|
||||
##### b
|
||||
##### b
|
||||
##### b
|
||||
##### b
|
||||
##### b
|
||||
##### b
|
||||
##### b
|
||||
##### b
|
||||
##### b
|
||||
###### georgian
|
||||
###### b
|
||||
###### b
|
||||
###### b
|
||||
###### b
|
||||
###### b
|
||||
###### b
|
||||
###### b
|
||||
###### b
|
||||
###### b
|
||||
###### b
|
||||
####### Hebrew
|
||||
####### b
|
||||
####### b
|
||||
####### b
|
||||
####### b
|
||||
####### b
|
||||
####### b
|
||||
####### b
|
||||
####### b
|
||||
####### b
|
||||
####### b
|
||||
######## armenian
|
||||
######## b
|
||||
######## b
|
||||
######## b
|
||||
######## b
|
||||
######## b
|
||||
######## b
|
||||
######## b
|
||||
######## b
|
||||
######## b
|
||||
######## b
|
||||
######## b
|
||||
######## b
|
||||
|
||||
|
||||
----
|
||||
|
||||
{{http://tardis.cs.berkeley.edu/tardis.png|External image}}
|
||||
|
348
src/apps/stiki/stiki-site/codeholic-creole-1.0.js
Normal file
348
src/apps/stiki/stiki-site/codeholic-creole-1.0.js
Normal file
|
@ -0,0 +1,348 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Ivan Fomichev
|
||||
*
|
||||
* Portions Copyright (c) 2007 Chris Purcell
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
if (!Parse) { var Parse = {}; }
|
||||
if (!Parse.Simple) { Parse.Simple = {}; }
|
||||
|
||||
Parse.Simple.Base = function(root, options) {
|
||||
if (!arguments.length) { return; }
|
||||
|
||||
this.root = new this.ruleConstructor(root);
|
||||
this.options = options;
|
||||
};
|
||||
|
||||
Parse.Simple.Base.prototype = {
|
||||
ruleConstructor: null,
|
||||
root: null,
|
||||
options: null,
|
||||
|
||||
parse: function(node, data, options) {
|
||||
if (options) {
|
||||
for (i in this.options) {
|
||||
if (typeof options[i] == 'undefined') { options[i] = this.options[i]; }
|
||||
}
|
||||
}
|
||||
else {
|
||||
options = this.options;
|
||||
}
|
||||
this.root.apply(node, data, options);
|
||||
}
|
||||
};
|
||||
|
||||
Parse.Simple.Base.prototype.constructor = Parse.Simple.Base;
|
||||
|
||||
Parse.Simple.Base.Rule = function(params) {
|
||||
if (!arguments.length) { return; }
|
||||
|
||||
for (var p in params) { this[p] = params[p]; }
|
||||
if (!this.children) { this.children = []; }
|
||||
};
|
||||
|
||||
Parse.Simple.Base.prototype.ruleConstructor = Parse.Simple.Base.Rule;
|
||||
|
||||
Parse.Simple.Base.Rule.prototype = {
|
||||
regex: null,
|
||||
capture: null,
|
||||
replaceRegex: null,
|
||||
replaceString: null,
|
||||
tag: null,
|
||||
attrs: null,
|
||||
children: null,
|
||||
|
||||
match: function(data, options) {
|
||||
return data.match(this.regex);
|
||||
},
|
||||
|
||||
build: function(node, r, options) {
|
||||
var data;
|
||||
if (this.capture !== null) {
|
||||
data = r[this.capture];
|
||||
}
|
||||
|
||||
var target;
|
||||
if (this.tag) {
|
||||
target = document.createElement(this.tag);
|
||||
node.appendChild(target);
|
||||
}
|
||||
else { target = node; }
|
||||
|
||||
if (data) {
|
||||
if (this.replaceRegex) {
|
||||
data = data.replace(this.replaceRegex, this.replaceString);
|
||||
}
|
||||
this.apply(target, data, options);
|
||||
}
|
||||
|
||||
if (this.attrs) {
|
||||
for (var i in this.attrs) {
|
||||
target.setAttribute(i, this.attrs[i]);
|
||||
if (i == 'class') { target.className = this.attrs[i]; } // for IE
|
||||
}
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
apply: function(node, data, options) {
|
||||
var tail = '' + data;
|
||||
var matches = [];
|
||||
|
||||
if (!this.fallback.apply) {
|
||||
this.fallback = new this.constructor(this.fallback);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
var best = false;
|
||||
var rule = false;
|
||||
for (var i = 0; i < this.children.length; i++) {
|
||||
if (typeof matches[i] == 'undefined') {
|
||||
if (!this.children[i].match) {
|
||||
this.children[i] = new this.constructor(this.children[i]);
|
||||
}
|
||||
matches[i] = this.children[i].match(tail, options);
|
||||
}
|
||||
if (matches[i] && (!best || best.index > matches[i].index)) {
|
||||
best = matches[i];
|
||||
rule = this.children[i];
|
||||
if (best.index == 0) { break; }
|
||||
}
|
||||
}
|
||||
|
||||
var pos = best ? best.index : tail.length;
|
||||
if (pos > 0) {
|
||||
this.fallback.apply(node, tail.substring(0, pos), options);
|
||||
}
|
||||
|
||||
if (!best) { break; }
|
||||
|
||||
if (!rule.build) { rule = new this.constructor(rule); }
|
||||
rule.build(node, best, options);
|
||||
|
||||
var chopped = best.index + best[0].length;
|
||||
tail = tail.substring(chopped);
|
||||
for (var i = 0; i < this.children.length; i++) {
|
||||
if (matches[i]) {
|
||||
if (matches[i].index >= chopped) {
|
||||
matches[i].index -= chopped;
|
||||
}
|
||||
else {
|
||||
matches[i] = void 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
fallback: {
|
||||
apply: function(node, data, options) {
|
||||
node.appendChild(document.createTextNode(data));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Parse.Simple.Base.Rule.prototype.constructor = Parse.Simple.Base.Rule;
|
||||
|
||||
Parse.Simple.Creole = function(options) {
|
||||
var rx = {};
|
||||
rx.link = '[^\\]|~\\n]*(?:(?:\\](?!\\])|~.)[^\\]|~\\n]*)*';
|
||||
rx.linkText = '[^\\]~\\n]*(?:(?:\\](?!\\])|~.)[^\\]~\\n]*)*';
|
||||
rx.uriPrefix = '\\b(?:(?:https?|ftp)://|mailto:)';
|
||||
rx.uri = rx.uriPrefix + rx.link;
|
||||
rx.rawUri = rx.uriPrefix + '\\S*[^\\s!"\',.:;?]';
|
||||
rx.interwikiPrefix = '[\\w.]+:';
|
||||
rx.interwikiLink = rx.interwikiPrefix + rx.link;
|
||||
|
||||
var formatLink = function(link, format) {
|
||||
format = format instanceof Array ? format : [ format ];
|
||||
if (typeof format[1] == 'undefined') { format[1] = ''; }
|
||||
return format[0] + link + format[1];
|
||||
};
|
||||
|
||||
var g = {
|
||||
hr: { tag: 'hr', regex: /(^|\n)\s*----\s*(\n|$)/ },
|
||||
|
||||
br: { tag: 'br', regex: /\\\\/ },
|
||||
|
||||
preBlock: { tag: 'pre', capture: 2,
|
||||
regex: /(^|\n)\{\{\{\n((.*\n)*?)\}\}\}(\n|$)/,
|
||||
replaceRegex: /^ ([ \t]*\}\}\})/gm,
|
||||
replaceString: '$1' },
|
||||
tt: { tag: 'tt',
|
||||
regex: /\{\{\{(.*?\}\}\}+)/, capture: 1,
|
||||
replaceRegex: /\}\}\}$/, replaceString: '' },
|
||||
|
||||
ulist: { tag: 'ul', capture: 0,
|
||||
regex: /(^|\n)([ \t]*\*[^*#].*(\n|$)([ \t]*[^\s*#].*(\n|$))*([ \t]*[*#]{2}.*(\n|$))*)+/ },
|
||||
olist: { tag: 'ol', capture: 0,
|
||||
regex: /(^|\n)([ \t]*#[^*#].*(\n|$)([ \t]*[^\s*#].*(\n|$))*([ \t]*[*#]{2}.*(\n|$))*)+/ },
|
||||
li: { tag: 'li', capture: 0,
|
||||
regex: /[ \t]*([*#]).+(\n[ \t]*[^*#\s].*)*(\n[ \t]*\1[*#].+)*/,
|
||||
replaceRegex: /(^|\n)[ \t]*[*#]/g, replaceString: '$1' },
|
||||
|
||||
table: { tag: 'table', capture: 0,
|
||||
regex: /(^|\n)(\|.*?[ \t]*(\n|$))+/ },
|
||||
tr: { tag: 'tr', capture: 2, regex: /(^|\n)(\|.*?)\|?[ \t]*(\n|$)/ },
|
||||
th: { tag: 'th', regex: /\|+=([^|]*)/, capture: 1 },
|
||||
td: { tag: 'td', capture: 1,
|
||||
regex: /\|+([^|~]*(~(.|(?=\n)|$)[^|~]*)*)/ },
|
||||
|
||||
singleLine: { regex: /.+/, capture: 0 },
|
||||
paragraph: { tag: 'p', capture: 0,
|
||||
regex: /(^|\n)([ \t]*\S.*(\n|$))+/ },
|
||||
text: { capture: 0, regex: /(^|\n)([ \t]*[^\s].*(\n|$))+/ },
|
||||
|
||||
strong: { tag: 'strong', capture: 1,
|
||||
regex: /\*\*([^*~]*((\*(?!\*)|~(.|(?=\n)|$))[^*~]*)*)(\*\*|\n|$)/ },
|
||||
em: { tag: 'em', capture: 1,
|
||||
regex: '\\/\\/(((?!' + rx.uriPrefix + ')[^\\/~])*' +
|
||||
'((' + rx.rawUri + '|\\/(?!\\/)|~(.|(?=\\n)|$))' +
|
||||
'((?!' + rx.uriPrefix + ')[^\\/~])*)*)(\\/\\/|\\n|$)' },
|
||||
|
||||
img: { regex: '\\{\\{((?!\\{)[^|}\\n]*(?:}(?!})[^|}\\n]*)*)\\|' +
|
||||
'([^}~\\n]*((}(?!})|~.)[^}~\\n]*)*)}}',
|
||||
build: function(node, r, options) {
|
||||
var img = document.createElement('img');
|
||||
img.src = r[1];
|
||||
img.alt = r[2].replace(/~(.)/g, '$1');
|
||||
node.appendChild(img);
|
||||
} },
|
||||
|
||||
namedUri: { regex: '\\[\\[(' + rx.uri + ')\\|(' + rx.linkText + ')\\]\\]',
|
||||
build: function(node, r, options) {
|
||||
var link = document.createElement('a');
|
||||
link.href = r[1];
|
||||
if (options && options.isPlainUri) {
|
||||
link.appendChild(document.createTextNode(r[2]));
|
||||
}
|
||||
else {
|
||||
this.apply(link, r[2], options);
|
||||
}
|
||||
node.appendChild(link);
|
||||
} },
|
||||
|
||||
namedLink: { regex: '\\[\\[(' + rx.link + ')\\|(' + rx.linkText + ')\\]\\]',
|
||||
build: function(node, r, options) {
|
||||
var link = document.createElement('a');
|
||||
|
||||
link.href = options && options.linkFormat
|
||||
? formatLink(r[1].replace(/~(.)/g, '$1'), options.linkFormat)
|
||||
: r[1].replace(/~(.)/g, '$1');
|
||||
this.apply(link, r[2], options);
|
||||
|
||||
node.appendChild(link);
|
||||
} },
|
||||
|
||||
unnamedUri: { regex: '\\[\\[(' + rx.uri + ')\\]\\]',
|
||||
build: 'dummy' },
|
||||
unnamedLink: { regex: '\\[\\[(' + rx.link + ')\\]\\]',
|
||||
build: 'dummy' },
|
||||
unnamedInterwikiLink: { regex: '\\[\\[(' + rx.interwikiLink + ')\\]\\]',
|
||||
build: 'dummy' },
|
||||
|
||||
rawUri: { regex: '(' + rx.rawUri + ')',
|
||||
build: 'dummy' },
|
||||
|
||||
escapedSequence: { regex: '~(' + rx.rawUri + '|.)', capture: 1,
|
||||
tag: 'span', attrs: { 'class': 'escaped' } },
|
||||
escapedSymbol: { regex: /~(.)/, capture: 1,
|
||||
tag: 'span', attrs: { 'class': 'escaped' } }
|
||||
};
|
||||
g.unnamedUri.build = g.rawUri.build = function(node, r, options) {
|
||||
if (!options) { options = {}; }
|
||||
options.isPlainUri = true;
|
||||
g.namedUri.build.call(this, node, Array(r[0], r[1], r[1]), options);
|
||||
};
|
||||
g.unnamedLink.build = function(node, r, options) {
|
||||
g.namedLink.build.call(this, node, Array(r[0], r[1], r[1]), options);
|
||||
};
|
||||
g.namedInterwikiLink = { regex: '\\[\\[(' + rx.interwikiLink + ')\\|(' + rx.linkText + ')\\]\\]',
|
||||
build: function(node, r, options) {
|
||||
var link = document.createElement('a');
|
||||
|
||||
var m, f;
|
||||
if (options && options.interwiki) {
|
||||
m = r[1].match(/(.*?):(.*)/);
|
||||
f = options.interwiki[m[1]];
|
||||
}
|
||||
|
||||
if (typeof f == 'undefined') {
|
||||
if (!g.namedLink.apply) {
|
||||
g.namedLink = new this.constructor(g.namedLink);
|
||||
}
|
||||
return g.namedLink.build.call(g.namedLink, node, r, options);
|
||||
}
|
||||
|
||||
link.href = formatLink(m[2].replace(/~(.)/g, '$1'), f);
|
||||
|
||||
this.apply(link, r[2], options);
|
||||
|
||||
node.appendChild(link);
|
||||
}
|
||||
};
|
||||
g.unnamedInterwikiLink.build = function(node, r, options) {
|
||||
g.namedInterwikiLink.build.call(this, node, Array(r[0], r[1], r[1]), options);
|
||||
};
|
||||
g.namedUri.children = g.unnamedUri.children = g.rawUri.children =
|
||||
g.namedLink.children = g.unnamedLink.children =
|
||||
g.namedInterwikiLink.children = g.unnamedInterwikiLink.children =
|
||||
[ g.escapedSymbol, g.img ];
|
||||
|
||||
for (var i = 1; i <= 6; i++) {
|
||||
g['h' + i] = { tag: 'h' + i, capture: 2,
|
||||
regex: '(^|\\n)[ \\t]*={' + i + '}[ \\t]' +
|
||||
'([^~]*?(~(.|(?=\\n)|$))*)[ \\t]*=*\\s*(\\n|$)'
|
||||
};
|
||||
}
|
||||
|
||||
g.ulist.children = g.olist.children = [ g.li ];
|
||||
g.li.children = [ g.ulist, g.olist ];
|
||||
g.li.fallback = g.text;
|
||||
|
||||
g.table.children = [ g.tr ];
|
||||
g.tr.children = [ g.th, g.td ];
|
||||
g.td.children = [ g.singleLine ];
|
||||
g.th.children = [ g.singleLine ];
|
||||
|
||||
g.h1.children = g.h2.children = g.h3.children =
|
||||
g.h4.children = g.h5.children = g.h6.children =
|
||||
g.singleLine.children = g.paragraph.children =
|
||||
g.text.children = g.strong.children = g.em.children =
|
||||
[ g.escapedSequence, g.strong, g.em, g.br, g.rawUri,
|
||||
g.namedUri, g.namedInterwikiLink, g.namedLink,
|
||||
g.unnamedUri, g.unnamedInterwikiLink, g.unnamedLink,
|
||||
g.tt, g.img ];
|
||||
|
||||
g.root = {
|
||||
children: [ g.h1, g.h2, g.h3, g.h4, g.h5, g.h6,
|
||||
g.hr, g.ulist, g.olist, g.preBlock, g.table ],
|
||||
fallback: { children: [ g.paragraph ] }
|
||||
};
|
||||
|
||||
Parse.Simple.Base.call(this, g.root, options);
|
||||
};
|
||||
|
||||
Parse.Simple.Creole.prototype = new Parse.Simple.Base();
|
||||
|
||||
Parse.Simple.Creole.prototype.constructor = Parse.Simple.Creole;
|
205
src/apps/stiki/stiki-site/stiki.css
Normal file
205
src/apps/stiki/stiki-site/stiki.css
Normal file
|
@ -0,0 +1,205 @@
|
|||
.menu {
|
||||
padding: 0.33em;
|
||||
font-family: "URW Gothic L", "Century Gothic", sans-serif;
|
||||
text-align: left;
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
.menusection {
|
||||
list-style-type: none;
|
||||
font-weight: normal;
|
||||
margin-left: 0.2em;
|
||||
margin-right: 1em;
|
||||
margin-top: 0.6em;
|
||||
margin-bottom:0em;
|
||||
padding-left: 0em;
|
||||
/* line-height: 0.5; */
|
||||
}
|
||||
/*.menuitem {
|
||||
padding-top: 0em;
|
||||
list-style-type: none;
|
||||
font-weight: normal;
|
||||
margin-right: 1em;
|
||||
margin-left: 0em;
|
||||
padding-left: 0em;
|
||||
line-height: 1.25;
|
||||
}*/
|
||||
ul {
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
ol {
|
||||
padding-left: 1.5em;
|
||||
list-style-type: decimal;
|
||||
}
|
||||
ol ol {
|
||||
list-style-type: lower-alpha;
|
||||
}
|
||||
ol ol ol {
|
||||
list-style-type: lower-roman;
|
||||
}
|
||||
ol ol ol ol {
|
||||
list-style-type: lower-greek;
|
||||
}
|
||||
ol ol ol ol ol {
|
||||
list-style-type: cjk-ideographic;
|
||||
}
|
||||
ol ol ol ol ol ol{
|
||||
list-style-type: georgian;
|
||||
}
|
||||
ol ol ol ol ol ol ol{
|
||||
list-style-type: hebrew;
|
||||
}
|
||||
ol ol ol ol ol ol ol ol {
|
||||
list-style-type: armenian;
|
||||
}
|
||||
img {
|
||||
border: 0;
|
||||
}
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
a.menuitem {
|
||||
font-family: "URW Gothic L", "Century Gothic", sans-serif;
|
||||
font-size: 1.4em;
|
||||
color: black;
|
||||
|
||||
}
|
||||
a.menuitem:hover {
|
||||
color: blue;
|
||||
text-decoration: none;
|
||||
}
|
||||
body {
|
||||
font-family: "URW Gothic L", "Century Gothic", sans-serif;
|
||||
/* font-family: sans-serif;*/
|
||||
/* font-family: "URW Gothic L", sans-serif; */
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
.version {
|
||||
position: relative;
|
||||
top: 2em;
|
||||
right: 0%;
|
||||
width: 100%;
|
||||
padding: .33em;
|
||||
|
||||
}
|
||||
.editbutton {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
left: 90%;
|
||||
width: 10%;
|
||||
background-color: #ccccff;
|
||||
}
|
||||
.editbox {
|
||||
position: relative;
|
||||
margin: 1em;
|
||||
width: 95%;
|
||||
}
|
||||
.editsubmit {
|
||||
margin-top: 0em;
|
||||
margin-left: 1.5em;
|
||||
}
|
||||
.titlebar {
|
||||
position: relative;
|
||||
/* height: 3.25em; */
|
||||
width: 100%;
|
||||
background-color: #dddddd;
|
||||
/* padding-top: 0.25em;
|
||||
padding-left: 0.5em;
|
||||
padding-bottom: 0.25em;
|
||||
margin-top: 0em;
|
||||
margin-left: 0em; */
|
||||
}
|
||||
.pagename {
|
||||
font-weight: normal;
|
||||
font-size: 1.75em;
|
||||
color: #444488;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
padding-top: 0.1em;
|
||||
padding-bottom: 0.1em;
|
||||
padding-left: 0.3em;
|
||||
margin-top: 0em;
|
||||
margin-left: 0em;
|
||||
}
|
||||
|
||||
.mainbar {
|
||||
position: relative;
|
||||
color: black;
|
||||
/* left: 20%;
|
||||
width: 80%; */
|
||||
}
|
||||
.padding {
|
||||
position: relative;
|
||||
height: 50em;
|
||||
}
|
||||
h1 {
|
||||
font-weight: normal;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
h2{
|
||||
font-weight: normal;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
table.tbl {
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
td.tbl, th.tbl {
|
||||
border-style: none;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
/*table.tbl {
|
||||
border = 0em;
|
||||
margin = 0em;
|
||||
padding = 0em;
|
||||
}*/
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
border-width: 1px;
|
||||
border-style:solid;
|
||||
}
|
||||
td, th {
|
||||
border-style:solid;
|
||||
border-width: 1px;
|
||||
border-spacing: 0;
|
||||
/* border-width: 1px 1px 0 0;
|
||||
border-spacing: 0;
|
||||
border: solid;
|
||||
margin: 0; */
|
||||
padding: 4px;
|
||||
}
|
||||
th {
|
||||
border-left-style: none;
|
||||
border-right-style: none;
|
||||
}
|
||||
p {
|
||||
/* margin-left: 30pt; */
|
||||
font-family: sans-serif;
|
||||
}
|
||||
.bodytext {
|
||||
/*font-family: "URW Gothic L", "Century Gothic", sans-serif; */
|
||||
/* font-family: "URW Gothic L", sans-serif; */
|
||||
/* font-family: sans-serif; */
|
||||
margin: 1.5em;
|
||||
/* margin: 1.5em; */
|
||||
}
|
||||
.sidebar {
|
||||
text-align: left;
|
||||
/* position: absolute; */
|
||||
padding: 0em;
|
||||
margin: 0em;
|
||||
left: 0%;
|
||||
border-style: none;
|
||||
width: 1%;
|
||||
/* width: 20%; */
|
||||
}
|
||||
|
Loading…
Reference in a new issue