Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance the row_counter #1360

Closed
sunghlin opened this issue Sep 17, 2015 · 1 comment
Closed

Enhance the row_counter #1360

sunghlin opened this issue Sep 17, 2015 · 1 comment

Comments

@sunghlin
Copy link

I think the table render should check the value of row_counter before it increases the value. Currently, I experienced a issue of using the plugin "Dir Plugin". It re-writes its table_open(), but forgets to initial row_counter to zero in general cases. So, the class of the first row is just row, which has a conflict with the bootstrap theme. I tried to initialize the value in its code, but apparently not work (it just died). So, will it be good to check the initialization of row_counter before increasing it? I think this will be more general.

In dokuwiki/inc/parser/xhtml.php

from

function tablerow_open() {
        // initialize the cell counter used for classes
        $this->_counter['cell_counter'] = 0;                                                                                                                                                          
        $class                          = 'row'.$this->_counter['row_counter']++;
        $this->doc .= DOKU_TAB.'<tr class="'.$class.'">'.DOKU_LF.DOKU_TAB.DOKU_TAB;
}

to

function tablerow_open() {
        // initialize the cell counter used for classes
        $this->_counter['cell_counter'] = 0;
        if (!isset($this->_counter['row_counter'])) {
            $this->_counter['row_counter'] = 0;
        }
        $class                          = 'row'.$this->_counter['row_counter']++;
        $this->doc .= DOKU_TAB.'<tr class="'.$class.'">'.DOKU_LF.DOKU_TAB.DOKU_TAB;
}
@Klap-in
Copy link
Collaborator

Klap-in commented Nov 30, 2016

The Dir Plugin replaces the original table_open() function for adding the class to the opening tag, and therefore meets this issue

PR #1558 has added this feature to DokuWiki's renderer. So Dir Plugin can use now the tabel_open() function again e.g. see lupo49/dokuwiki-plugin-dir#26 .

@Klap-in Klap-in closed this as completed Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants