Commit 8481b4b9 authored by Wolfgang's avatar Wolfgang

Rename link parameter for behaviour link to "uri" for spec compliance; support...

Rename link parameter for behaviour link to "uri" for spec compliance; support old "link" as fallback
parent 667746b4
......@@ -229,24 +229,27 @@ declare function pmf:anchor($config as map(*), $node as node(), $class as xs:str
<fo:inline id="{$id}"/>
};
declare function pmf:link($config as map(*), $node as node(), $class as xs:string+, $content, $link) {
if (empty($link) or $link = "#") then
(: Make sure not to produce an empty destination, which would cause an FO error :)
$config?apply-children($config, $node, $content)
else if (starts-with($link, "#")) then
<fo:basic-link internal-destination="{substring-after($link, '#')}">
{
pmf:check-styles($config, $node, $class, ()),
$config?apply-children($config, $node, $content)
}
</fo:basic-link>
else
<fo:basic-link external-destination="{$link}">
{
pmf:check-styles($config, $node, $class, ()),
declare function pmf:link($config as map(*), $node as node(), $class as xs:string+, $content, $uri,
$optional as map(*)) {
let $link := head(($uri, $optional?link))
return
if (empty($link) or $link = "#") then
(: Make sure not to produce an empty destination, which would cause an FO error :)
$config?apply-children($config, $node, $content)
}
</fo:basic-link>
else if (starts-with($link, "#")) then
<fo:basic-link internal-destination="{substring-after($link, '#')}">
{
pmf:check-styles($config, $node, $class, ()),
$config?apply-children($config, $node, $content)
}
</fo:basic-link>
else
<fo:basic-link external-destination="{$link}">
{
pmf:check-styles($config, $node, $class, ()),
$config?apply-children($config, $node, $content)
}
</fo:basic-link>
};
declare function pmf:escapeChars($text as item()) {
......
......@@ -124,8 +124,10 @@ declare function pmf:anchor($config as map(*), $node as node(), $class as xs:str
<span id="{$id}"/>
};
declare function pmf:link($config as map(*), $node as node(), $class as xs:string+, $content, $link, $target) {
<a href="{$link}" class="{$class}" target="{$target}">{pmf:apply-children($config, $node, $content)}</a>
declare function pmf:link($config as map(*), $node as node(), $class as xs:string+, $content, $uri, $target, $optional as map(*)) {
let $link := head(($uri, $optional?link))
return
<a href="{$link}" class="{$class}" target="{$target}">{pmf:apply-children($config, $node, $content)}</a>
};
declare function pmf:escapeChars($text as item()*) {
......
......@@ -161,13 +161,16 @@ declare function pmf:anchor($config as map(*), $node as node(), $class as xs:str
"\label{" || $id || "}"
};
declare function pmf:link($config as map(*), $node as node(), $class as xs:string+, $content, $link) {
if (starts-with($link, "#")) then
("\hyperref[", pmf:escapeChars(substring-after($link, "#")), "]{", pmf:get-content($config, $node, $class, $content), "}")
else if ($content = $link) then
("\url{", pmf:escapeChars($link), "}")
else
("\href{", pmf:escapeChars($link), "}{", pmf:get-content($config, $node, $class, $content), "}")
declare function pmf:link($config as map(*), $node as node(), $class as xs:string+, $content, $uri,
$optional as map(*)) {
let $link := head(($uri, $optional?link))
return
if (starts-with($link, "#")) then
("\hyperref[", pmf:escapeChars(substring-after($link, "#")), "]{", pmf:get-content($config, $node, $class, $content), "}")
else if ($content = $link) then
("\url{", pmf:escapeChars($link), "}")
else
("\href{", pmf:escapeChars($link), "}{", pmf:get-content($config, $node, $class, $content), "}")
};
declare function pmf:glyph($config as map(*), $node as node(), $class as xs:string+, $content as xs:anyURI?) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment