bwanders / dokuwiki-strata

Strata - a Semi-Structured Data plugin for Dokuwiki
https://www.dokuwiki.org/plugin:strata
17 stars 8 forks source link

Is it possible to use one field as the href text for another link column (combining two fields) #13

Closed simon-r-white closed 9 years ago

simon-r-white commented 9 years ago

Sorry, me again.

I have three data entries on three separate pages:

On Page test:links:a

<data TEST>
Date: 2015-01-01
Title: Initial meeting
</data>
On Page test:links:b

<data TEST>
Date: 2015-01-02
Title: Second meeting
</data>
On Page test:links:c

<data TEST>
Date: 2015-01-05
Title: Final meeting
</data>

I'd like a two column table with the Date and Title, like the following:

<table ?date ?title>
?item is a: TEST
?item Date: ?date
?item Title: ?title
</table>

However, this has no link to the page with the data entry on.

You can get a link as follows:

<table ?item ?date ?title>
?item is a: TEST
?item Date: ?date
?item Title: ?title
</table>

However, is it possible to have just the Date and Title column, with one of them as a href link to the page holding the data entry?

I've tried:

<table ?date [link] ?title>
?item is a: TEST
?item Date: ?date
?item Title: ?title
</table>

Which makes the Date column into links... but the href target is wrong.

So I'm trying to combine two fields into one column with a link type.

bwanders commented 9 years ago

First off, the ref, page and link types serve three subtly different purposes:

What you want is something that I have run into as well, and have yet to find a satisfying solution. The only solution that comes close is to implement a display-only type titleref that uses its type hint to be given a field that is to be used as the href caption; but because of the niche use for this type, I have not added it to the plugin.

In the specialised case you present, there is another solution: use the entry title field instead of a separate Title field. You can either give the page a meaningful name in the title, which will automatically be picked up by the strata plugin:

====== Initial meeting =======
On Page test:links:a

<data TEST>
Date: 2015-01-01
</data>

Or you can explicitly set the entry title:

On Page test:links:a

<data TEST>
Date: 2015-01-01
entry title: Initial Meeting
</data>

In both cases the entry title field will be set to something nice. Together with the useheading setting, this will allow the normal ref type to use the entry title as the title of the link.

simon-r-white commented 9 years ago

Ok, I was thinking it might require using entry title... but was getting confused with the ref and link distinction.

I think I'll use the entry title as the the date of the meeting (it seems more logical to me to have the link be the date rather than the meeting name - personal opinion of course).

I'm using my own datetime type for the Date field (just extended the date type to include HH:MM)... so I will have double entry of the date (both in entry title and Date), but I can get the effect I want.

I'm finding it very handy to define data entries using the snippets-plugin (although I'm having issues with that plugin's auto-replacement feature).

I'm slowly getting towards what I want.