Code Monkey home page Code Monkey logo

Comments (4)

bwanders avatar bwanders commented on June 12, 2024 1

You are not missing anything. The current way of handling fragments is due to the developmental nature of the plugins: at the moment, the fragments are used to build links, but they are not rendered to HTML. This is because I have yet to find a clean way to mesh the generation of these identifiers with the default wiki header identifiers.

What does work is the following:

===== item1 =====
<data myitem #item1>
SampleField: One
</data>

That way the rendered links will jump you to the header.

Does that help you out?

from dokuwiki-strata.

regystro avatar regystro commented on June 12, 2024

Yes it kind of does. And I've been able to avoid duplicated headers by using Wrap plugin and including a custom CSS class this way:

.wrap_header-hidden h2 {
    visibility: hidden;
    position: absolute;
}

Then my data entry looks like this:

<WRAP header-hidden>
===== item1 =====
</WRAP>
<data myitem #item1>
SampleField: One
</data>

So let's say this workaround works for me 👍

Thank you!!

from dokuwiki-strata.

bwanders avatar bwanders commented on June 12, 2024

Good to hear!

I'll leave this issue open, since there should be a solid solution for this problem. (Workarounds are nice, but we really want this to work out-of-the-box.)

from dokuwiki-strata.

regystro avatar regystro commented on June 12, 2024

Hi.

I managed to write a little mod and got it working. Now there's no need to include the headers (===== item1 =====) nor the CSS to hide them as stated in some posts above :)

Just wanted to share in case anyone is interested.

Strata Plugin version 2017-03-28
File: lib\plugins\strata\syntax\entry.php
Replace the original line #252
$R->doc .= '<div class="strata-entry" '.(isset($currentPosition)?'id="'.$currentPosition.'"':'').'>';
by all this code:

// ## internal link MOD ##
$divid = $data['entry'];
resolve_pageid(getNS($ID),$divid,$exists); // convert entry title to id using DokuWiki function
// translate id to match the link generated by Strata Plugin
$divid = preg_replace('/[\.:]/','',$divid); // remove unwanted characters
$divid = preg_replace('/#/','_',$divid); // replace particular characters
if (isset($previousPosition) or isset($nextPosition)) {
	// has fragments
	if (!isset($previousPosition)) $R->doc .= '<span id="'.$divid.'"><span>'; // added as bookmark to first fragment
	$R->doc .= '<div class="strata-entry" '.(isset($currentPosition)?'id="'.$currentPosition.'"':'').'>'; // yep, that's the original line
} else {
	// single entry
	$R->doc .= '<div class="strata-entry" '.(isset($currentPosition)?'id="'.$divid.'"':'').'>'; // use our generated id instead
}
// ## END internal link MOD ##

You may use this code to test it:

~~NOCACHE~~
<data myitem #item1>
SampleField: One
</data>

\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\

<data myitem #item2>
SampleField: Two
</data>

\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\

<data myitem #item3>
SampleField: Three
</data>

\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\

<data myitem #item4>
SampleField: Four
</data>

\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\

<data myitem #item4>
SampleExtraField: Another fragment
</data>

\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\

<table ?item> 
?item is a: myitem
</table>

Now you can click on the links at the table and they take you to the related data entry.

Greetings :)

from dokuwiki-strata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.