[Jifty-commit] r2036 - in wifty/trunk: . bin etc
lib/Wifty/Form/Field share/web/static/css
share/web/templates/_elements
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Thu Oct 19 17:42:19 EDT 2006
Author: jesse
Date: Thu Oct 19 17:42:18 2006
New Revision: 2036
Added:
wifty/trunk/bin/import_kwiki
Modified:
wifty/trunk/ (props changed)
wifty/trunk/Makefile.PL
wifty/trunk/etc/config.yml
wifty/trunk/lib/Wifty/Form/Field/WikiPage.pm
wifty/trunk/lib/Wifty/Model/Page.pm
wifty/trunk/share/web/static/css/app-base.css
wifty/trunk/share/web/templates/_elements/markup
wifty/trunk/share/web/templates/_elements/wrapper
Log:
r28940 at pinglin: jesse | 2006-10-19 17:41:55 -0400
* Added support for Kwiki style markup, wiki logos and a kwiki (most recent version) importer
Modified: wifty/trunk/Makefile.PL
==============================================================================
--- wifty/trunk/Makefile.PL (original)
+++ wifty/trunk/Makefile.PL Thu Oct 19 17:42:18 2006
@@ -5,4 +5,5 @@
requires('Text::Markdown');
requires('HTML::Scrubber');
requires('Text::Diff::HTML');
+recommends('Text::KwikiFormatish');
WriteAll;
Added: wifty/trunk/bin/import_kwiki
==============================================================================
--- (empty file)
+++ wifty/trunk/bin/import_kwiki Thu Oct 19 17:42:18 2006
@@ -0,0 +1,53 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Text::KwikiFormatish;
+
+use Jifty;
+Jifty->new();
+
+get_pages('/tmp/svkwiki/data/database');
+
+
+
+sub import_page {
+ my $path = shift;
+ my $name = shift;
+ my $page = Wifty::Model::Page->new(current_user => Wifty::CurrentUser->superuser);
+ open( my $file, "<", $path)||die $!;
+ my @content = <$file>;
+ # chomp(@content);
+ close $file;
+ my $content = join("\n", at content);
+ return unless $content;
+ my $html = Text::KwikiFormatish::format( $content);
+
+ $name =~ s/\s*//g;
+ $page->load_by_cols(name =>$name);
+ if ($page->id) {
+ $page->set_content($content);
+ }
+ else {
+ my ($ret)= $page->create( name => $name, content => $content);
+ warn $ret;
+ }
+}
+
+sub get_pages {
+ my $src = shift;
+ File::Find::find(
+ { wanted => sub {
+ &import_page($File::Find::name, $_)
+ },
+ follow => 0
+
+ },
+
+ $src
+ );
+
+
+
+}
Modified: wifty/trunk/etc/config.yml
==============================================================================
--- wifty/trunk/etc/config.yml (original)
+++ wifty/trunk/etc/config.yml Thu Oct 19 17:42:18 2006
@@ -23,3 +23,7 @@
application:
# RequireAuth: 1
WikiName: A Wiki
+ Formatter: Markdown
+ # The formatter options are "Markdown" and "Kwiki"
+ # Logo: http://svk.bestpractical.com/svk-logo.png
+ # The logo points to the url to a logo image
Modified: wifty/trunk/lib/Wifty/Form/Field/WikiPage.pm
==============================================================================
--- wifty/trunk/lib/Wifty/Form/Field/WikiPage.pm (original)
+++ wifty/trunk/lib/Wifty/Form/Field/WikiPage.pm Thu Oct 19 17:42:18 2006
@@ -15,6 +15,10 @@
package Wifty::Form::Field::WikiPage;
use base qw(Jifty::Web::Form::Field::Textarea);
+use HTML::Scrubber;
+
+
+
=head2 render_value
Render a wikified view of this field's content.
@@ -50,7 +54,7 @@
{ '*' => 0,
id => 1,
class => 1,
- href => qr{^(?:(?:\w+$)|http:|ftp:|https:|/)}i,
+ href => qr{^(?:(?:\w+$)|http:|ftp:|https:|\.?/)}i,
# Match http, ftp and relative urls
face => 1,
@@ -64,8 +68,15 @@
qw[H1 H2 H3 H4 H5 A STRONG EM CODE PRE B U P BR I HR BR SPAN DIV UL OL LI DL DT DD]);
$scrubber->comment(0);
- $content = Text::Markdown::markdown( $content );
- $content = $scrubber->scrub( $content );
+ if (Jifty->config->app('Formatter') eq 'Markdown' ) {
+ require Text::Markdown;
+ $content = Text::Markdown::markdown( $content );
+ }
+ elsif (Jifty->config->app('Formatter') eq 'Kwiki') {
+ require Text::KwikiFormatish;
+ $content = Text::KwikiFormatish::format( $content);
+ }
+ #$content = $scrubber->scrub( $content );
return ( $content );
}
Modified: wifty/trunk/lib/Wifty/Model/Page.pm
==============================================================================
--- wifty/trunk/lib/Wifty/Model/Page.pm (original)
+++ wifty/trunk/lib/Wifty/Model/Page.pm Thu Oct 19 17:42:18 2006
@@ -28,8 +28,6 @@
package Wifty::Model::Page;
use base qw/Wifty::Record/;
use Wifty::Model::RevisionCollection;
-use Text::Markdown;
-use HTML::Scrubber;
sub create {
Modified: wifty/trunk/share/web/static/css/app-base.css
==============================================================================
--- wifty/trunk/share/web/static/css/app-base.css (original)
+++ wifty/trunk/share/web/static/css/app-base.css Thu Oct 19 17:42:18 2006
@@ -24,6 +24,10 @@
margin-top: 2.3em;
}
+#logo {
+ float: right;
+}
+
#wikiheader {
float: right;
text-align: right;
Modified: wifty/trunk/share/web/templates/_elements/markup
==============================================================================
--- wifty/trunk/share/web/templates/_elements/markup (original)
+++ wifty/trunk/share/web/templates/_elements/markup Thu Oct 19 17:42:18 2006
@@ -1,3 +1,7 @@
+<%init>
+return undef unless (Jifty->config->app('Formatter') eq 'Markdown');
+</%init>
+
<div id="syntax">
<div><a href="#" onclick="Element.toggle('syntax_content');return(false);"><b>Wiki Syntax Help</b></a>
</div>
Modified: wifty/trunk/share/web/templates/_elements/wrapper
==============================================================================
--- wifty/trunk/share/web/templates/_elements/wrapper (original)
+++ wifty/trunk/share/web/templates/_elements/wrapper Thu Oct 19 17:42:18 2006
@@ -7,7 +7,9 @@
url => '/__jifty/admin/') %>.
</div>
% }
-
+ <div id="logo">
+ <% Jifty->config->app('Logo') ? '<img src="'.Jifty->config->app('Logo').'" alt="" />' : '' |n %>
+ </div>
<div id="header">
<div id="wikiheader">
<h1 id="wikiname">
More information about the Jifty-commit
mailing list