]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
authorJoey Hess <joey@gnu.kitenet.net>
Sun, 8 Mar 2009 16:50:24 +0000 (12:50 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Sun, 8 Mar 2009 16:50:24 +0000 (12:50 -0400)
Conflicts:
doc/todo/mdwn_preview.mdwn

IkiWiki/Plugin/wmd.pm
debian/changelog
debian/copyright
doc/plugins/wmd.mdwn [new file with mode: 0644]
doc/todo/mdwn_preview.mdwn
doc/usage.mdwn
templates/editcomment.tmpl
templates/editpage.tmpl

index 3372ffe38dc35c115829eceba24e06d165045e4b..bdbcecc069d5777872042de178f4b4cbc6de0559 100644 (file)
@@ -26,8 +26,9 @@ sub formbuilder_setup (@) {
 
        return if ! defined $form->field("do");
        
-       return unless (($form->field("do") eq "edit") ||
-                               ($form->field("do") eq "create"));
+       return unless $form->field("do") eq "edit" ||
+                       $form->field("do") eq "create" ||
+                       $form->field("do") eq "comment";
 
        $form->tmpl_param("wmd_preview", "<div class=\"wmd-preview\"></div>\n".
                include_javascript(undef, 1));
@@ -37,7 +38,7 @@ sub include_javascript ($;$) {
        my $page=shift;
        my $absolute=shift;
        
-       return '<script src="'.urlto("wmd.js", $page, $absolute).
+       return '<script src="'.urlto("wmd/wmd.js", $page, $absolute).
                '" type="text/javascript"></script>'."\n";
 }
 
index 801dc154f3ec8741d8693c6aa193171ad21365df..d6ee6fd8a75d48d4046670d99bcf5bff78c4a720 100644 (file)
@@ -2,6 +2,8 @@ ikiwiki (3.07) UNRELEASED; urgency=low
  
   * Updated German translation (Kai Wasserbäch). Closes: #518377
   * Updated French translation (Jean-Luc Coulon). Closes: #518510
+  * wmd: New plugin contributed by William Uther to support the WMD
+    Wysiwym markdown editor.
 
  -- Joey Hess <joeyh@debian.org>  Thu, 05 Mar 2009 15:43:02 -0500
 
index f589b4a8f5e68eed1265a20a7c0ad61be862808f..67f0ac540200c66e1456cd5388d28c537ea67d19 100644 (file)
@@ -122,6 +122,10 @@ Files: 404.pm
 Copyright: © 2009 Simon McVittie <http://smcv.pseudorandom.co.uk/>
 License: GPL-2+
 
+Files: wmd.pm
+Copyright: © 2009 William Uther
+License: GPL-2+
+
 Files: doc/logo/*
 Copyright: © 2006 Recai Oktaş <roktas@debian.org>
 License: GPL-2+
diff --git a/doc/plugins/wmd.mdwn b/doc/plugins/wmd.mdwn
new file mode 100644 (file)
index 0000000..dc9a307
--- /dev/null
@@ -0,0 +1,16 @@
+[[!template id=plugin name=wmd author="[[Will]]"]]
+[[!tag type/chrome]]
+
+[WMD](http://wmd-editor.com/) is a What You See Is What You Mean editor for
+[[mdwn]]. This plugin makes WMD be used for editing pages in the wiki.
+
+To use the plugin, you will need to install WMD. Download the [WMD
+source](http://wmd-editor.com/downloads/wmd-1.0.1.zip).  In that zip file
+you'll find a few example html files, a readme and `wmd` directory.  Create
+a 'wmd' subdirectory in the ikiwiki `underlaydir` directory (ie `sudo mkdir
+/usr/share/ikiwiki/wmd`). Move the `wmd` directory into the directory you
+made. You should now have a `wmd/wmd/wmd.js` file as well as some other
+javascript files and an images directory in the same place.
+
+Note that the WMD plugin does **not** handle ikiwiki directives.  For this
+reason the normal `preview` button remains.
index 6ab8d604bf744b2327b35cd4aeedc8c2ec4b8261..2fa4603368cfa81d02513b476ad1bae7e1f58bd0 100644 (file)
@@ -18,7 +18,11 @@ add to ikiwiki.
 
 [[!tag wishlist]]
 
->>> Below is a simple plugin/[[patch]] to make use of the WMD editor.  Turns out it isn't hard at all to
+>>> Below is a simple plugin/[[patch]] to make use of the WMD editor.
+
+>>>> Now added to ikiwiki, thanks! --[[Joey]] 
+
+>>> Turns out it isn't hard at all to
 >>> get a basic version going (which doesn't handle directives at all, nor does it swtich itself off when you're
 >>> editing something other than Markdown source).  I've
 >>> removed the done tag so this is visible as a patch. -- [[Will]]
@@ -44,19 +48,10 @@ add to ikiwiki.
 >>>>> It might be best to contact <support@attacklab.net> to for an explicit license on that if you want to include it.
 >>>>> -- [[Will]]
 
-------
-
-### Instructions:
-
-
-Download the [WMD source](http://wmd-editor.com/downloads/wmd-1.0.1.zip).  In that zip file you'll
-find a few example html files, a readme and `wmd` directory.  Move the `wmd` directory into the
-ikiwiki `underlays` directory.  You should now have an `underlays/wmd/wmd.js` file as well as 
-some other javascript files and an images directory in the same place.
-
 > So, I wonder if I should add a copy of the WMD source to ikiwiki, or rely
 > on the user or distribution providing it. It does not seem to be packaged
-> for Debian yet. --[[Joey]] 
+> for Debian yet. Hmm, I also can't find any copyright or license info in
+> the zip file. --[[Joey]] 
 
 >> This is a good question.  My thought is that it will probably not be packaged any time soon,
 >> so you're better off adding it to IkiWiki.  I'd contact the author of WMD and ask them.  They
@@ -75,66 +70,19 @@ remains.  Some CSS to clean up the display of the live WMD preview would be good
 >> I recommend having a look at <http://wmd-editor.com/examples/splitscreen>
 >> for what a little CSS could achieve.  -- [[Will]]
 
-Install the following patch and plugin file.  Then enable the 'wmd' plugin.
-
-
-    diff --git a/templates/editpage.tmpl b/templates/editpage.tmpl
-    index 4b54db2..b1cf015 100644
-    --- a/templates/editpage.tmpl
-    +++ b/templates/editpage.tmpl
-    @@ -37,6 +37,7 @@ Optional comment about this change:<br />
-     </div>
-     </TMPL_IF>
-     <TMPL_VAR FORM-END>
-    +<TMPL_VAR WMD_PREVIEW>
-     
-     <TMPL_IF NAME="PAGE_PREVIEW">
-     <hr />
-
------
-
-    #!/usr/bin/perl
-    package IkiWiki::Plugin::wmd;
-    
-    use warnings;
-    use strict;
-    use IkiWiki 3.00;
-    use POSIX;
-    use Encode;
-    
-    sub import {
-       add_underlay("wmd");
-       hook(type => "getsetup", id => "wmd", call => \&getsetup);
-       hook(type => "formbuilder_setup", id => "wmd", call => \&formbuilder_setup);
-    }
-    
-    sub getsetup () {
-       return
-               plugin => {
-                       safe => 1,
-                       rebuild => 1,
-               },
-    }
-    
-    sub formbuilder_setup (@) {
-       my %params=@_;
-       my $form=$params{form};
-    
-       return if ! defined $form->field("do");
-       
-       return unless (($form->field("do") eq "edit") ||
-                               ($form->field("do") eq "create"));
-    
-       $form->tmpl_param("wmd_preview", "<div class=\"wmd-preview\"></div>\n".include_javascript(undef, 1));
-    }
-    
-    sub include_javascript ($;$) {
-       my $page=shift;
-       my $absolute=shift;
-       
-       return '<script src="'.urlto("wmd.js", $page, $absolute).
-               '" type="text/javascript"></script>'."\n";
-    }
-    
-    1
-
+> Hmm, now that I've tried it, I notice that it does live preview by
+> default, below the edit window. Which is nice, but then if I hit the
+> preview button, I get two previews.. which is confusing. (Also, minor,
+> but: the live preview is missing the "Page Preview:" header.) --[[Joey]] 
+
+> I wonder how annoying it would be to add some kind of simplistic wikilink
+> support to wmd's preview? And/or a wikilink button? While not supporting
+> directies is fine, not supporting wikilinks in a wiki seems a bit
+> lacking. It may also entice novide users to not use wikilinks and instead
+> use the hyperlinks that wmd does support. --[[Joey]] 
+
+> Bug: When I preview, all the text in the edit field seems to be
+> converted from mdwn to html. I think that wmd is converting the mdwn
+> into html when the form is posted, so it would also save like that.
+> I assume that is designed for websites that do not use markdown
+> internally. Doesn't it have a setting to leave it as markdown? --[[Joey]] 
index b6af75ac81dcd104a3d7be95578de49bf9ef0045..e411b127a406c9fde7f69c31853bdd7e7050ebdf 100644 (file)
@@ -6,7 +6,7 @@ ikiwiki - a wiki compiler
 
 ikiwiki [options] source destination
 
-ikiwiki --setup configfile
+ikiwiki --setup setupfile
 
 # DESCRIPTION
 
@@ -30,19 +30,19 @@ These options control the mode that ikiwiki operates in.
 
   Force a rebuild of all pages.
 
-* --setup configfile
+* --setup setupfile
 
   In setup mode, ikiwiki reads the config file, which is really a perl
   program that can call ikiwiki internal functions.
 
   The default action when --setup is specified is to automatically generate
-  wrappers for a wiki based on data in a config file, and rebuild the wiki.
+  wrappers for a wiki based on data in a setup file, and rebuild the wiki.
   If you only want to build any changed pages, you can use --refresh with
   --setup.
 
-* --dumpsetup configfile
+* --dumpsetup setupfile
 
-  Causes ikiwiki to write to the specified config file, dumping out
+  Causes ikiwiki to write to the specified setup file, dumping out
   its current configuration.
 
 * --wrappers
@@ -103,7 +103,8 @@ These options control the mode that ikiwiki operates in.
 # CONFIG OPTIONS
 
 These options configure the wiki. Note that [[plugins]] can add additional
-configuration options of their own.
+configuration options of their own. All of these options and more besides can
+also be configured using a setup file.
 
 * --wikiname
 
@@ -316,10 +317,28 @@ configuration options of their own.
 * --set var=value
   
   This allows setting an arbitrary configuration variable, the same as if it
-  were set via a configuration file. Since most options can be configured
+  were set via a setup file. Since most options can be configured
   using command-line switches, you will rarely need to use this, but it can be
   useful for the odd option that lacks a command-line switch.
 
+# EXAMPLES
+
+* ikiwiki --setup my.setup
+
+  Completly (re)build the wiki using the specified setup file.
+
+* ikiwiki --setup my.setup --refresh
+
+  Refresh the wiki, using settings from my.setup, and avoid
+  rebuilding any pages that have not changed. This is faster.
+
+* ikiwiki --setup my.setup --refresh --wrappers
+
+  Refresh the wiki, including regnerating all wrapper programs,
+  but do not rebuild all pages. Useful if you have changed something
+  in the setup file that does not need a full wiki rebuild to update
+  all pages, but that you want to immediatly take effect.
+
 # ENVIRONMENT
 
 * CC
index 891bcae65deb43ddb31aa87141c0dc906f4107e8..7590cdfd7d73c0cbf989fc5a0e82e9ea8b39cad3 100644 (file)
@@ -15,6 +15,7 @@ Subject: <TMPL_VAR FIELD-SUBJECT><br />
 <TMPL_VAR FORM-SUBMIT> <TMPL_VAR FIELD-TYPE> <TMPL_VAR HELPONFORMATTINGLINK><br />
 IkiWiki directives ([[!directive]]) are <TMPL_UNLESS NAME="ALLOWDIRECTIVES">not </TMPL_UNLESS>allowed in comments on this wiki.<br />
 <TMPL_VAR NAME="FORM-END">
+<TMPL_VAR WMD_PREVIEW>
 
 <TMPL_IF NAME="PAGE_PREVIEW">
 <hr />
index 4b54db2d15b9344ef14eb1fde87948d676b97ab4..b1cf015a2b2aa67adbc3b568d68102632a0a832f 100644 (file)
@@ -37,6 +37,7 @@ Optional comment about this change:<br />
 </div>
 </TMPL_IF>
 <TMPL_VAR FORM-END>
+<TMPL_VAR WMD_PREVIEW>
 
 <TMPL_IF NAME="PAGE_PREVIEW">
 <hr />