Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion action.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ function actionrenderer(Doku_Event $event, $param) {
$returnonly = $args[3] ?: false;
$linktype = $args[4] ?: 'content';

resolve_pageid(getNS($ID), $id, $exists);

global $ID;
if (!$this->m_helper->isExcluded($ID) && page_exists($id) && $id != $ID) {
if (!$this->m_helper->isExcluded($ID) && $exists && $id != $ID) {
Comment on lines +51 to +54
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this change accomplish?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there're relative links, autotooltip did not recognize them as relative link, but absolute link.

Example:
In "namespace:some_page", there're link like "[[other_page]]".
Since this is relative link, this link should be resolved as ":namespace:other_page".
However autotooltip resolved as ":other_page" and consider linked page does not exist.

So I re-positioned link resolve logic to early stage.

$event->preventDefault();

// If we call $renderer->internallink directly here, it will cause infinite recursion,
Expand Down
1 change: 0 additions & 1 deletion helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ public function stripNativeTooltip($link) {
*/
static function read_meta_fast($id) {
global $ID;
$id = resolve_id(getNS($ID), preg_replace('/\#.*$/', '', $id), true);

if (isset(self::$metaCache[$id])) {
return self::$metaCache[$id];
Expand Down
5 changes: 3 additions & 2 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ function canRender($format) {
function internallink($id, $name = null, $search = null, $returnonly = false, $linktype = 'content') {
global $ID;
$fullId = $id;
$id = preg_replace('/\#.*$/', '', $id);
$id = preg_replace('/(\#|\?).*$/', '', $id);
resolve_pageid(getNS($ID), $id, $exists, $this->date_at, true);

if (!$this->m_exclude && page_exists($id) && $id != $ID) {
if (!$this->m_exclude && $exists && $id != $ID) {
$link = parent::internallink($fullId, $name, $search, true, $linktype);

$meta = $this->m_helper->read_meta_fast($id);
Expand Down