Folded Plugin

folded plugin by Esther Brunner
Foldable page sections

Last updated on 2008-08-13. Provides Syntax.
Compatible with DokuWiki 2007-06-26 and later.

Similar to hidden, outliner.

Tagged with collapsible, folding, hide, section.

This plugin is based on the inline folding plugin by ta' Lajżar and the slightly changed version thereof by Christopher Smith and Esther Brunner. A lot of the work was based on the older hacks (here and here) by Chris Stoll.

This one combines the features of all plugin variants in one.

Usage

If you want to make additional information available that is hidden by default, you have two options with this plugin:

Inline:

This is example ++text | with some of it only shown when you unfold it++. And after that
the text just continues to flow in the same paragraph.

Block:

This is example text.

++++ Title |

| This table | is only shown | when you unfold the block |

{{page>some other wiki page}}

++++
. Inline Block
Syntax ++title| formatted text ++ ++++title| any content ++++
HTML <span> tag <div> tag
Can contain formatting :-) :-)
Can contain block elements1) :-)
Can be used within a paragraph, table, list, etc. :-)

You can see the plugin in action here.

Note: As of version 2005-09-02 the syntax has changed to allow linked titles to unfold and fold the section. The pipe char between title and text is mandatory.

Installation

You can install this plugin with the plugin manager or the darcs plugin.

Please choose the package suitable to your DokuWiki version and also review the Revision List for additional update information.

Sources:

To install the plugin manually:

  1. download the source to your plugin folder, lib/plugins.
  2. extract the downloaded files contents.

That should create a new folder lib/plugins/folded containing all the files required by the plugin.

conf                 folder containing the configuration settings and their metadata
conf/default.php     default values for configuration settings
conf/metadata.php    configuration setting metadata used by [[plugin:config|Configuration Manger]]
lang                 folder containing all the localised language folders
lang/xx              xx = language code, there maybe several of these, at least one being en for english
lang/xx/lang.php     language strings for language code "xx"
lang/xx/settings.php configuration prompts used by [[plugin:config|Configuration Manger]]
script.js            JavaScript to handle hiding and revealing of folded content
style.css            styles for folding labels and folded content
open.gif             arrow image pointing right
closed.gif           arrow image pointing down
syntax               folder containing the plugin scripts
syntax/span.php      plugin script for inline folding (++)
syntax/div.php       plugin script for block folded (++++)

The plugin is now installed.

Configuration

There are two configuration settings which can be used to override the folder link tooltips. These will be most useful for DokuWiki installations using a language not included with the plugin.

reveal — the title tooltip to be used by folding links when the folded content is hidden. If left empty the localised string will be used.

hide — the title tooltip to be used by folding links when the folded content is showing. If left empty the localised string will be used.

Localisation

The following languages are included with the plugin. Please feel free to add the strings for your own language here and I will add them to the next release of the plugin. If your language isn't included at present, you can override the strings that are shown using the plugin's configuration settings as described above.

Language title string title string alt string alt string
Chinese(zh)显示 隐藏 显示隐藏内容 隐藏内容
Chinese(zh-tw)顯示 隱藏 顯示隱藏內容 隱藏內容
Czech zobrazit skrýt zobrazit skrytý obsah skrýt obsah
Danish vis skjul vis skjult indhold skjul indhold
Dutch tonen verbergen toon verborgen inhoud verberg inhoud
English reveal hide reveal hidden content hide content
French révéler cacher révéler le contenu caché cacher le contenu
German aufklappen zuklappen zeige den eingeklappten Inhalt verberge den Inhalt
Italian rivela nascondi rivela contenuto nascosto nascondi contenuto
Japanese 見せる 隠す 内容を表示 内容を隠す
Korean 드러냄 숨김 숨겨져있는 내용을 드러냅니다 내용을 숨깁니다
Polish pokaż ukryj pokaż ukrytą zawartość ukryj zawartość
Russian открыть скрыть показать скрытое оглавление скрыть оглавление
Spanish mostrar ocultar mostrar contenido oculto ocultar contenido
Swedish visa dölj visa dolt innehåll dölj innehåll
Thai แสดง ซ่อน แสดงเนื้อหาที่ซ่อนไว้ ซ่อนเนื้อหา
Turkish göster gizle gizlenen içeriği göster içeriği gizle

There are also two strings used in the admin/configuration page.

Language for hide string setting for reveal string setting
english Folding tooltip to hide<br />(leave empty to use localised string) Folding tooltip to reveal<br />(leave empty to use localised string)
Japanese隠すためのtooltip表示するためのtooltip

Code

develonly source is viewable at Chris's source repository

lib/plugins/folded/syntax/span.php

<?php
/**
 * Folded text Plugin: enables folded text font size with syntax ++ text ++
 *
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Fabian van-de-l_Isle <webmaster [at] lajzar [dot] co [dot] uk>
 * @author     Christopher Smith <chris@jalakai.co.uk>
 * @author     Esther Brunner <esther@kaffeehaus.ch>
 */
 
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
 
// maintain a global count of the number of folded elements in the page,
// this allows each to be uniquely identified
global $plugin_folded_count;
if (!isset($plugin_folded_count)) $plugin_folded_count = 0;
 
// global used to indicate that the localised folder link title tooltips
// strings have been written out
global $plugin_folded_strings_set;
if (!isset($plugin_folded_string_set)) $plugin_folded_string_set = false;
 
/**
 * All DokuWiki plugins to extend the parser/rendering mechanism
 * need to inherit from this class
 */
class syntax_plugin_folded_span extends DokuWiki_Syntax_Plugin {
 
   var $register_hook = false;
 
   /**
    * return some info
    */
    function getInfo(){
        return array(
            'author' => 'Fabian van-de-l_Isle',
            'email'  => 'webmaster@lajzar.co.uk',
            'date'   => '2008-08-13',
 
            'name'   => 'Folded Plugin – Inline',
            'desc'   => 'Enable inline folded text.
                         Syntax: ++title|folded content++',
            'url'    => 'http://www.dokuwiki.org/plugin:folded',
        );
    }
 
    function getType(){ return 'formatting'; }
    function getAllowedTypes() { return array('substition','protected','disabled','formatting'); }
    function getSort(){ return 405; }
    function connectTo($mode) { $this->Lexer->addEntryPattern('\+\+.*?\|(?=.*\+\+)',$mode,'plugin_folded_span'); }
    function postConnect() { $this->Lexer->addExitPattern('\+\+','plugin_folded_span'); }
 
   /**
    * Handle the match
    */
    function handle($match, $state, $pos, &$handler){
        if ($state == DOKU_LEXER_ENTER){
            $match = trim(substr($match,2,-1)); // strip markup
            $handler->status['plugin_folded'] = true;
 
            if (!$this->register_hook) {
 
              global $EVENT_HANDLER;
              $EVENT_HANDLER->register_hook('PARSER_HANDLER_DONE','BEFORE', $this, 'add_writestrings');
 
              $this->register_hook = true;
            }
        } else if ($state == DOKU_LEXER_UNMATCHED) {
            $handler->_addCall('cdata',array($match), $pos);
            return false;
        }
        return array($state, $match);
    }
 
   /**
    * Create output
    */
    function render($mode, &$renderer, $data) {
        global $plugin_folded_count, $plugin_folded_strings_set;
 
        if (empty($data)) return false;
        list($state, $cdata) = $data;
 
        if($mode == 'xhtml') {
            switch ($state){
               case DOKU_LEXER_ENTER:
                $plugin_folded_count++;
                $renderer->doc .= '<a class="folder" href="#folded_'.$plugin_folded_count.'">';
 
                if ($cdata)
                    $renderer->doc .= ' '.$renderer->_xmlEntities($cdata);
 
                $renderer->doc .= '</a><span class="folded hidden" id="folded_'.$plugin_folded_count.'">';
                break;
 
              case DOKU_LEXER_UNMATCHED:
                $renderer->cdata($cdata);
                break;
 
              case DOKU_LEXER_EXIT:
                $renderer->doc .= '</span>';
                break;
 
              case 'WRITE_STRINGS' :
                if (!$plugin_folded_strings_set) {
 
                  $hide = $this->getConf('hide') ? $this->getConf('hide') : $this->getLang('hide');
                  $reveal = $this->getConf('reveal') ? $this->getConf('reveal') : $this->getLang('reveal');
 
                  $renderer->doc .= '<span id="folded_reveal" style="display:none;"><!-- '.hsc($reveal).' --></span>';
                  $renderer->doc .= '<span id="folded_hide" style="display:none;"><!-- '.hsc($hide).' --></span>';
 
                  $plugin_folded_strings_set = true;
                }
            }
            return true;
        } else {
            if ($cdata) $renderer->cdata($cdata);
        }
        return false;
    }
 
    function add_writestrings(&$event, $param) {
 
      if (isset($event->plugin_folded)) return;
 
      // make sure the event is being generated for the handler instance we expect
      $handler =& $event->data;
      if (empty($handler->status['plugin_folded'])) return;
 
      // add WRITE_STRINGS instruction to the end of the instruction list
      $last_call = end($handler->calls);
      array_push($handler->calls, array('plugin', array('folded_span', array('WRITE_STRINGS',0), DOKU_LEXER_MATCHED), $last_call[2]));
 
      // prevent multiple handling of this event by folded plugin components
      $event->plugin_folded = true;
    }
}

lib/plugins/folded/syntax/div.php

<?php
/**
 * Folded text Plugin: enables folded text font size with syntax ++ text ++
 *
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Fabian van-de-l_Isle <webmaster [at] lajzar [dot] co [dot] uk>
 * @author     Christopher Smith <chris@jalakai.co.uk>
 * @author     Esther Brunner <esther@kaffeehaus.ch>
 */
 
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
 
// maintain a global count of the number of folded elements in the page,
// this allows each to be uniquely identified
global $plugin_folded_count;
if (!isset($plugin_folded_count)) $plugin_folded_count = 0;
 
// global used to indicate that the localised folder link title tooltips
// strings have been written out
global $plugin_folded_strings_set;
if (!isset($plugin_folded_string_set)) $plugin_folded_string_set = false;
 
/**
 * All DokuWiki plugins to extend the parser/rendering mechanism
 * need to inherit from this class
 */
class syntax_plugin_folded_div extends DokuWiki_Syntax_Plugin {
 
   /**
    * return some info
    */
    function getInfo(){
        return array(
            'author' => 'Fabian van-de-l_Isle',
            'email'  => 'webmaster@lajzar.co.uk',
            'date'   => '2008-08-13',
            'name'   => 'Folded Plugin - Block',
            'desc'   => 'Enable blocks of folded text.
                         Syntax: ++++title|folded content++++',
            'url'    => 'http://www.dokuwiki.org/plugin:folded',
        );
    }
 
    function getType(){ return 'container'; }
    function getPType() { return 'block'; }
    function getAllowedTypes() { return array('container','substition','protected','disabled','formatting'); }
    function getSort(){ return 404; }
    function connectTo($mode) { $this->Lexer->addEntryPattern('\+\+\+\+.*?\|(?=.*\+\+\+\+)',$mode,'plugin_folded_div'); }
    function postConnect() { $this->Lexer->addExitPattern('\+\+\+\+','plugin_folded_div'); }
 
   /**
    * Handle the match
    */
    function handle($match, $state, $pos, &$handler){
        if ($state == DOKU_LEXER_ENTER){
            $match = trim(substr($match,4,-1)); // strip markup
            $handler->status['plugin_folded'] = true;
 
            if (!$this->register_hook) {
 
              global $EVENT_HANDLER;
              $EVENT_HANDLER->register_hook('PARSER_HANDLER_DONE','BEFORE', $this, 'add_writestrings');
 
              $this->register_hook = true;
            }
        } else if ($state == DOKU_LEXER_UNMATCHED) {
            $handler->_addCall('cdata',array($match), $pos);
            return false;
        }
        return array($state, $match);
    }
 
   /**
    * Create output
    */
    function render($mode, &$renderer, $data) {
        global $plugin_folded_count;
 
        if (empty($data)) return false;
        list($state, $cdata) = $data;
 
        if($mode == 'xhtml') {
            switch ($state){
              case DOKU_LEXER_ENTER:
                $plugin_folded_count++;
                $renderer->doc .= '<p><a class="folder" href="#folded_'.$plugin_folded_count.'">';
 
                if ($cdata)
                    $renderer->doc .= ' '.$renderer->_xmlEntities($cdata);
 
                $renderer->doc .= '</a></p><div class="folded hidden" id="folded_'.$plugin_folded_count.'">';
                break;
 
              case DOKU_LEXER_UNMATCHED:                            // defensive, shouldn't occur
                $renderer->cdata($cdata);
                break;
 
              case DOKU_LEXER_EXIT:
                $renderer->doc .= '</div>';
                break;
 
              case 'WRITE_STRINGS' :
                if (!$plugin_folded_strings_set) {
 
                  $hide = $this->getConf('hide') ? $this->getConf('hide') : $this->getLang('hide');
                  $reveal = $this->getConf('reveal') ? $this->getConf('reveal') : $this->getLang('reveal');
 
                  $renderer->doc .= '<span id="folded_reveal" style="display:none;"><!-- '.hsc($reveal).' --></span>';
                  $renderer->doc .= '<span id="folded_hide" style="display:none;"><!-- '.hsc($hide).' --></span>';
 
                  $plugin_folded_strings_set = true;
                }
            }
            return true;
        } else {
            //  handle unknown formats generically - by calling standard render methods
            switch ( $state ) {
               case DOKU_LEXER_ENTER:
                $renderer->p_open();
                $renderer->cdata($cdata);
                $renderer->p_close();
                $renderer->p_open();
                break;
              case DOKU_LEXER_UNMATCHED:                            // defensive, shouldn't occur
                $renderer->cdata($cdata);
                break;
              case DOKU_LEXER_EXIT:
                $renderer->p_close();
                break;
            }
        }
        return false;
    }
 
    function add_writestrings(&$event, $param) {
 
      if (isset($event->plugin_folded)) return;
 
      // make sure the event is being generated for the handler instance we expect
      $handler =& $event->data;
      if (empty($handler->status['plugin_folded'])) return;
 
      // add WRITE_STRINGS instruction to the end of the instruction list
      $last_call = end($handler->calls);
      array_push($handler->calls, array('plugin', array('folded_span', array('WRITE_STRINGS',0), DOKU_LEXER_MATCHED), $last_call[2]));
 
      // prevent multiple handling of this event by folded plugin components
      $event->plugin_folded = true;
    }
}

lib/plugins/folded/style.css

.folder {
    padding-left: 2px;
    padding-right: 9px;
    background: url(closed.gif) no-repeat right center;
}
 
.folder.open {
    background: url(open.gif) no-repeat right center;
}
 
div.folded {
    padding: 0.5em;
    border: 1px dotted __medium__;
}
 
span.folded {
    border: 1px dotted __medium__;
}
 
span.indicator {
    visibility: hidden;
}
 
/* below style rules are created by JavaScript
.folded.hidden { display: none; }
.folder span.indicator { visibility: visible; }
*/

Revision List

  • 2008-08-13 — Update plugin URL
    • — add Dutch and Russian language strings
    • — add support for unknown render formats (uses standard render functions for output, no folding)
  • 2007-05-30 — Language strings updated, RC2007-05-24 & develonly only
    • — hide & hidelong strings added for all those languages missing them
    • — Danish & Turkish strings added
    • — Turkish strings added
  • 2007-01-24 — Italian strings added, darcs version only
  • 2006-12-15 — Swedish strings added, darcs version only
  • 2006-12-10 — Updated release files for DW 2006-11-06
    • develonly darcs version updated for removal of domLib functions (DW patched 2006-11-10)
  • 2006-05-22 — develonly zh-tw strings added, darcs version only
  • 2006-05-04 — develonly Major revision
    • JavaScript made unobtrusive
    • fix hidden folded sections for browsers without JavaScript and for printing
    • localised title tooltip prompts embedded in HTML comments where JavaScript can access them
    • title tooltips can be overridden using config settings allowing wiki admins to use languages missing from the plugin.
    • toggle graphic moved to background
  • 2006-01-06 — remove trim() from UNMATCHED rendering
  • 2005-12-31 — package update with language strings for cs (Czech), ja (Japanese), ko (Korean), po (Polish) & zh (Chinese). No source changes.
  • 2005-09-18 — source updated and initial release on darcs (see link above)

Requested Features / To Do

  • allow title formatting — Fred 2007-06-20 15:54
  • ADDED allow JavaScript to change title and alt strings from reveal to hide in appropriate language
  • ADDED organize things so the page still displays meaningfully in browsers without JavaScript – The way to do this would be to set default visibility to normal in the CSS file (i.e. have no entry in the display:xxxx section), then have a JavaScript set all the folding sections to display:none when the page loads up. — ta' Lajzar 2005-09-19 14:50
  • ADDED make title optional
  • Nesting folding sections… can be use for tree display and maybe other stuff —- Stephane Chamberland 2006-01-09
  • When displaying search results, folded text needs to be displayed if it contains a search hit — Henry Olders 2006-04-08
  • Make html id easier to understand. (for example I can put a link here based on the name, but the folded plugin ids are #folded_n - and if I link to that the folded section is not unfolded. This would make it much easier to do things for FAQs & such, like we are using. See?
  • Have an “unfold all” option on the page, to allow browser text searches for pages like this.
    • Have “fold all” option as well
    • Allow the “unfold all” option to be optionally set as the page default (everything is unfolded when page opens)

Discussion

See the plugin in action here.

Pascal Giard 2005-08-25 06:08

You need to upgrade to at least release 2005-09-19 of DokuWiki.

The latest version seems semi-broken. The title as it stands is required, and so all older documents will not parse correctly. Also, after the first time you click on the title, the title disappears and does not return. Also, I wonder if having a pipe character is really the best way to delimit the title, assuming the title is intended to be optional. Currently, a pipe is required for smooth parsing. ++| is the minimum opening tag. — ta' Lajzar 2005-09-04 09:01

I agree with ta' Lajzar, it would be nice if the | was optional. — Christopher Smith 2005-09-06 19:11

Would it be better to change the syntax to something like this:

<fold "my title here">
 this is my folded text
</fold>

That way the title could more easily be optional??.. I know this changes the format and breaks existing pages but it may help with the overall issue. I'm not sure how easy it is to handle a title with interesting characters/spaces in the <fold> statement. Anyway, just a thought. — Matt Pascoe 2005-09-13


If you are writing something about C++, you will see how bad it is! Remember to add “nowiki” around your C++ or otherwise, it will be messed up with the folding plugin. — Adrian Sai-wah Tam 2005-10-10 14:16

Yes, you are right. The markup code used for this plugin is incompatible with many, many programming languages. However, I assumed that any actual code would be enclosed in <code> tags, which automatically prevent anything enclosed from being parsed. If you need to have a ++ in your page outside a <code> tag, be sure to enclose it in a pair of percent (%) marks (view source of this paragraph for an example). Really, given that there are two distinct methods already for preventing markup from being parsed, I regard this as a non-issue. — ta' lajzar 2005-10-11 09:59


I'm using the current devel version from darcs (2006-01-07), and the unfolded results have all the spaces stripped out of them. Adding some debug to the handle(), and it appears that each space is coming through as a DOKU_LEXER_UNMATCHED value and the text is just passing through (handle() never sees it). I thought everything from the | to the last ++++ was supposed to show up in handle() as one string… maybe because of some 'bad' interaction of the ++++ or | with the Lexer?

There is a trim() as part of the rendering of DOKU_LEXER_UNMATCHED data. It wasn't there in the original code but was added at some point. Since I have no notes of the reason for it being there and can't think of any myself I have removed it and updated the release packages and darcs. If anyone does recall a reason for it being there please let me know. — Christopher Smith 2006-01-07 15:10

Doesn't appear to work with latest version 2006-03-09, just nothing happens. Apache 1.3.33 w/PHP 4.3.10 installed on Ubuntu Hoary I believe. – bw contact

It still works fine for me (example). When first loading a page do the folded parts appear visible or hidden? Do you get any JavaScript errors? — Christopher Smith 2006-03-22 14:48
Try to add this to your conf/local.php. Solved some problems (JavaScript-errors) for me.
$conf['basedir'] = '';
$conf['baseurl'] = '';

Arne Nickel 2006-04-04 00:02

This doesn't work for me in the new version. Nor does Chris's example. I don't see how the JavaScript and the CSS are being included. Only when I manually include these via main.php do I get it to work. (Brand new versions of Apache and PHP, too.) — 2006-07-18
DokuWiki should automatically take care of the JavaScript and CSS, merging the plugin's files with its own files. For example, if you take a look at my example page and view the JavaScript you should see the JavaScript for the folded plugin merged near the bottom (search on “folded” to locate quickly). I have CSS/JavaScript compression turned off to make it readable, but other than that its standard DokuWiki. Do you have a page link? — Christopher Smith 2006-06-19 12:22
Hmmm… It's working for me now. (I also understand how JavaScript and CSS work in this new version, now. Very cool.) This is actually a problem with my browser—Firefox 1.5 on Mac OS X 10.4.6. Loading a Java applet (nothing to do with JavaScript!!) seems to do terrible things to the browser. I cleared my cache, restarted Firefox, and suddenly both Chris's and my site work. I know this doesn't make much sense, but it is reproducible.

This is a great plugin but it interferes with printing documentation that is collapsed onscreen. The default state for printing should not be folded.

fixed in development release — Christopher Smith 2006-05-04 18:37

I agree - great plugin! Works very well on one website: http://www.wma-amw.org/wiki/doku.php?id=test_of_outliner_plugin

but not on another website! http://henry.olders.ca/fmpatientdb/dwiki/doku.php?do=show&id=test_page_for_folded_and_outline_plugins

I can't figure out what is the difference between the two. Please help! — Henry Olders 2006-06-28 04:28

The second website isn't picking up the styles and JavaScript for the plugin. There is a bug in March release whereby the CSS and JavaScript caches aren't expired after installation of a plugin. You will need to expire the cache manually. You can do that by updating your local.php to change its last modified date. — Christopher Smith 2006-06-28 10:17

Doesn't work for me. The plugin stop HTML in

<!-- wikipage start -->

and the page is empty… :-( :?: HELP! Sergio 2006-07-20 11:24

Hi Sergio,
The symptom you have described indicates a fatal php error is occurring. Can you:
(1) Check your PHP error log to determine the cause of the error?
(2) Give some more details about your wiki installation - e.g. Product and version for OS, Webserver & PHP, also what other plugins you are using with your wiki.
Christopher Smith 2006-07-20 15:12

Doesn't work - the JavaScript is not included, and I get a JavaScript error on calls to “fold”. I tried re-starting my server (IIS with PHP), clearing cache (ie6) - no change. Any ideas?

Touch your conf/local.php to update the last modified date and expire all DokuWiki's cache's. DokuWiki should now regenerate the JavaScript it supplies to the browser. Its a known bug and will be fixed on the next release. — Christopher Smith 2006-08-15 09:24

Can you limit level of inclusions of nested folded sections? I have many levels and it takes a lot of time to include all those sub-pages (each folded includes a page). — Borut Jures 2006-11-06 22:41


This (very useful) plugin currently relies on domLib.js, which is not included in the latest release of DokuWiki. In dokuwki/lib/plugins/folded/script.js replace line 55:

var folds = domLib_getElementsByClass('folder');

by:

var folds = getElementsByClass('folder');

Olivier Pichon 2006-11-23 15:18


This is an extremely useful plugin, and is working very well on my installation of DokuWiki, which is 2006-11-06 version. However, ever since I have installed this plugin (from the dev version), On saving a page after edit gives me the warning “Warning: Cannot modify header information - headers already sent by (output started at path_to_DokuWiki-2006-11-06\lib\plugins\folded\syntax\div.php:1) in path_to_DokuWiki-2006-11-06\inc\actions.php on line 287”. On installing the plugin from the tar file given on this page, the plugin simply does not work. I don't know PHP, so I am afraid I cannot provide any more debug information. Any help will be greatly appreciated. Thanks!!

Check the first file mentioned. It sounds like you have some characters outside of the <?php ?> tags. As for the plugin not working, refer to the fix on the comment below. — Christopher Smith 2006-12-10 03:09
I'm running the 2006-11-06 version, also, on WinXP and IIS, and the plugin does absolutely nothing. Doesn't work. Doesn't break anything. I tried clearing the cache and updating my Local.php to include the basedir and baseurl constants. I also edited the Script.js, to remove the “domLib_” prefix. (That's mentioned twice on this page, BTW. Above and below this comment.) None of this makes any difference. Any other suggestions? — DGM2 2007-01-05 01:04
If you are using 2006-11-06 (the current version) you should NOT remove the “domLib_” prefix. The comments above and below refer to users of snapshots or devel version (after 2006-11-10). If you aren't seeing the plugin's syntax in the rendered page then the plugin is functioning. In which case your browser isn't receiving the JavaScript necessary to operate the folding or the JavaScript is causing errors in your browser. What browser are you using? Does the folding work on this test page? That Wiki is running develonly DokuWiki and the latest version of the plugin. If it runs ok you can try a recent snapshot. Otherwise I can set up a test page on a 2006-11-06 wiki with the same plugin version you would be using. — Christopher Smith 2007-01-07 03:39

Hi,
I am using the latest version of DokuWiki with latest Monobook template downloaded yesterday (where can I see the versions?) The plugin is from ZIP. It does not unfold, neither block nor inline. I cannot find a line 55 (see above) in dokuwki/lib/plugins/folded/script.js. Can anyone help?
TIA
Peter Stiens 2006-12-07 14:44

One of DokuWiki's JavaScript libraries was changed, its altered the name of a function used by this plugin. Goto to line #55 of lib/plugins/folded/script.js and remove the domLib_ so that the line becomes
 var folds = getElementsByClass('folder');

I will go through all the plugins I'm responsible for as soon as I can to update them for changes in the new version of DokuWiki. — Christopher Smith 2006-12-10 02:59


Nice plugin, I got it working OK on version 2006-03-09 (will be upgrading to current wiki soon), but ideally I'd like actual header sections to be able to display the section name/title but have the content of everything under than header collapsible (with controllable default open/close). I'm not sure if I'm explaining it right but basically display any H1 - H5 header but with the arrow to the right of it and have the header title itself the link to expand / collapse it's own section. Is this possible now or will it be in an upcoming version or is it not possible on the DokuWiki engine at all? Thanks.
No that isn't feasible with this plugin. I'm not likely to attempt to implement it as messing with DokuWiki's headings is messy! If you need to your collapsing based on headings take a look through the templates. I seem to recall someone reworking things so Sections were properly nested (DokuWiki doesn't do that now). If you have properly nested sections, a JavaScript solution is probably easier than a plugin. — Christopher Smith 2007-01-18 09:51

Thanks a lot, its working fine, now. May I place a feature request right here? Have you ever noticed, that many Online-Help-System allow to fold a whole chapter? Can someone please integrate the Folded-Plugin to work with the Chapter headings. S.th. Like

This is example text.

++++ ====== This is a H1-Title ====== |

| This table | is only shown | when you unfold the block |

{{page>some other wiki page}}

++++

Thank you all and of course the author(s) of this plugin in advance. Best regards.
Would be very nice if this would be implemented.
Peter Stiens 2006-02-01 11:30


Thank you for a nice plug-in. I think it very useful for all users.
I made some sentences in Japanese more natural.

I.Obataya 2006-02-10 13:30


Nice Work, but is there anyway to make the plugin compatible with safari??? It appears to work for explorer, Firefox, and Opera. Thanks. Austen Heinz 2007-4-7


I thought that I could put a “discussion” in a fold like so:

++++ Disc fold |
   ~~DISCUSSION~~
++++

but it does not work

any ideas?

fred 2007-05-09


Does anyone know if this works with DokuWiki Release 2007-06-26? It's not for me… as if the JavaScript is not being included ot there is some kind of incorrect link structure being defined. I don't see any comments from people using Release 2007-06-26, so I'm assuming perhaps it's a version conflict? –Ryan

I have the same problem. Hope to hear something from the author. – Albert
maybe you should Ctrl+F5

Hi! I am trying to use this plugin version 2007-06-26 and it doesn't work, then I tried with the other two older versions and nothing, the DokuWiki version I am using is DokuWiki-2007-06-26b.tgz….

please, any ideas?????

-Alejandro 11-14-07


Alejandro: modify last line of /folded/script.js as follows:

...folder .indicator { **display: block;** visibility: visible;

I had to change these lines in script.js

function folded_toggle(evt)
...
evt.preventDefault();

to

function folded_toggle(e)
...
e.preventDefault();

so that it did not give an error when there was a header such as

===== E =====

defined. I think an actual object named “e” was causing it to fail.

Is this the correct solution, and will it be OK on other browsers?

todd@rollerorgans.com 2007/12/22


Text does not unfold for me. Also, I don't see any fold/unfold arrows. DokuWiki 20080505, Firefox 3.0.0. Also does not unfold on the test page. Help? Thanks—

Andrew 2008/07/16

Use the suggestion above proposed by Arne Nickel, add $conf[basedir]… stuffs in your local.php. It works for m

How do I move the arrow icon to the other side of the text? I've had a look at the code but I'm not up on JavaScript and I can't see what to do. Laurence


FYI If you want to update automatically and get “Unable to download the plugin file: http://www.cdsmith.plus.com/dokuwiki/plugin-folded-2006-11-06.zip” it is because you did not update quite some time, the referred site has been removed. You have to update manually to latest version.

:-( I can not download the plugin, I have tried many days to download. Ping of the “www.cdsmith.plus.com” is ””. I need other download link!!! Could any one help me? VERY thanks. endlesslove@zju.edu.cn 2009-04-19

:!: There is a problem when JavaScript is disabled! (DokuWiki 2009-02-14, Folded-plugin 2008-08-13) The class ”.hidden” is defined by the template or any other plugin's CSS file. Therefore the folded content is NOT displayed when JavaScript is disabled. Solution: in all folded-plugin-files rename all mentions of the “hidden”-class with for example “fhidden”. — F. 2009-03-03


(Un)folding doesn't seem to work with latest version of include plugin (2009-03-26) in dokuwiki version 2009-02-14. E.g. ++++Test title|{{page>testpage}}++++ shows always the included page (no folding) — wide 2009-04-08


thank you F. for the tip. thank you author for the plugin.

cd lib/plugins/folded
echo "converting all instances of hidden to fhidden"  
for item in `find . -type f`
do     
    echo "doing $item ..."
    sudo sed -i -e "s/hidden/fhidden/g" $item
done

(I had to run sudo because the wiki is owned by www-data) — Ivan 2009-05-08


It works on my local test installation, but not the on the hosted server. Any Ideas? — Bernd M. Radowicz 2009/06/14 05:47

1) like tables, lists, new paragraphs, included files, etc.
 
plugin/folded.txt · Last modified: 2009/06/21 16:47 by ach
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsDarcsXRefTranslate