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

Fix for #1360 - Enhance the row_counter #1515

Closed
wants to merge 1 commit into from

Conversation

svoboro1
Copy link

@svoboro1 svoboro1 commented Apr 2, 2016

Fix for #1360 - Enhance the row_counter, please review.

@scrutinizer-notifier
Copy link

The inspection completed: 2 new issues

@@ -1345,7 +1345,10 @@ function tabletbody_close() {
function tablerow_open() {
// initialize the cell counter used for classes
$this->_counter['cell_counter'] = 0;
$class = 'row'.$this->_counter['row_counter']++;
if (!isset($this->_counter['row_counter'])){
$this->_counter['row_counter'] = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At line 1293 in function table_open() the row_counter is already initialized
Does that code nothing?
Or is that function never called for your specific case?

// initialize the row counter used for classes
         $this->_counter['row_counter'] = 0;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/lupo49/dokuwiki-plugin-dir/blob/master/syntax.php#L1066
As #1360 notes, the table_open is redefined. It sets the _counter[row_counter] from this new function, but since that property is protected, it could not be changed by the new open_tabel function.

/** @var array global counter, for table classes etc. */
    protected $_counter = array(); //

@michitux
Copy link
Collaborator

Does this also work with multiple tables? I suspect that then the row counter is never reset...

I think a better fix would be to make it possible to specify css class(es) in table_open() (and similar renderer methods) such that plugins that want to use their own table style can still use the renderer methods that properly initialize everything.

@splitbrain
Copy link
Collaborator

splitbrain commented Nov 30, 2016

is this obsolete with #1558? Can it be closed?

@Klap-in
Copy link
Collaborator

Klap-in commented Nov 30, 2016

Thanks for the pull request, but #1558 solves this issue indeed by allowing adding classes to opening tags.

So plugins that didn't use DokuWiki's table_open(), but a modified copy, can now use the table_open() again since last DokuWiki release for adding a class to the opening tag.

@Klap-in Klap-in closed this 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

Successfully merging this pull request may close these issues.

None yet

5 participants