snippets plugin

Compatible with DokuWiki

  • 2012-01-25 "Angua" unknown
  • 2011-05-25 "Rincewind" yes
  • 2010-11-07 "Anteater" yes

plugin Adds a button to the editor toolbar which allows to easily insert templates while editing a page.

Last updated on
2010-01-04
Provides
Syntax, Action
Repository
Source

Tagged with editing, template, toolbar


The existing JavaScript code in the plugin isn't compatible to the Angua release, so the plugin won't work anymore. (The JavaScript has to be jQuery'ized first.)

Are you sure? I have upgraded and my snippets is still working.. —senorandysenorandy

2012/02/06 14:02

Description

This plugin adds a new button to editor toolbar. When clicking on it a popup shows up, showing a list of page templates which can be previewed and inserted into the editor window. The list of templates is defined using a Wiki page which contains a simple unordered list of links to pages which should be used as templates.

Installation

Download and install the plugin using the Plugin Manager using the following URL. Refer to Plugins on how to install plugins manually.

  • .tgz Plugin Manager

You can also install the plugin using git:

% cd <dokuwiki>/lib/plugins
% git clone git://github.com/chimeric/dokuwiki-plugin-snippets.git snippets

IMPORTANT: You have to invalidate/delete the cache before the new button appears in the toolbar.

Configuration

You can specify the wiki page which defines the list of page templates, defaults to snippets.

Usage

Just create the page you configured in the configuration manager (defaults to snippets) and add your list of template pages (nothing else). Then create your template pages as well and you're ready to go (you might want to save all your templates in a dedicated namespace so you can use the hidepages option to hide them in the index etc.).

You can use the following syntax inside your template to provide additional comments which will get stripped out when you insert the template into the current page you're editing.

<snippet>
Additional comments, i.e. you have to provide the following information:

  * foo
  * bar
</snippet>

Bugs / Feature Requests

Please report bugs and feature requests at the bug tracker.

Changelog

A complete changelog is available here.

Discussion

Don't post bug report here, use the bug tracker instead.

get it working

The hint “to clean the cache or to invalidate it”, didn't help much. (deleting files in cache, attic, etc. folders didn't show any effect; neither before nor after installation or visiting page)

What reproducibly worked:

  1. unpack clean installation
  2. copy plugin in plugin-folder
  3. create a page “snippets” with a bullet-list in the page-folder (root)
  4. run install.php
  5. when open editing mode you should see the icon

hint: just move the user data to new version and everything's fine.

annotation: in general “icon-editing plugins” are easy to install

helpful addition

use indexmenu-plugin to create an unordered list:

{{indexmenu>.|tsort context id#2}}

The files are stored in the configured folder/ subfolders, e.g.

/templates
 orderform.txt
 contentview.txt
/plugins
 acl.txt
 indexmenu.txt
 ...
/<further folders>

Errors

I got the plugin to install and even got the cache to refresh so I could see the button. But when I pressed the button and see the template screen I cannot add anything from it to my article. This bug makes this plugin less than useless.

I have the same problem as described above. Anyone with a solution?

The fastest solution is:
Locate \lib\plugins\snippets\exe\snippets.php file and find this line:
if(!page_exists($page) or auth_quickaclcheck($page) < AUTH_READ) die();

and change it to:

if (!page_exists($page)) die();
I wouldn't label removing the permission check from a line as a solution. If you have read-access to the configured snippets page, this shouldn't be necessary. — M. S.M. S.
lupo49

DE / NRW / Sauerland
2011/05/02 15:42

Release 2011-11-10 "Angua RC1"

The Plugin doesn't work anymore after updating Rincewind to Angua. The Button in the edit-window is still there, but when I click on a snip it only opens the page and the code is not pastet in. Please update. That's really a nice plugin. (20.11.2011)

plugin/snippets.txt · Last modified: 2012/02/06 14:04 by senorandy
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsGitXRefTranslate