diff --git a/extra/webapps/wiki/initial-content/Front Page.txt b/extra/webapps/wiki/initial-content/Front Page.txt index 37351eed38..2f390f7349 100644 --- a/extra/webapps/wiki/initial-content/Front Page.txt +++ b/extra/webapps/wiki/initial-content/Front Page.txt @@ -1,5 +1,3 @@ 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. +You can now click *Edit* below and begin editing the content of the [[Front Page]]. More information at [[Wiki Help]]. diff --git a/extra/webapps/wiki/initial-content/Wiki Help.txt b/extra/webapps/wiki/initial-content/Wiki Help.txt new file mode 100644 index 0000000000..9c65876377 --- /dev/null +++ b/extra/webapps/wiki/initial-content/Wiki Help.txt @@ -0,0 +1,5 @@ +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. + +The Wiki supports hierarchical article organization. You can separate components in article names with slashes, and Wiki links only display the last component. An example: [[Factor/Features]]. diff --git a/extra/webapps/wiki/wiki.factor b/extra/webapps/wiki/wiki.factor index 623c8aabe5..380f41cf97 100644 --- a/extra/webapps/wiki/wiki.factor +++ b/extra/webapps/wiki/wiki.factor @@ -89,6 +89,9 @@ M: revision feed-entry-url id>> revision-url ;
select-tuple dup [ revision>> select-tuple ] when ; +: init-relative-link-prefix ( -- ) + URL" $wiki/view/" adjust-url present relative-link-prefix set ; + : ( -- action ) @@ -96,6 +99,7 @@ M: revision feed-entry-url id>> revision-url ; [ validate-title + init-relative-link-prefix ] >>init [ @@ -118,7 +122,7 @@ M: revision feed-entry-url id>> revision-url ; validate-integer-id "id" value select-tuple from-object - URL" $wiki/view/" adjust-url present relative-link-prefix set + init-relative-link-prefix ] >>init { wiki "view" } >>template @@ -370,11 +374,13 @@ M: revision feed-entry-url id>> revision-url ; : init-wiki ( -- ) "resource:extra/webapps/wiki/initial-content" directory* keys [ - [ ascii file-contents ] [ file-name "." split1 drop ] bi - f - swap >>title - swap >>content - "slava" >>author - now >>date - add-revision + dup file-name ".txt" ?tail [ + swap ascii file-contents + f + swap >>content + swap >>title + "slava" >>author + now >>date + add-revision + ] [ 2drop ] if ] each ;