summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-05-04 21:22:03 +0200
committerandi <andi@splitbrain.org>2005-05-04 21:22:03 +0200
commit0b7c14c22e9810803e87a882cd9b3597b27fe74f (patch)
tree43dde0f97781012af5f9d0d7eb8c263ff6a9a28a
parent0339c8721982fc3a843306c03cd8882e6aebc863 (diff)
downloadrpg-0b7c14c22e9810803e87a882cd9b3597b27fe74f.tar.gz
rpg-0b7c14c22e9810803e87a882cd9b3597b27fe74f.tar.bz2
local links added #297
darcs-hash:20050504192203-9977f-004cc04b0753fc5d36d4515519c54039e73e77de.gz
-rw-r--r--inc/pageutils.php3
-rw-r--r--inc/parser/handler.php14
-rw-r--r--inc/parser/parser.php2
-rw-r--r--inc/parser/xhtml.php13
4 files changed, 25 insertions, 7 deletions
diff --git a/inc/pageutils.php b/inc/pageutils.php
index 488d268fe..fdece44e4 100644
--- a/inc/pageutils.php
+++ b/inc/pageutils.php
@@ -188,6 +188,7 @@ function resolve_mediaid($ns,&$page,&$exists){
*/
function resolve_pageid($ns,&$page,&$exists){
global $conf;
+ $exists = false;
//if links starts with . add current namespace
if($page{0} == '.'){
@@ -206,8 +207,6 @@ function resolve_pageid($ns,&$page,&$exists){
$file = wikiFN($page);
- $exists = false;
-
//check alternative plural/nonplural form
if(!@file_exists($file)){
if( $conf['autoplural'] ){
diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index ce0fb5d4c..e1ded183a 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -364,6 +364,7 @@ class Doku_Handler {
// If the title is an image, convert it to an array containing the image details
$link[1] = Doku_Handler_Parse_Media($link[1]);
}
+ $link[0] = trim($link[0]);
//decide which kind of link it is
@@ -375,7 +376,7 @@ class Doku_Handler {
array($link[0],$link[1],strtolower($interwiki[0]),$interwiki[1]),
$pos
);
- }elseif ( preg_match('/\\\\\\\\[\w.:?\-;,]+?\\\\/u',$link[0]) ) {
+ }elseif ( preg_match('/^\\\\\\\\[\w.:?\-;,]+?\\\\/u',$link[0]) ) {
// Windows Share
$this->_addCall(
'windowssharelink',
@@ -396,6 +397,13 @@ class Doku_Handler {
array($link[0],$link[1]),
$pos
);
+ }elseif ( preg_match('!^#.+!',$link[0]) ){
+ // local link
+ $this->_addCall(
+ 'locallink',
+ array(substr($link[0],1),$link[1]),
+ $pos
+ );
}else{
// internal link
$this->_addCall(
@@ -1156,7 +1164,7 @@ class Doku_Handler_Section {
/**
* Handler for paragraphs
*
- * @author Harry Fuecks <harryf@gmail.com>
+ * @author Harry Fuecks <hfuecks@gmail.com>
*/
class Doku_Handler_Block {
@@ -1228,7 +1236,7 @@ class Doku_Handler_Block {
/**
* Processes the whole instruction stack to open and close paragraphs
*
- * @author Harry Fuecks <harryf@gmail.com>
+ * @author Harry Fuecks <hfuecks@gmail.com>
* @author Andreas Gohr <andi@splitbrain.org>
* @todo This thing is really messy and should be rewritten
*/
diff --git a/inc/parser/parser.php b/inc/parser/parser.php
index 7de715b95..9896b8799 100644
--- a/inc/parser/parser.php
+++ b/inc/parser/parser.php
@@ -94,7 +94,7 @@ class Doku_Parser {
* the Parser could be serialized to a file once
* all modes are registered
*
- * @author Harry Fuecks <harryf@gmail.com>
+ * @author Harry Fuecks <hfuecks@gmail.com>
*/
class Doku_Parser_Mode {
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index 5b5716a3f..ffacabc7b 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -416,6 +416,17 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$this->internallink($link,$link);
}
+
+ function locallink($hash, $name = NULL){
+ global $ID;
+ $name = $this->_getLinkTitle($name, $hash, $isImage);
+ $hash = $this->_headerToLink($hash);
+ $title = $ID.' &crarr;';
+ $this->doc .= '<a href="#'.$hash.'" title="'.$title.'" class="wikilink1">';
+ $this->doc .= $name;
+ $this->doc .= '</a>';
+ }
+
/**
* Render an internal Wiki Link
*
@@ -935,7 +946,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Construct a title and handle images in titles
*
- * @author Harry Fuecks <harryf@gmail.com>
+ * @author Harry Fuecks <hfuecks@gmail.com>
*/
function _getLinkTitle($title, $default, & $isImage, $id=NULL) {
global $conf;