diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2018-03-04 23:49:08 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-03-04 23:49:08 -0700 |
| commit | dcb627791d0d8a8fa45481afd2e7d90e3e2f1e44 (patch) | |
| tree | 9ff48bd8815c68b578895b3f2a4f4377d0e75560 | |
| parent | 2034a5f3f5a67ddb2bd549957abb547064ae8c87 (diff) | |
resolves #1365 allow table stripes to be configured using stripe option on table (PR #2588)
- valid values are even, odd, all, and none
- not set by default; implies stripes on even rows
- requires support from stylesheet
| -rw-r--r-- | data/stylesheets/asciidoctor-default.css | 2 | ||||
| -rw-r--r-- | lib/asciidoctor/converter/html5.rb | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/data/stylesheets/asciidoctor-default.css b/data/stylesheets/asciidoctor-default.css index 6cb60c19..e3f21572 100644 --- a/data/stylesheets/asciidoctor-default.css +++ b/data/stylesheets/asciidoctor-default.css @@ -257,6 +257,8 @@ table.grid-all>tbody>tr:last-child>.tableblock,table.grid-all>thead:last-child>t table.frame-all{border-width:1px} table.frame-sides{border-width:0 1px} table.frame-topbot{border-width:1px 0} +table.stripe-all tr,table.stripe-odd tr:nth-of-type(odd){background:#f8f8f7} +table.stripe-none tr,table.stripe-odd tr:nth-of-type(even){background:none} th.halign-left,td.halign-left{text-align:left} th.halign-right,td.halign-right{text-align:right} th.halign-center,td.halign-center{text-align:center} diff --git a/lib/asciidoctor/converter/html5.rb b/lib/asciidoctor/converter/html5.rb index 629bcb09..3f11bfe3 100644 --- a/lib/asciidoctor/converter/html5.rb +++ b/lib/asciidoctor/converter/html5.rb @@ -785,6 +785,9 @@ Your browser does not support the audio tag. result = [] id_attribute = node.id ? %( id="#{node.id}") : '' classes = ['tableblock', %(frame-#{node.attr 'frame', 'all'}), %(grid-#{node.attr 'grid', 'all'})] + if (stripe = node.attr 'stripe') + classes << %(stripe-#{stripe}) + end styles = [] unless (node.option? 'autowidth') && !(node.attr? 'width', nil, false) if node.attr? 'tablepcwidth', 100 |
