dokufreaks / plugin-include

A DokuWiki plugin for including other wiki pages into the current one.
http://www.dokuwiki.org/plugin:include
GNU General Public License v2.0
62 stars 54 forks source link

Page renaming breaks inclusion #276

Open fthommen opened 2 years ago

fthommen commented 2 years ago

When pages are renamed (using the move plugin), the ID doesn't change in the include directive, thus breaking the inclusion. Since there seems to be a mechanism to update page IDs automatically (e.g. in internal links), maybe this mechanism could also be used by the include plugin?

DW version is Hogfather, move and include plugin are up to date.

Klap-in commented 2 years ago

The links are already registered by the include plugin… https://github.com/dokufreaks/plugin-include/blob/dffff5e183b89f51de64f71523bcc7460e0a241d/action.php#L327-L329

fthommen commented 2 years ago

Does this mean that it should work (and we might have some other kind of issue at our site), or that the implementation in the include plugin is only partially complete/working?

Klap-in commented 2 years ago

Yes I would expect that it works. If it does not, something is going on.

Could you please share a minimal example of pages with their minimal content which I could create, to replicate your situation?

fthommen commented 2 years ago

I have reproduced the issue on two other DokuWikis (all hogfather) which have different set of installed plugins. The almost - the title in include is technically not required :-) - minimal test case is

:include:

====== Master ======
{{page>include_this}}

:include_this:

====== Include This ======

Results in: image

After I have renamed include_this to include_that using the move plugin, the master document is broken: image

HTH

fthommen commented 2 years ago

I have no idea, how this "automatic rewriting" of renamed pages works, but could the issue be related to #251?

Klap-in commented 2 years ago

Sure!

GitWonder commented 1 year ago

This is possibly related but I have found that when using {{tagtopic>some_tag&linkonly&exclude=/c_template/}}

and then using Move plugin to change the name of the pages the include statement changes to {{tagtopic>changed:namespace:path:some_tag&linkonly&exclude=/c_template/}}

adding "changed:namespace:path" to the "some_tag" which is obviously creating a nonsense include statement that mixes namespace and tag.

fiwswe commented 1 year ago

I have reproduced the issue on two other DokuWikis

I can reproduce this on "Jack Jackrum". The only difference to the example above was that I did everything in the namespace test.

After renaming the page test:include_this to test:include_that, {{page>test:include_this}} remains unchanged on the test page. After renaming the page back to test:include_this it worked correctly again.

lprobsth commented 8 months ago

I just added a commit that implements registering the "relation_references" key for the included pages in the indexer. The move plugin and the backlinks page (see #251) lookup this meta key in the indexer. Right now the include plugin updates the meta data for the relation of the page - but this does not automatically get inserted into the index (see https://www.dokuwiki.org/devel:metadata#metadata_index).

This seems to fix the move adaption of the link in the include syntax. I'll test this and create a pull request after validation.

Edit: I have just seen that this plugin also adds meta data in an action (action function: handle_indexer). I'll add a commit for this later.