From 0978be7affa6222d91a0bc71ddd1e86f81fc56cd Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 9 Mar 2009 00:30:19 +0100 Subject: po: fixed last unaddressed item from Joey's review, please have a look Signed-off-by: intrigeri --- doc/plugins/contrib/po.mdwn | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 8b19afae6..c39008466 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -320,3 +320,11 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] >> --[[intrigeri]] > > --[[Joey]] + +I reverted the `%backlinks` and `$backlinks_calculated` exposing. +The issue they were solving probably will arise again when I'll work +on my meta branch again (i.e. when the simplified po one is merged), +but the po thing is supposed to work without these ugly `our`. +Seems like it was the last unaddressed item from Joey's review, so I'm +daring a timid "please pull"... or rather, please review again :) +--[[intrigeri]] -- cgit v1.2.3 From 200d0fca370e113ecd31c38a31ba51c5532c94b6 Mon Sep 17 00:00:00 2001 From: "http://www.cse.unsw.edu.au/~willu/" Date: Sun, 8 Mar 2009 19:40:47 -0400 Subject: Dump untested updates so that others can have a look (I wont have time for a few weeks). --- doc/todo/mdwn_preview.mdwn | 215 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 215 insertions(+) diff --git a/doc/todo/mdwn_preview.mdwn b/doc/todo/mdwn_preview.mdwn index 3008eb529..bbb105041 100644 --- a/doc/todo/mdwn_preview.mdwn +++ b/doc/todo/mdwn_preview.mdwn @@ -87,3 +87,218 @@ remains. Some CSS to clean up the display of the live WMD preview would be good > I assume that is designed for websites that do not use markdown > internally. Doesn't it have a setting to leave it as markdown? >> Found setting, fixed. --[[Joey]] + +>>> As I noted above, I've been working on the non-markdown page issue. +>>> Below is my a new javascript file that I'm using, and below that a patch +>>> to enable it. This patch makes the normal usage prettier - you get +>>> a side panel with the live preview in it. It also adds a new config +>>> option, `wmd_use101api`, which turns on code that tries to use the +>>> wmd api. At the moment this code doesn't seem to work - moreover the +>>> code that uses the new API dies early, so any code after that point is +>>> completely untested. I will not +>>> get a chance to look at this again soon though, so I thought I'd post +>>> my progress so far. -- [[Will]] + + +Place the following file in `underlays/wmd/wmd-ikiwiki.js`. + +---- + + // This is some code to interface the WMD interface 1.0.1 with IkiWiki + // The WMD interface is planned to change, so this file will likely need + // updating in future. + + if (useWMDinterface) { + wmd_options = { autostart: false, output: "Markdown" }; + var instance = null; + + hook("onload", initwmd); + } else { + var typeSelector = document.getElementById("type"); + + var currentType = getType(typeSelector); + + if (currentType == "mdwn") { + wmd_options = { output: "Markdown" }; + document.getElementById("wmd-preview-container").style.hidden = false; + } else { + wmd_options = { autostart: false }; + document.getElementById("wmd-preview-container").style.hidden = true; + } + } + + function initwmd() { + if (!Attacklab || !Attacklab.wmd) { + alert("WMD hasn't finished loading!"); + return; + } + + var typeSelector = document.getElementById("type"); + + var currentType = getType(typeSelector); + + if (currentType == "mdwn") { + enableWMD(); + } + + typeSelector.onchange=function() { + var docType=getType(this); + + if (docType=="mdwn") { + enableWMD(); + } else { + disableWMD(); + } + } + } + + function getType(typeSelector) + { + if (typeSelector.nodeName.toLowerCase() == 'input') { + return typeSelector.getAttribute('value'); + } else if (typeSelector.nodeName.toLowerCase() == 'selector') { + return typeSelector.options[typeSelector.selectedIndex]; + } + return ""; + } + + function enableWMD() + { + var editContent = document.getElementById("editcontent"); + var previewDiv = document.getElementById("wmd-preview"); + var previewDivContainer = document.getElementById("wmd-preview-container"); + + previewDivContainer.style.hidden = false; + // editContent.style.width = previewDivContainer.style.width; + + /***** build the preview manager *****/ + var panes = {input:editContent, preview:previewDiv, output:null}; + var previewManager = new Attacklab.wmd.previewManager(panes); + + /***** build the editor and tell it to refresh the preview after commands *****/ + var editor = new Attacklab.wmd.editor(editContent,previewManager.refresh); + + // save everything so we can destroy it all later + instance = {ta:textarea, div:previewDiv, ed:editor, pm:previewManager}; + } + + function disableWMD() + { + document.getElementById("wmd-preview-container").style.hidden = true; + + if (instance != null) { + instance.pm.destroy(); + instance.ed.destroy(); + //inst.ta.style.width='100%' + } + instance = null; + } + + +---- + + diff --git a/IkiWiki/Plugin/wmd.pm b/IkiWiki/Plugin/wmd.pm + index 9ddd237..743a0b8 100644 + --- a/IkiWiki/Plugin/wmd.pm + +++ b/IkiWiki/Plugin/wmd.pm + @@ -17,6 +17,13 @@ sub getsetup () { + return + plugin => { + safe => 1, + + rebuild => 1, + + }, + + wmd_use101api => { + + type => "boolean", + + description => "Use the advanced, but unstable, WMD api for markdown preview.", + + safe => 0, + + rebuild => 0, + }, + } + + @@ -24,29 +31,25 @@ sub formbuilder_setup (@) { + my %params=@_; + my $form=$params{form}; + + - return if ! defined $form->field("do"); + + return unless defined $form->field("do"); + + return unless $form->field("do") eq "edit" || + - $form->field("do") eq "create" || + - $form->field("do") eq "comment"; + - + - $form->tmpl_param("wmd_preview", "
\n". + - include_javascript(undef, 1)); + -} + - + -sub include_javascript ($;$) { + - my $page=shift; + - my $absolute=shift; + - + - my $wmdjs=urlto("wmd/wmd.js", $page, $absolute); + - return <<"EOF" + - + - + -EOF + + $form->field("do") eq "create" || + + $form->field("do") eq "comment"; + + + + my $useAPI = $config{wmd_use101api}?'true':'false'; + + my $ikiwikijs = urlto("ikiwiki.js", undef, 1); + + my $wmdIkiwikijs = urlto("wmd-ikiwiki.js", undef, 1); + + my $wmdjs = urlto("wmd.js", undef, 1); + + + + my $previewScripts = <<"EOS"; + + + + + + + + + +EOS + + + + $form->tmpl_param("wmd_preview", $previewScripts); + } + + 1 + diff --git a/doc/style.css b/doc/style.css + index a6e6734..36c2b13 + --- a/doc/style.css + +++ b/doc/style.css + @@ -76,9 +76,16 @@ div.tags { + float: right; + } + + +/* + #editcontent { + width: 100%; + } + +*/ + + + +#wmd-preview-container { + + width: 49%; + + float: right; + +} + + img { + border-style: none; + diff --git a/templates/editpage.tmpl b/templates/editpage.tmpl + index b1cf015..1d2f080 100644 + --- a/templates/editpage.tmpl + +++ b/templates/editpage.tmpl + @@ -15,6 +15,14 @@ Page type: + + + + + + +
+ +
+ +Live preview: + +
+ +
+ +
+ +
+
+ + Optional comment about this change:
-- cgit v1.2.3 From a948f6d275668236a2c005f14fcf713f9933d9d7 Mon Sep 17 00:00:00 2001 From: "http://www.cse.unsw.edu.au/~willu/" Date: Mon, 9 Mar 2009 08:39:42 -0400 Subject: Update the javascript - this now turns things on and off based on the type. It still has some display issues. --- doc/todo/mdwn_preview.mdwn | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/doc/todo/mdwn_preview.mdwn b/doc/todo/mdwn_preview.mdwn index bbb105041..c20314c28 100644 --- a/doc/todo/mdwn_preview.mdwn +++ b/doc/todo/mdwn_preview.mdwn @@ -120,10 +120,10 @@ Place the following file in `underlays/wmd/wmd-ikiwiki.js`. if (currentType == "mdwn") { wmd_options = { output: "Markdown" }; - document.getElementById("wmd-preview-container").style.hidden = false; + document.getElementById("wmd-preview-container").style.display = 'none'; } else { wmd_options = { autostart: false }; - document.getElementById("wmd-preview-container").style.hidden = true; + document.getElementById("wmd-preview-container").style.display = 'block'; } } @@ -138,7 +138,7 @@ Place the following file in `underlays/wmd/wmd-ikiwiki.js`. var currentType = getType(typeSelector); if (currentType == "mdwn") { - enableWMD(); + window.setTimeout(enableWMD,10); } typeSelector.onchange=function() { @@ -156,8 +156,9 @@ Place the following file in `underlays/wmd/wmd-ikiwiki.js`. { if (typeSelector.nodeName.toLowerCase() == 'input') { return typeSelector.getAttribute('value'); - } else if (typeSelector.nodeName.toLowerCase() == 'selector') { - return typeSelector.options[typeSelector.selectedIndex]; + } else if (typeSelector.nodeName.toLowerCase() == 'select') { + return typeSelector.value; + // return typeSelector.options[typeSelector.selectedIndex].innerText; } return ""; } @@ -168,7 +169,7 @@ Place the following file in `underlays/wmd/wmd-ikiwiki.js`. var previewDiv = document.getElementById("wmd-preview"); var previewDivContainer = document.getElementById("wmd-preview-container"); - previewDivContainer.style.hidden = false; + previewDivContainer.style.display = 'block'; // editContent.style.width = previewDivContainer.style.width; /***** build the preview manager *****/ @@ -179,17 +180,17 @@ Place the following file in `underlays/wmd/wmd-ikiwiki.js`. var editor = new Attacklab.wmd.editor(editContent,previewManager.refresh); // save everything so we can destroy it all later - instance = {ta:textarea, div:previewDiv, ed:editor, pm:previewManager}; + instance = {ta:editContent, div:previewDiv, ed:editor, pm:previewManager}; } function disableWMD() { - document.getElementById("wmd-preview-container").style.hidden = true; + document.getElementById("wmd-preview-container").style.display = 'none'; if (instance != null) { instance.pm.destroy(); instance.ed.destroy(); - //inst.ta.style.width='100%' + // inst.ta.style.width='100%' } instance = null; } -- cgit v1.2.3 From 7de791ad8e5f4e9aeacdadc77be56e46cfae2bf8 Mon Sep 17 00:00:00 2001 From: "http://madduck.net/" Date: Mon, 9 Mar 2009 11:21:36 -0400 Subject: --- doc/bugs/Git:_web_commit_message_not_utf-8.mdwn | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 doc/bugs/Git:_web_commit_message_not_utf-8.mdwn diff --git a/doc/bugs/Git:_web_commit_message_not_utf-8.mdwn b/doc/bugs/Git:_web_commit_message_not_utf-8.mdwn new file mode 100644 index 000000000..71ccff3a3 --- /dev/null +++ b/doc/bugs/Git:_web_commit_message_not_utf-8.mdwn @@ -0,0 +1,13 @@ +The message generated for web commits: + +> web commit by madduck + +is not utf-8 encoded before passed to Git (which uses utf-8 as default encoding for commit messages). This causes a wrongly-encoded log entry, and makes ikiwiki spew warnings as it creates `recentchanges`: + + utf8 "\xF6" does not map to Unicode at /usr/share/perl5/IkiWiki/Rcs/git.pm line 36, <$OUT> line 57. + Malformed UTF-8 character (unexpected non-continuation byte 0x6e, immediately after start byte 0xf6) in pattern match (m//) at /usr/share/perl5/IkiWiki/Rcs/git.pm line 393. + utf8 "\xF6" does not map to Unicode at /usr/share/perl5/IkiWiki/Rcs/git.pm line 36, <$OUT> line 5. + +(This is version 2.53.3~bpo40+1 for lack of a newer backport for sarge) + +Please make sure that commit messages for Git are always utf-8. -- cgit v1.2.3 From 0158ab41dae373f9c8a687602516887ae4761292 Mon Sep 17 00:00:00 2001 From: "http://madduck.net/" Date: Mon, 9 Mar 2009 11:22:26 -0400 Subject: actually use utf-8 --- doc/bugs/Git:_web_commit_message_not_utf-8.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/bugs/Git:_web_commit_message_not_utf-8.mdwn b/doc/bugs/Git:_web_commit_message_not_utf-8.mdwn index 71ccff3a3..e0a756f93 100644 --- a/doc/bugs/Git:_web_commit_message_not_utf-8.mdwn +++ b/doc/bugs/Git:_web_commit_message_not_utf-8.mdwn @@ -1,6 +1,6 @@ The message generated for web commits: -> web commit by madduck +> web commit by mädduck is not utf-8 encoded before passed to Git (which uses utf-8 as default encoding for commit messages). This causes a wrongly-encoded log entry, and makes ikiwiki spew warnings as it creates `recentchanges`: -- cgit v1.2.3 From b978a5773ea7a363d9588f6825ac5e47e32d4453 Mon Sep 17 00:00:00 2001 From: mädduck Date: Mon, 9 Mar 2009 13:50:49 -0400 Subject: --- doc/bugs/Git:_web_commit_message_not_utf-8.mdwn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/bugs/Git:_web_commit_message_not_utf-8.mdwn b/doc/bugs/Git:_web_commit_message_not_utf-8.mdwn index e0a756f93..25a94711c 100644 --- a/doc/bugs/Git:_web_commit_message_not_utf-8.mdwn +++ b/doc/bugs/Git:_web_commit_message_not_utf-8.mdwn @@ -11,3 +11,5 @@ is not utf-8 encoded before passed to Git (which uses utf-8 as default encoding (This is version 2.53.3~bpo40+1 for lack of a newer backport for sarge) Please make sure that commit messages for Git are always utf-8. + +This is a change by user `mädduck` to trigger the error. -- cgit v1.2.3