edit.inc.php
Tag: PukiWiki Old Plus Hack
First Edition. 06/08/2006
Last Modified. 06/08/2006
Last Modified. 06/08/2006
Hack:Partedit including sub-sections - Now Plus had this
| Summary | Partedit including sub-sections |
|---|---|
| Revision | 1.1 |
| Compatible Versions | Verified with 1.4.6-u2-i18n |
| Developer | sonots |
| First Edition | 06/08/2006 |
| Last Modified | 06/08/2006 |
| License | GPL |
| Table of Contents |
This page is written in both English and Japanese.
Abstract
This hack of edit.inc.php extends the part edit functionality of pukiwiki plus and enables to part-edit a section including subsections not from a section to next section in spite of their heading levels.
That is, default way was,
*Heading 1 Only here **Heading 2 *Heading 1
but this enables to edit like belows.
*Heading 1 **Heading 2 Until here *Heading 1
We often move writing among subsections. This plugin supports doing that.
Related
- plus:質問箱/85
-- サブセクションまとめての部分編集 - dev:BugTrack/585
-- 見だし編集機能を本体に組み込んで欲しい
Source codes
I changed edit.inc.php#plugin_edit_parts into
// Replace/Pickup a part of source
function plugin_edit_parts($id, &$source, $postdata='')
{
$postdata = rtrim($postdata) . "\n";
$start = -1;
$end = count($source);
foreach ($source as $i => $line) {
if ($start == -1) {
if (preg_match("/^(\*{1,3})(.*?)\[#($id)\](.*?)$/m", $line, $matches)) {
$start = $i;
$hlen = strlen($matches[1]);
}
} else {
if (preg_match("/^(\*{1,3})/m", $line, $matches) && strlen($matches[1]) <= $hlen) {
$end = $i;
break;
}
}
}
if ($start == -1) {
return FALSE;
} else {
return join('', array_splice($source, $start, $end - $start, $postdata));
}
}
Comments
./Note


