[pmwiki-users] RFC: ToggleNext or Details+Summary
Petko Yotov
5ko at 5ko.fr
Wed Jan 29 10:31:43 PST 2020
On 29/01/2020 16:10, Dominique Faure wrote:
>> It is also possible to keep both ToggleNext and a cross-browser
>> working
>> <details> but this may sound like a feature creep. Also, I feel that
>> the
>> (:details:) markup in a wiki page, while more characters to type than
>> %p
>> toggle%, leaves the page source text more readable.
>
> You're perfectly right, but preferring to rely on standardized browser
> features and behaviors I thought that we could get the best of the two
> world having the one written in term of the other.
It appears I was thinking the other way around, "writing the other in
term of the one". :-)
I meant make sure the (:details:) markup which was added in 2.2.120
looks and works reasonably well with a partial polyfill when necessary.
ToggleNext is a tiny (26 lines of code) JavaScript function for
progressive enhancement on the whole page DOM, it is the right tool for
this. That's why it is so simple and so customizable -- accepts
configurable DOM elements and wikistyles/CSS classes including when an
element has multiple classes and inline styles, can come from any core
or custom markup, its content can come from pagelists, pagevariables,
included sections, whatever.
Of course ToggleNext could easily create a <details> block and properly
move the summary and the proper details in the block, but it would be
using JavaScript to create an element whose sole purpose to exist is to
not depend on JavaScript.
If you mean writing a PmWiki markup rule function in PHP that can do the
same (produce <details>+<summary> from any wikistyles source text), I'm
not sure it is realistic at this point. It looks far too complex and
difficult to write properly and to maintain. It could be done but PHP is
not the right tool for this.
Petko
More information about the pmwiki-users
mailing list