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

[BUG] EvenRow and OddRow reversed? #8738

Open
BurningTreeC opened this issue Nov 13, 2024 · 8 comments
Open

[BUG] EvenRow and OddRow reversed? #8738

BurningTreeC opened this issue Nov 13, 2024 · 8 comments

Comments

@BurningTreeC
Copy link
Contributor

Describe the bug

While creating a table using a filter I wanted to apply the evenRow and oddRow classes.
The way I did it, the first row "1" would get the oddRow class because "1" is odd if I recall correctly.
Then I compared with how TiddlyWiki parses the | this is a table cell | this is another table cell | constructs and I've seen that the first row gets the evenRow class.

Is this a bug or is there a reason for this?

Expected behavior

I would expect the first row to have the oddRow class applied.
I don't believe it should be evenRow - even if we think that it has index 0 - it's the 1st row.

To Reproduce

No response

Screenshots

No response

TiddlyWiki Configuration

Current prerelease

Additional context

No response

@pmario
Copy link
Member

pmario commented Nov 13, 2024

The table rowCount variable starts at 0

@pmario
Copy link
Member

pmario commented Nov 13, 2024

The first row in a table should be the header, so the first "data" row is no. 1. -- But we can not change that any more.

@BurningTreeC
Copy link
Contributor Author

Ok, so if we create a table for the wiki core using <table> tags, we should apply the "wrong" classes to the <tr> tags, correct?

@pmario
Copy link
Member

pmario commented Nov 13, 2024

Ok, so if we create a table for the wiki core using

tags, we should apply the "wrong" classes to the tags, correct?

It depends.

  1. yes ... If you want to create HTML code the is the same as a wikitext-table

  2. no ... If you intend to use CSS nth-of-type(even). It seems to start with 1

    tbody > tr:nth-of-type(even) {
        background-color: red;
    }
    

I think, I would go with option two to make it "valid" HTML code.


@Jermolene -- What do you think. Should we fix the problem with the current |core |table parser |? So it produces valid HTML table syntax

@pmario
Copy link
Member

pmario commented Nov 13, 2024

It seem at the moment the TW table syntax also counts a table-header if there is one. CSS nth-of-type(even) only uses the rows in the TBODY element and it starts with 1.

@Jermolene
Copy link
Member

Hi @pmario in what way does the table parser not product valid HTML table syntax? I understand that the odd and even classes are reversed, but that is not an error of HTML syntax. Is there anything else wrong with it?

@pmario
Copy link
Member

pmario commented Nov 13, 2024

@Jermolene -- Sorry bad wording. There is nothing else wrong with it. Only the counter is wrong.

@Jermolene
Copy link
Member

Then I think that sadly backwards compatibility constrains us to leave things as they area, but it would be great to update the documentation to call attention to it.

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

No branches or pull requests

3 participants