DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:bookmark

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:bookmark [2018-05-30 20:58] Klap-inplugin:bookmark [2021-03-14 22:50] (current) – [Allow space and dash in bookmarkname] davidtango
Line 6: Line 6:
 email      : otto@valjakko.net email      : otto@valjakko.net
 type       : Syntax type       : Syntax
-lastupdate : 2005-08-01 +lastupdate : 2020-07-14 
-compatible : 2010-11-07 2011-05-25anguaweatherwax+compatible : Frusterick MannersGreeboHogfather
 depends    : depends    :
 conflicts  : conflicts  :
-similar    :+similar    : anchor
 tags       : bookmark, links, anchor tags       : bookmark, links, anchor
  
-downloadurl: http://koti.mbnet.fi/oiv/pubtest/bookmark.zip+downloadurl: https://github.com/oiv/dokuwiki_bookmark/archive/master.zip
 bugtracker :  bugtracker : 
 sourcerepo :  sourcerepo : 
Line 23: Line 23:
 With this plugin you can insert a bookmark to your page. The format is With this plugin you can insert a bookmark to your page. The format is
  
-  <BOOKMARK:bookmark_name>+  <BOOKMARK:bookmarkname>
  
 This will insert code  This will insert code 
  
 <code> <code>
-<a name='bookmark_name'></a>+<a name='bookmarkname' id='bookmarkname'></a>
 </code> </code>
  
Line 34: Line 34:
  
 <code> <code>
-[[namespace:page_name#bookmark_name|anchor_text]]+[[namespace:page_name#bookmarkname|anchor_text]]
 </code> </code>
  
Line 41: Line 41:
 ===== Installation ===== ===== Installation =====
  
-Install with Plugin Manager from [[http://koti.mbnet.fi/oiv/pubtest/bookmark.zip|here]]+Install with Plugin Manager
  
 +===== Feature request =====
  
-==== Plugin ====+==== Optional Class tag ====
  
-Create new folder ''lib/plugin/bookmark/'' and place the following file in it: ''syntax.php''.+Suggestion: add an option to specify a class for a bookmark, to provide for easy CSS styling of the anchor_text. For example, %%<BOOKMARK:bookmarkname:classname|anchor_text>%% to produce <a name='bookmarknameid='bookmarknameclass='classname'>anchor text</a>.
  
-''lib/plugin/bookmark/syntax.php'':+Use case: **%%<BOOKMARK:myterm:glossary|expanded term name>%%** so that I could style all the //glossary// terms.
  
-<file php lib/plugin/bookmark/syntax.php> +==== Allow space and dash in bookmarkname ====
-<?php +
-/** +
- * Plugin bookmark: Creates a bookmark to your document. +
- * +
- * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html) +
- * @author     Otto Vainio <bookmark.plugin@valjakko.net> +
- */+
  
-if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); +Suggestionby allowing the space and dash characters in bookmarknamewe can then refer to them in a natural way without having to use an aliasFor example, %%[[#Open step]]%% could refer to %%<BOOKMARK:open step>%%Where currently we would have to write %%[[#openstep|Open step]]%% to refer to %%<BOOKMARK:openstep>%%.
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); +
-require_once(DOKU_PLUGIN.'syntax.php'); +
- +
-/** +
- * All DokuWiki plugins to extend the parser/rendering mechanism +
- * need to inherit from this class +
- */ +
-class syntax_plugin_bookmark extends DokuWiki_Syntax_Plugin { +
- +
-    /** +
-     * return some info +
-     */ +
-    function getInfo(){ +
-        return array( +
-            'author' => 'Otto Vainio', +
-            'email'  => 'bookmark.plugin@valjakko.net', +
-            'date'   => '2005-08-01', +
-            'name'   => 'Bookmark plugin', +
-            'desc'   => 'a bookmark <a name=\'name\'></a>', +
-            'url'    => 'http://www.dokuwiki.org/plugin:bookmark', +
-        ); +
-    } +
- +
-    /** +
-     * What kind of syntax are we? +
-     */ +
-    function getType(){ +
-        return 'substition'; +
-    } +
- +
-    function getSort(){ return 357; } +
- +
-    function connectTo($mode) { +
-        $this->Lexer->addSpecialPattern('<BOOKMARK:\w+>',$mode,'plugin_bookmark'); +
-    } +
- +
- +
-    /** +
-     * Handle the match +
-     */ +
-    function handle($match, $state, $pos, &$handler){ +
-        $match = substr($match,10,-1); //strip <BOOKMARK: from start and > from end +
-        return array(strtolower($match)); +
-    } +
- +
-    /** +
-     * Create output +
-     */ +
-    function render($mode, &$renderer, $data) { +
-        if($mode == 'xhtml'){ +
-            $renderer->doc .= '<name="' . $data[0] . '" id="' . $data[0]. '"></a>'; +
-            return true; +
-        } +
-        return false; +
-    } +
-+
-?> +
-</file> +
- +
-<file txt lib/plugin/bookmark/plugin.info.txt> +
-base   bookmark +
-author Otto Vainio +
-email  otto@valjakko.net +
-date   2005-08-01 +
-name   Bookmark Plugin +
-desc   Insert a link anchor into the page +
-url    https://www.dokuwiki.org/plugin:bookmark +
- +
-</file> +
- +
-===== Discussion ===== +
- +
-I Installed this pluginbut this script didn't work. I tried to use the syntax but it didn't work. +
-Is there any manual or samples about this plugin? +
- +
-Hi. Remember to use capital letters for BOOKMARKSo the format is:  +
-''<BOOKMARK:name>'' +
-With the < and > marks. <bookmark:name> will not work... sorry  +
- --- //[[otto@valjakko.net|Otto Vainio]] 2006-09-04 12:08// +
- +
----- +
-While it works nicely with Firefox, it does not work for me with MSIE 6.0.2800.1106CO SP1, unless is hack the syntax.php to add an ''id'' attribute alongside to the ''name'' attribute of the anchor tag: +
-<code> +
-<a name='name' id='name'></a> +
-</code> +
-Yes I know that MSIE sucks, but DokuWiki uses the same trick for the anchor tags automatically generated for headings... --- //[[Gabor.Ziegler@ericsson.com|Gábor Ziegler]] 2007/06/15 10:01// +
- +
----- +
- +
-Hi ! I just love this plugin. But I failed to address one of this bookmarks from within the wiki? +
- +
-  [[page#bookmark]] +
- +
-Does not work ...  +
-[[MAE@DerPatriot.com|Markus A. Engelkamp]] +
-\\ +
-Hi, +
- +
-Is it possible to use this plugin to point to a particular section of the page? +
- +
----- +
- +
-This plugin doesn't appear to work in the current version of DokuWiki. +
-> It works well for me with the DokuWiki Release 2009-12-25c "Lemming" on [[http://eolienne.f4jr.org|Wiki Eolienne]] +
-+
-> Jean +
- +
-> I tested it with release 2013-05-10a "Weatherwax" and it worked, even without ''plugin.info.txt'' file. +
-> --- [[user>archangel|archangel]] //2013/07/03 22:42// +
----- +
- +
-> I tested it with release 2014-05-05a "Ponder Stibbons" and it worked. //2014/07/31 11:00am//\\  +
- +
-It would be great if other characters, apart from word characters (\w) are allowed in the anchor name. I.e. I have modified syntax.php, line 43 to "$this->Lexer->addSpecialPattern('<BOOKMARK:[\w\-]+>',$mode,'plugin_bookmark');" since I needed '-' in the anchor name. +
- +
-> I tested it with the most recent release 2015-08-10 "Detritus", works great!\\ +
-> Joachim +
- +
-> EDIT: 2017-04-09 +
-> Tested with current version - Release 2017-02-19b "Frusterick Manners", works.\\ +
-\\ +
-needed following code to get stuff working. The anchor is hidden - just an empty a tag as it seems from source-code +
- +
-<code> +
- +
-<BOOKMARK:path>path +
- +
-[[your:wiki:site#path|Path]] +
- +
-</code> +
- +
-> MSZ+
  
plugin/bookmark.1527706682.txt.gz · Last modified: 2018-05-30 20:58 by Klap-in

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki