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

Support (or ignore) cellbgcolor using CSS color name #1396

Closed
ggrossetie opened this issue Nov 19, 2019 · 3 comments
Closed

Support (or ignore) cellbgcolor using CSS color name #1396

ggrossetie opened this issue Nov 19, 2019 · 3 comments
Assignees
Labels
Milestone

Comments

@ggrossetie
Copy link
Member

Now that cellbgcolor attribute is used, the following document throws an exception:

= Table with cellbgcolor

[%autowidth,cols=3*]
|===
| default background color
| {set:cellbgcolor:red}red background color
| {set:cellbgcolor:white}white background color
|===
$ asciidoctor-pdf test.adoc --trace
/home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-2.2.2/lib/prawn/graphics/color.rb:100:in `color_type': Unknown type of color: "ed" (ArgumentError)
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-2.2.2/lib/prawn/graphics/color.rb:130:in `color_space'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-2.2.2/lib/prawn/graphics/color.rb:178:in `set_color'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-2.2.2/lib/prawn/graphics/color.rb:185:in `set_fill_color'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-2.2.2/lib/prawn/graphics/color.rb:29:in `fill_color'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-table-0.2.2/lib/prawn/table/cell.rb:716:in `block in draw_background'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-2.2.2/lib/prawn/document.rb:650:in `mask'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-table-0.2.2/lib/prawn/table/cell.rb:715:in `draw_background'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-table-0.2.2/lib/prawn/table/cell.rb:414:in `block in draw_cells'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-table-0.2.2/lib/prawn/table/cell.rb:412:in `each'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-table-0.2.2/lib/prawn/table/cell.rb:412:in `draw_cells'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-table-0.2.2/lib/prawn/table.rb:425:in `ink_and_draw_cells'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-table-0.2.2/lib/prawn/table.rb:312:in `block in draw'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-table-0.2.2/lib/prawn/table.rb:680:in `with_position'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-table-0.2.2/lib/prawn/table.rb:260:in `draw'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/prawn-table-0.2.2/lib/prawn/table.rb:112:in `table'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-pdf-1.5.0.beta.7/lib/asciidoctor/pdf/converter.rb:2182:in `convert_table'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-pdf-1.5.0.beta.7/lib/asciidoctor/pdf/converter.rb:138:in `convert'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-2.0.10/lib/asciidoctor/abstract_block.rb:75:in `convert'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-2.0.10/lib/asciidoctor/abstract_block.rb:84:in `block in content'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-2.0.10/lib/asciidoctor/abstract_block.rb:84:in `map'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-2.0.10/lib/asciidoctor/abstract_block.rb:84:in `content'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:1020:in `content'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-pdf-1.5.0.beta.7/lib/asciidoctor/pdf/converter.rb:154:in `convert_content_for_block'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-pdf-1.5.0.beta.7/lib/asciidoctor/pdf/converter.rb:255:in `block in convert_document'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-pdf-1.5.0.beta.7/lib/asciidoctor/pdf/converter.rb:563:in `indent_section'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-pdf-1.5.0.beta.7/lib/asciidoctor/pdf/converter.rb:212:in `convert_document'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-pdf-1.5.0.beta.7/lib/asciidoctor/pdf/converter.rb:138:in `convert'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:951:in `convert'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:118:in `convert'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `block in convert_file'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `open'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `convert_file'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in `block in invoke!'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `each'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `invoke!'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/gems/asciidoctor-pdf-1.5.0.beta.7/bin/asciidoctor-pdf:32:in `<top (required)>'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/bin/asciidoctor-pdf:23:in `load'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/bin/asciidoctor-pdf:23:in `<main>'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
	from /home/guillaume/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'

As you can see the error message is misleading because the first letter is removed. So at first I thought I made a typo but now I think that CSS color names are not supported right?

$ asciidoctor-pdf -v
Asciidoctor PDF 1.5.0.beta.7 using Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)
@mojavelinux
Copy link
Member

Color names are not supported. That is correct. It must be a hex code.

@mojavelinux mojavelinux added this to the support milestone Nov 19, 2019
@ggrossetie
Copy link
Member Author

Maybe we can issue a warning if the color is "unknown" or "invalid"?
And if you want to fail, you can always use --failure-level right?

@mojavelinux
Copy link
Member

Yes, we could throw away an invalid value instead of failing. If you'd like to submit a PR for that, that would be most welcome.

@mojavelinux mojavelinux self-assigned this Nov 20, 2019
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Nov 20, 2019
@mojavelinux mojavelinux modified the milestones: support, v1.5.0 Nov 20, 2019
@mojavelinux mojavelinux modified the milestones: v1.5.0, v1.5.0.beta.8 Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants