Last edit
Sammanfattning: put pre tags around code
Added: 2a3
> <pre>
Added: 6a8
> </pre>
Added: 8a11
> <pre>
Added: 10a14
> </pre>
Added: 11a16
> <pre>
Added: 13a19
> </pre>
The code on this page allows you to use anchors with WikiMode. To make an anchor, put “#Anchor” at the beginning of the line you want to link to. To link to an anchor, use the PageName#Anchor link pattern.
Examples:
Anchor Resulting HTML
<nowiki>-----------------------------------------------------</nowiki>
#NAME <a name="NAME">
PAGE#NAME <a href="PAGE#NAME">PAGE</a>
Here are the necessary rules to it. Customize wiki-pub-rules and add these rules after wiki-replace-links.
The rule for the #ANCHOR:
Regexp: ^#\(\sw+\)
Replacement: <a name="\1">
The rule for PageName#Anchor references:
Regexp: <a href="\(\(\|.\)*\)\.html">\(\(\|.\)*\)</a>#\(\sw+\)
Replacement: <a href="\1.html#\5">\3</a>
Note how the second rule just rearranges the HTML links produced by wiki-replace-links.
If you want more elaborate control over the output, you will have to combine this with the WikiLink code. But then again, if you might be better off with an other wiki mode. See WikiModeDiscussion.