Skip to content

Cleanup/Rewrite - #24

Open
splitbrain wants to merge 6 commits into
dr4Ke:masterfrom
cosmocode:cosmocode
Open

Cleanup/Rewrite#24
splitbrain wants to merge 6 commits into
dr4Ke:masterfrom
cosmocode:cosmocode

Conversation

@splitbrain

Copy link
Copy Markdown

This is a major cleanup of the plugin, fixing a whole bunch of issues and catching up with the pending pull requests.

  • use substition type (previous code was basically this, ignoring all other match types anyway)
  • use parser modes to limit the effect of the plugin to tables
  • improve the used regexes and make them compatible with Mort
  • fix toolbar integration (not sure this has ever worked before)
  • make it work for headers too
  • add some tests

Judging from the lack of responses to previous issues and PRs and #4 (comment) I assume this plugin is abandoned. I will update the documentation and point the download to our fork. However CosmoCode will not maintain the plugin going forward.

fixes #4 #7 #8 #23 #6 #12 #13 #20 #22

replaces #9 #10 #11 #21

* use substitution type
* doc blocks
* modern syntax
* adjusted regex (no anchoring)

Fixes dr4Ke#12
Fixes dr4Ke#13
Fixes dr4Ke#20
Fixes dr4Ke#22
Replaces dr4Ke#9
Replaces dr4Ke#10
Replaces dr4Ke#11
Replaces dr4Ke#21
The button was appended to the toolbar DOM by hand, behind a check for
the spell checker element DokuWiki dropped years ago, so it never
appeared at all. It is now added to the toolbar array with an
addBtnActionCellbg() handler creating the picker, leaving placement,
ARIA state and toggling to the core toolbar code.

The swatches reset background-image because templates tend to style
buttons with a gradient that hides the color.

Colors from a user defined user_cellbg_colors are no longer merged into
the picker. That extension point was unusable for as long as the button
was missing.

Fixes dr4Ke#6
The special pattern anchored the color with '^' and relied on the lexer
matching from the parse cursor. Matching happens against the full document
now, so the anchor never held inside a table row and no cell was colored at
all. A fixed-length lookbehind for the cell delimiter takes its place. It has
to stay fixed length, as all patterns of a mode compile into a single regex
and one that needs a newer PCRE than the server provides takes the whole table
mode down with it.

The pattern is registered with the table modes only. Elsewhere the syntax used
to be recognized as well, producing instructions that every renderer other
than XHTML dropped along with the text they covered.

Validating the color in the pattern itself leaves an unusable color as literal
text and makes the separate validation obsolete. It also makes rgb() triplets
work, which were documented but unreachable.

Cells carry a style attribute instead of the non-conforming bgcolor, header
cells are colored as well, and the first color of a cell is the one that
counts; a second color used to add another attribute to the same cell.

Fixes dr4Ke#7
Replaces dr4Ke#8
Replaces dr4Ke#23
Beside the standard plugin info check, the syntax tests cover the accepted
color notations, syntax that only looks like a color, and where in a table a
color is recognized at all.

Whether a color reaches the renderer is asserted on the instruction stream,
because the rendered markup looks the same either way once a cell refuses a
second color.
Templates color the cells of the row under the pointer. The background sat on
the cell itself, which outranks that highlight, leaving the colored cells of a
hovered row as the only ones not reacting to the pointer.

Cells carry their color as a custom property now and a stylesheet turns it into
the background, mixing the text color in for the hovered row so the highlight
shows on light as well as on dark templates.

The color of a cell depends on that stylesheet from now on. As the seed of the
stylesheet URL does not cover the files a plugin contributes, a cached
stylesheet leaves cells uncolored until the seed changes for another reason.

Fixes dr4Ke#4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSS Hover on table cells

1 participant