plugin:anchor
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:anchor [2017-06-20 09:54] – Changed signature of methods "handle'' and ''render'' to suppress warnings in PHP 7.1 85.132.140.57 | plugin:anchor [2024-02-11 03:39] (current) – zioth | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
author | author | ||
email : elifenton@this_is_not_a_real_email.fake | email : elifenton@this_is_not_a_real_email.fake | ||
type : syntax | type : syntax | ||
- | lastupdate : 2013-08-16 | + | lastupdate : 2024-02-10 |
- | compatible : 2010-11-07, 2011-05-25, | + | compatible : 2010-11-07, 2011-05-25, |
depends | depends | ||
conflicts | conflicts | ||
- | similar | + | similar |
- | tags : anchor, links, sample, bookmark | + | tags : anchor, bookmark, links |
- | downloadurl: | + | downloadurl: |
- | bugtracker : | + | bugtracker : https:// |
- | sourcerepo : | + | sourcerepo : https:// |
donationurl: | donationurl: | ||
+ | screenshot_img: | ||
---- | ---- | ||
- | Normally, | + | DokuWiki allows |
- | + | ||
- | This plugin is also a useful sample, if you're having trouble figuring out how to create a syntax plugin. | + | |
+ | This plugin is extremely simple, so it's a good place to start if you're trying to figure out how to create a syntax plugin. | ||
===== Installation ===== | ===== Installation ===== | ||
- | This plugin is so simple, | + | Search |
- | <code php lib/ | ||
- | <?php | ||
- | if(!defined(' | ||
- | if(!defined(' | ||
- | require_once(DOKU_PLUGIN.' | ||
- | | ||
- | class syntax_plugin_anchor extends DokuWiki_Syntax_Plugin { | ||
- | function getType() {return ' | ||
- | function getPType() {return ' | ||
- | function getSort() {return 167;} | ||
- | function getInfo() {return array(' | ||
- | function connectTo($mode){ | ||
- | $this-> | ||
- | } | ||
- | |||
- | function handle($match, | ||
- | return explode(':', | ||
- | } | ||
- | |||
- | function render($mode, | ||
- | $renderer-> | ||
- | } | ||
- | } | ||
- | ?> | ||
- | </ | ||
===== Examples/ | ===== Examples/ | ||
- | Here's how you create | + | This syntax creates |
< | < | ||
Line 62: | Line 37: | ||
</ | </ | ||
- | The anchor_name | + | **anchor_name** is an arbitrary |
+ | |||
+ | **text**, if provided, is a block of text that the anchor will wrap in HTML. It' | ||
+ | |||
+ | < | ||
+ | {{anchor: | ||
+ | </ | ||
To link to an anchor from within DokuWiki: | To link to an anchor from within DokuWiki: | ||
+ | |||
+ | Use standard DokuWiki syntax to link to the new anchor: | ||
< | < | ||
Line 75: | Line 58: | ||
http:// | http:// | ||
</ | </ | ||
- | |||
==== Changelog ==== | ==== Changelog ==== | ||
- | | + | |
- | * 2013-05-23 | + | |
+ | * 2013-05-23 | ||
===== Discussion ===== | ===== Discussion ===== | ||
+ | ==== Gratuitous newline ==== | ||
+ | |||
+ | The plugin inserts an unwanted newline after the anchor tag. But I want to create a glossary page with anchored entries of the form:\\ | ||
+ | **term** -- definition | ||
+ | |||
+ | It looks like the [[: | ||
==== Case sensitivity is not compatible with DW ==== | ==== Case sensitivity is not compatible with DW ==== | ||
While using anchor I found that you have to type the anchor_name in all lowercase letters to be compatible with the DW internal link mechanics, which converts the letters of a link to lowercase. | While using anchor I found that you have to type the anchor_name in all lowercase letters to be compatible with the DW internal link mechanics, which converts the letters of a link to lowercase. | ||
To enable copy& | To enable copy& | ||
- | |||
- | ==== Avoiding that Extension Managers erroneously thinks there is an update for this plugin ==== | ||
- | If you install the plugin from the source code given above, the Extension Manager of Dokuwiki (I'm using release 2014-05-05 " | ||
- | |||
- | You can fix this by installing the following file in the '' | ||
- | |||
- | <file txt plugin.info.txt> | ||
- | base anchor | ||
- | author Eli Fenton | ||
- | date 2013-05-23 | ||
- | name Anchor Plugin | ||
- | url http:// | ||
- | </ | ||
- | |||
- | ==== Compatible with " | ||
- | IMO: Works fine with Release 2017-02-19 " | ||
- | //Sig// | ||
- | |||
- | ==== Compatible with " | ||
- | In my opinion, it works fine with '' | ||
- | //AlekS// | ||
- | |||
- | ==== Compatible with " | ||
- | Works also with " | ||
- | |||
- | ==== Compatible with " | ||
- | Works fine with 2016-06-26 " | ||
==== Jumps to top of the page ==== | ==== Jumps to top of the page ==== | ||
Line 118: | Line 80: | ||
If I use this internal link, DW jumps to the top of the page.\\ | If I use this internal link, DW jumps to the top of the page.\\ | ||
Isn't it possible to jump to the part of the page, where the anchor is defined?< | Isn't it possible to jump to the part of the page, where the anchor is defined?< | ||
+ | |||
+ | Answer: It's possible that your DokuWiki template includes code that automatically scrolls to the top of the page after page load. You can confirm this by creating a link to a Doku section header and seeing if it behaves the same way. | ||
==== / | ==== / | ||
Line 133: | Line 97: | ||
//ViForEver 20140207// | //ViForEver 20140207// | ||
+ | ==== Needs the colon even with no text ==== | ||
+ | Note that even if you don't provide the optional text for the anchor you still need the colon following the anchor name, otherwise the plugin will error. | ||
+ | UPDATE: This has been fixed (2023-08-14) | ||
+ | |||
+ | Very handy little plugin! | ||
+ | // | ||
- | Hello, | ||
- | in my private wiki __it does not work__. | ||
- | How i have to create an anchor and an anchor-goal? | ||
- | Please give me an example! | ||
===== Old Discussion ===== | ===== Old Discussion ===== | ||
+ | |||
[[plugin: | [[plugin: | ||
plugin/anchor.1497945298.txt.gz · Last modified: 2017-06-20 09:54 by 85.132.140.57