Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
122f2d46
Commit
122f2d46
authored
9 years ago
by
Andreas Böhler
Browse files
Options
Downloads
Patches
Plain Diff
Add a 'returnonly' option to all xhtml link types
parent
f209f206
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inc/parser/xhtml.php
+60
-27
60 additions, 27 deletions
inc/parser/xhtml.php
with
60 additions
and
27 deletions
inc/parser/xhtml.php
+
60
−
27
View file @
122f2d46
...
...
@@ -761,27 +761,40 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Render a CamelCase link
*
* @param string $link The link name
* @param string $link The link name
* @param bool $returnonly whether to return html or write to doc attribute
* @see http://en.wikipedia.org/wiki/CamelCase
*/
function
camelcaselink
(
$link
)
{
$this
->
internallink
(
$link
,
$link
);
function
camelcaselink
(
$link
,
$returnonly
=
false
)
{
if
(
$returnonly
)
{
return
$this
->
internallink
(
$link
,
$link
,
null
,
true
);
}
else
{
$this
->
internallink
(
$link
,
$link
);
}
}
/**
* Render a page local link
*
* @param string $hash hash link identifier
* @param string $name name for the link
* @param string $hash hash link identifier
* @param string $name name for the link
* @param bool $returnonly whether to return html or write to doc attribute
*/
function
locallink
(
$hash
,
$name
=
null
)
{
function
locallink
(
$hash
,
$name
=
null
,
$returnonly
=
false
)
{
global
$ID
;
$name
=
$this
->
_getLinkTitle
(
$name
,
$hash
,
$isImage
);
$hash
=
$this
->
_headerToLink
(
$hash
);
$title
=
$ID
.
' ↵'
;
$this
->
doc
.
=
'<a href="#'
.
$hash
.
'" title="'
.
$title
.
'" class="wikilink1">'
;
$this
->
doc
.
=
$name
;
$this
->
doc
.
=
'</a>'
;
$doc
=
'<a href="#'
.
$hash
.
'" title="'
.
$title
.
'" class="wikilink1">'
;
$doc
.
=
$name
;
$doc
.
=
'</a>'
;
if
(
$returnonly
)
{
return
$doc
;
}
else
{
$this
->
doc
.
=
$doc
;
}
}
/**
...
...
@@ -884,10 +897,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
/**
* Render an external link
*
* @param string $url full URL with scheme
* @param string|array $name name for the link, array for media file
* @param string $url full URL with scheme
* @param string|array $name name for the link, array for media file
* @param bool $returnonly whether to return html or write to doc attribute
*/
function
externallink
(
$url
,
$name
=
null
)
{
function
externallink
(
$url
,
$name
=
null
,
$returnonly
=
false
)
{
global
$conf
;
$name
=
$this
->
_getLinkTitle
(
$name
,
$url
,
$isImage
);
...
...
@@ -926,7 +940,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
if
(
$conf
[
'relnofollow'
])
$link
[
'more'
]
.
=
' rel="nofollow"'
;
//output formatted
$this
->
doc
.
=
$this
->
_formatLink
(
$link
);
if
(
$returnonly
)
{
return
$this
->
_formatLink
(
$link
);
}
else
{
$this
->
doc
.
=
$this
->
_formatLink
(
$link
);
}
}
/**
...
...
@@ -934,12 +952,13 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* You may want to use $this->_resolveInterWiki() here
*
* @param string $match original link - probably not much use
* @param string|array $name name for the link, array for media file
* @param string $wikiName indentifier (shortcut) for the remote wiki
* @param string $wikiUri the fragment parsed from the original link
* @param string $match original link - probably not much use
* @param string|array $name name for the link, array for media file
* @param string $wikiName indentifier (shortcut) for the remote wiki
* @param string $wikiUri the fragment parsed from the original link
* @param bool $returnonly whether to return html or write to doc attribute
*/
function
interwikilink
(
$match
,
$name
=
null
,
$wikiName
,
$wikiUri
)
{
function
interwikilink
(
$match
,
$name
=
null
,
$wikiName
,
$wikiUri
,
$returnonly
=
false
)
{
global
$conf
;
$link
=
array
();
...
...
@@ -977,16 +996,21 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$link
[
'title'
]
=
htmlspecialchars
(
$link
[
'url'
]);
//output formatted
$this
->
doc
.
=
$this
->
_formatLink
(
$link
);
if
(
$returnonly
)
{
return
$this
->
_formatLink
(
$link
);
}
else
{
$this
->
doc
.
=
$this
->
_formatLink
(
$link
);
}
}
/**
* Link to windows share
*
* @param string $url the link
* @param string|array $name name for the link, array for media file
* @param string $url the link
* @param string|array $name name for the link, array for media file
* @param bool $returnonly whether to return html or write to doc attribute
*/
function
windowssharelink
(
$url
,
$name
=
null
)
{
function
windowssharelink
(
$url
,
$name
=
null
,
$returnonly
=
false
)
{
global
$conf
;
//simple setup
...
...
@@ -1010,7 +1034,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$link
[
'url'
]
=
$url
;
//output formatted
$this
->
doc
.
=
$this
->
_formatLink
(
$link
);
if
(
$returnonly
)
{
return
$this
->
_formatLink
(
$link
);
}
else
{
$this
->
doc
.
=
$this
->
_formatLink
(
$link
);
}
}
/**
...
...
@@ -1018,10 +1046,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
*
* Honors $conf['mailguard'] setting
*
* @param string $address Email-Address
* @param string|array $name name for the link, array for media file
* @param string $address Email-Address
* @param string|array $name name for the link, array for media file
* @param bool $returnonly whether to return html or write to doc attribute
*/
function
emaillink
(
$address
,
$name
=
null
)
{
function
emaillink
(
$address
,
$name
=
null
,
$returnonly
=
false
)
{
global
$conf
;
//simple setup
$link
=
array
();
...
...
@@ -1053,7 +1082,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$link
[
'title'
]
=
$title
;
//output formatted
$this
->
doc
.
=
$this
->
_formatLink
(
$link
);
if
(
$returnonly
)
{
return
$this
->
_formatLink
(
$link
);
}
else
{
$this
->
doc
.
=
$this
->
_formatLink
(
$link
);
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment