Minor Wiki improvements
parent
75338b577c
commit
7c76046d3b
|
@ -1,14 +0,0 @@
|
|||
<?xml version='1.0' ?>
|
||||
|
||||
<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
|
||||
|
||||
<t:bind-each t:name="postings">
|
||||
|
||||
<p class="news">
|
||||
<strong><t:label t:name="title" /></strong> <br/>
|
||||
<t:a value="link" class="more">Read More...</t:a>
|
||||
</p>
|
||||
|
||||
</t:bind-each>
|
||||
|
||||
</t:chloe>
|
|
@ -0,0 +1,63 @@
|
|||
Look at the source to this page by clicking *Edit* to compare the farkup language with resulting output.
|
||||
|
||||
= level 1 heading =
|
||||
|
||||
== level 2 heading ==
|
||||
|
||||
=== level 3 heading ===
|
||||
|
||||
==== level 4 heading ====
|
||||
|
||||
Here is a paragraph of text, with _emphasized_ and *strong* text, together with an inline %code snippet%. Did you know that E=mc^2^, and L~2~ spaces are cool? Of course, if you want to include \_ special \* characters \^ you \~ can \% do that, too.
|
||||
|
||||
You can make [[Wiki Links]] just like that, as well as links to external sites: [[http://sbcl.sourceforge.net]]. [[Factor|Custom link text]] can be used [[http://www.apple.com|with both types of links]].
|
||||
|
||||
Images can be embedded in the text:
|
||||
|
||||
[[image:http://factorcode.org/graphics/logo.png]]
|
||||
|
||||
- a list
|
||||
- with three
|
||||
- items
|
||||
|
||||
|a table|with|four|columns|
|
||||
|and|two|rows|...|
|
||||
|
||||
Here is some code:
|
||||
|
||||
[{HAI
|
||||
CAN HAS STDIO?
|
||||
VISIBLE "HAI WORLD!"
|
||||
KTHXBYE}]
|
||||
|
||||
There is syntax highlighting various languages, too:
|
||||
|
||||
[factor{PEG: parse-request-line ( string -- triple )
|
||||
#! Triple is { method url version }
|
||||
[
|
||||
'space' ,
|
||||
'http-method' ,
|
||||
'space' ,
|
||||
'url' ,
|
||||
'space' ,
|
||||
'http-version' ,
|
||||
'space' ,
|
||||
] seq* just ;}]
|
||||
|
||||
Some Java:
|
||||
|
||||
[java{/**
|
||||
* Returns the extension of the specified filename, or an empty
|
||||
* string if there is none.
|
||||
* @param path The path
|
||||
*/
|
||||
public static String getFileExtension(String path)
|
||||
{
|
||||
int fsIndex = getLastSeparatorIndex(path);
|
||||
int index = path.lastIndexOf('.');
|
||||
// there could be a dot in the path and no file extension
|
||||
if(index == -1 || index < fsIndex )
|
||||
return "";
|
||||
else
|
||||
return path.substring(index);
|
||||
}}]
|
|
@ -0,0 +1,5 @@
|
|||
Congratulations, you are now running your very own Wiki.
|
||||
|
||||
You can now click *Edit* below and begin editing the content of the [[Front Page]]. This Wiki uses [[Farkup]] to mark up text.
|
||||
|
||||
Two special article names are recognized by the Wiki: [[Sidebar]] and [[Footer]]. They do not exist by default, but if you create them, they will be visible on every page.
|
|
@ -13,6 +13,7 @@
|
|||
<t:a t:href="$wiki">Front Page</t:a>
|
||||
| <t:a t:href="$wiki/articles">All Articles</t:a>
|
||||
| <t:a t:href="$wiki/changes">Recent Changes</t:a>
|
||||
| <t:a t:href="$wiki/random">Random Article</t:a>
|
||||
|
||||
<t:if t:code="furnace.auth:logged-in?">
|
||||
|
||||
|
@ -45,6 +46,16 @@
|
|||
</td>
|
||||
</t:if>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<t:bind t:name="footer">
|
||||
<small>
|
||||
<t:farkup t:name="content" />
|
||||
</small>
|
||||
</t:bind>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</t:chloe>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
! Copyright (C) 2008 Slava Pestov
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors kernel hashtables calendar
|
||||
USING: accessors kernel hashtables calendar random assocs
|
||||
namespaces splitting sequences sorting math.order present
|
||||
io.files io.encodings.ascii
|
||||
syndication
|
||||
html.components html.forms
|
||||
http.server
|
||||
|
@ -115,6 +116,14 @@ M: revision feed-entry-url id>> revision-url ;
|
|||
|
||||
{ wiki "view" } >>template ;
|
||||
|
||||
: <random-article-action> ( -- action )
|
||||
<action>
|
||||
[
|
||||
article new select-tuples random
|
||||
[ title>> ] [ "Front Page" ] if*
|
||||
view-url <redirect>
|
||||
] >>display ;
|
||||
|
||||
: amend-article ( revision article -- )
|
||||
swap id>> >>revision update-tuple ;
|
||||
|
||||
|
@ -286,15 +295,15 @@ M: revision feed-entry-url id>> revision-url ;
|
|||
{ wiki "page-common" } >>template ;
|
||||
|
||||
: init-sidebar ( -- )
|
||||
"Sidebar" latest-revision [
|
||||
"sidebar" [ from-object ] nest-form
|
||||
] when* ;
|
||||
"Sidebar" latest-revision [ "sidebar" [ from-object ] nest-form ] when*
|
||||
"Footer" latest-revision [ "footer" [ from-object ] nest-form ] when* ;
|
||||
|
||||
: <wiki> ( -- dispatcher )
|
||||
wiki new-dispatcher
|
||||
<main-article-action> <article-boilerplate> "" add-responder
|
||||
<view-article-action> <article-boilerplate> "view" add-responder
|
||||
<view-revision-action> <article-boilerplate> "revision" add-responder
|
||||
<random-article-action> "random" add-responder
|
||||
<list-revisions-action> <article-boilerplate> "revisions" add-responder
|
||||
<list-revisions-feed-action> "revisions.atom" add-responder
|
||||
<diff-action> <article-boilerplate> "diff" add-responder
|
||||
|
@ -309,3 +318,15 @@ M: revision feed-entry-url id>> revision-url ;
|
|||
<boilerplate>
|
||||
[ init-sidebar ] >>init
|
||||
{ wiki "wiki-common" } >>template ;
|
||||
|
||||
: init-wiki ( -- )
|
||||
"resource:extra/webapps/wiki/initial-content" directory* keys
|
||||
[
|
||||
[ ascii file-contents ] [ file-name "." split1 drop ] bi
|
||||
f <revision>
|
||||
swap >>title
|
||||
swap >>content
|
||||
"slava" >>author
|
||||
now >>date
|
||||
add-revision
|
||||
] each ;
|
||||
|
|
|
@ -25,7 +25,7 @@ webapps.wee-url
|
|||
webapps.user-admin ;
|
||||
IN: websites.concatenative
|
||||
|
||||
: test-db ( -- db params ) "resource:test.db" sqlite-db ;
|
||||
: test-db ( -- params db ) "resource:test.db" sqlite-db ;
|
||||
|
||||
: init-factor-db ( -- )
|
||||
test-db [
|
||||
|
|
Loading…
Reference in New Issue