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

Don't emit unnecessary classes in HTML tables (#9325) #9376

Merged
merged 3 commits into from
Jun 7, 2024
Merged

Don't emit unnecessary classes in HTML tables (#9325) #9376

merged 3 commits into from
Jun 7, 2024

Conversation

ThomasSoeiro
Copy link
Contributor

Here is a try for #9325 according to @jgm guidance :

  • The change in the writer needs to be refined but I guess this is the idea.
  • I found no use of header/odd/even classes in data/templates/styles.html.
  • I removed header/odd/even accross the tests; I'm not sure about changes in update test/command/*.md so I put it in a separate commit.

I also found occurence of odd/even in:

  • pandoc-lua-engine/test/sample.lua and pandoc-lua-engine/test/tables.custom
  • and /src/Text/Pandoc/Writers/Textile.hs and test/tables.textile

Do they need updating too?

PS: This is my first pull request. It is only WIP but I hope it helps. Otherwise, feel free to close!

@ThomasSoeiro ThomasSoeiro changed the title Table nonclass Don't emit unnecessary classes in HTML tables (#9325) Jan 26, 2024
Copy link
Owner

@jgm jgm left a comment

Choose a reason for hiding this comment

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

Hi @ThomasSoeiro ! I'm really sorry to have let this sit for so long. It must have come in during a busy period and then it was buried. But this all looks good to me, I think you could "undraft" it.

@jgm
Copy link
Owner

jgm commented Jun 7, 2024

And yes, I'd say those other things should also be updated for consistency.

@ThomasSoeiro ThomasSoeiro marked this pull request as ready for review June 7, 2024 17:29
@ThomasSoeiro
Copy link
Contributor Author

hi @jgm!

(...) But this all looks good to me, I think you could "undraft" it.

Done, thank you for having a look!

And yes, I'd say those other things should also be updated for consistency.

Sorry, I won't be able to take care of it for several weeks.

@jgm
Copy link
Owner

jgm commented Jun 7, 2024

Thanks, I'll just merge this and take care of the other thing separately.

@jgm jgm merged commit cd15313 into jgm:main Jun 7, 2024
1 of 12 checks passed
jgm added a commit that referenced this pull request Jun 7, 2024
jgm added a commit that referenced this pull request Jun 7, 2024
@ThomasSoeiro ThomasSoeiro deleted the table-nonclass branch June 7, 2024 21:50
@Malcolmnixon
Copy link

The removal of odd/even is a bit of a breaking change for us. We were relying on that to produce pretty HTML tables with alternating lines.

It may be possible to use the CSS nth-child(even) trick, but that may not work when the tables are split across pages using something like pagedjs.

@tarleb
Copy link
Collaborator

tarleb commented Jul 10, 2024

@Malcolmnixon: Lua filter to restore the old behavior:

local function add_odd_even (rows)
  for rownum, row in ipairs(rows) do
    row.classes:insert((rownum % 2) == 0 and 'even' or 'odd')
  end
  return rows
end

function Table (tbl)
  add_odd_even(tbl.head.rows)
  for _, tblbody in ipairs(tbl.bodies) do
    add_odd_even(tblbody.body)
  end
  add_odd_even(tbl.foot.rows)
  return tbl
end

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.

4 participants