thinreports-generator icon indicating copy to clipboard operation
thinreports-generator copied to clipboard

Support inline format of Prawn in Text and TextBlock

Open hidakatsuya opened this issue 10 years ago • 13 comments

Prawn's inline formatting: http://rubydoc.info/gems/prawn/0.12.0/Prawn/Text:text

Support formats:

  • Bold: <b>bold</b>
  • Italic: <i>italic</i>
  • Underline: <u>underline</u>
  • Strikethrough: <strikethrough>strikethrough</strikethrough>
  • Subscript, Superscript: <superscript>super</superscript>, <subscript>sub</subscript>
  • Font style - Size, CharacterSpacing: <font size="24">font style</font>
  • Text color: <color rgb="#ff0000">color</color>
  • Link: <link href="http://www.thinreports.org">thinreports.org</link>

Support table:

Format TextBlock in global TextBlock in List Text
<b> Yes Yes Yes
<i> Yes Yes Yes
<u> Yes Yes Yes
<strikethrough> Yes Yes Yes
<sub> Yes Yes Yes
<sup> Yes Yes Yes
<font> Yes Yes Yes
<color> Yes Yes Yes
<link> Yes Yes Yes

Example:

page.item(:text).value('<b>ThinReports</b> official site is <i>thinreports.org</i>')

=> ThinReports official site is thinreports.org.

hidakatsuya avatar Oct 01 '14 01:10 hidakatsuya

I ended up monkey-patching the text_box method in my rails app. It's a terrible approach but at least it got the job done for now.

Inline format works as expected except for the fact that links are not clickable when you use them inside a list for some reason.

elshaka avatar Oct 02 '14 04:10 elshaka

Thank you for your advice.

My implementation for this feature is almost the same as your. Also inline format is enabled by thinreports/thinreports-editor#12.

hidakatsuya avatar Oct 02 '14 11:10 hidakatsuya

I think that a problem that links are not clickable is probably caused by prawn's bug (or specification). So i have reported the issue to prawnpdf/prawn#801.

hidakatsuya avatar Nov 07 '14 04:11 hidakatsuya

The Inline link wont't supports.

hidakatsuya avatar Jan 24 '15 19:01 hidakatsuya

We will support a part in this version as below:

Format TextBlock in global TextBlock in List Text
<b> Yes Yes Yes
<i> Yes Yes Yes
<u> Yes Yes Yes
<strikethrough> Yes Yes Yes
<sub> Yes Yes Yes
<sup> Yes Yes Yes
<font> Yes Yes Yes
<color> Yes Yes Yes
<link> Yes No No

hidakatsuya avatar Feb 24 '15 11:02 hidakatsuya

We have desided that we don't fix this feature in v0.8. Becase following cases don't work:

  • <font name="IPAMincho"><b>日本語</b></font>
  • <link href="http://www.example.com">link</link>

So, we will move the feature to v1.0.0 milestone.

hidakatsuya avatar Apr 16 '15 00:04 hidakatsuya

This feature will be implemented in 1.0.0, because prawnpdf/prawn#801 have been fixed in prawn 2.0.1.

hidakatsuya avatar May 09 '15 08:05 hidakatsuya

Can this be merged back? It seems prawn issue is fixed.

juggy avatar Oct 15 '15 01:10 juggy

Can this be merged back? It seems prawn issue is fixed.

Yes, we will try to merge it in v1.0.0.

hidakatsuya avatar Oct 19 '15 16:10 hidakatsuya

@elshaka Can you provide a new link to your workaround for this?

Thanks!

willjohnson avatar Mar 07 '16 17:03 willjohnson

@willjohnson here ! It's an old monkey patch, you should check if it still does the job, I'm not using it right now.

elshaka avatar Mar 07 '16 18:03 elshaka

Any eta for 1.0.0 ?

mukuls-brdsys avatar Oct 06 '16 11:10 mukuls-brdsys

@mukuls-brdsys

Any eta for 1.0.0 ?

The specific release schedule is undecided.

hidakatsuya avatar Oct 21 '16 14:10 hidakatsuya