bwanders / dokuwiki-strata

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

Request for integration of fields and rendering options (ie. CSS) #10

Closed simon-r-white closed 2 years ago

simon-r-white commented 9 years ago

Currently a 'special' field type of 'class' is available, through two methods

<data class1 class2>
Name: Bob
</data>

or

<data>
is a: class1
is a: class2
Name: Bob
</data>

However, these 'classes' are not open to use with CSS (or, I can't work out how?).

It would be nice if:

  1. The 'classes' where part of the HTML
  2. The strata-field names were the row-class-names
For example, HTML would render as:
1)
 <table class="class1 class2"> ... </table>

2)
 <tr class="Name"> ... </tr>

This would then allow writing CSS files that treated 'classes' of entry different (possibly even setting display: none) and allow different styling to be applied to rows.

I have no idea how easy it is to do this.

bwanders commented 9 years ago

(Sorry for the delay.)

There are two reasons these things are not currently used in the html.

  1. Both the values of is a and the names of the fields themselves can be any string, including all kinds of annoyances like " and >. So a form of normalisation would be required, leaving all kinds of edge cases with strings that normalize to the same identifiers (i.e. field names 12 hour average and 2 hour average would both normalize to hour-average since CSS classes may not start with a number; this can be fixed be prefixing the field- string, but that's counterintuitive to style...)
  2. The current plugin uses as much of the normal dokuwiki renderer as possible, and the renderer does not expose methods to add additional classes to the generated HTML. Replacing this is possible, but would increase the maintenance of the plugin as the generated HTML would have to be kept in line with the normal table handling of dokuwiki.

Because of these consideration I have held off on binding the classes and field names to the html.

However, if you want to change the way the data entry is rendered, using an actual template to do so is the way to go. Because of this, I've written dokuwiki-plugin-templatery and dokuwiki-plugin-stratatemplatery. Unfortunately, I haven't yet gotten around to documenting them yet, making it difficult for others to use them.

If you haven't yet hacked a solution for styling the data entry table, give me a shout: I'll see about writing some templating documentation to get you going!