ietf-tools / xml2rfc

Generate RFCs and IETF drafts from document source in XML according to the IETF xml2rfc v2 and v3 vocabularies
https://ietf-tools.github.io/xml2rfc/
BSD 3-Clause "New" or "Revised" License
69 stars 39 forks source link

including graphics/image as artwork in binary format fails #751

Closed DDvO closed 2 years ago

DDvO commented 2 years ago

When trying to embed a PNG or JPG image, e.g., like this:

<figure title="foo">
   <artwork src="foo.png">
[ Cannot render graphics - please view foo.png ]
    </artwork>
</figure>

xml2rfc version 3.11.1 fails like this:

Error: Discarded unexpected <artwork> content with type='png': ''utf-8' codec can't decode byte 0x89 in position 0: invalid start byte'
Warning: No image data found in source file foo.png

This may be due to a bug in xml2rfc or some Python 3 hick-up and appears related to https://stackoverflow.com/questions/27219301/utf-8-codec-cant-decode-byte-0x89

A workaround is to use a graphics file in SVG format, yet it may be hard to obtain and xml2rfc appears pretty picky about the structure of the SVG input. What worked best for me was to convert/save the source graphics in PDF format and then use https://www.zamzar.com/convert/pdf-to-svg/

jrlevine commented 2 years ago

Although rfc 7991 is somewhat unclear on this point, we only allow text and SVG in artwork, not anything else. This is a reasonable idea for an enhancement in the future.

toerless commented 2 years ago

We would simply like to use the same mechanism that for example rfc7893 uses to include PNG graphics.

On Wed, Mar 30, 2022 at 09:44:07AM -0700, John L wrote:

Although rfc 7991 is somewhat unclear on this point, we only allow text and SVG in artwork, not anything else. This is a reasonable idea for an enhancement in the future.

-- Reply to this email directly or view it on GitHub: https://github.com/ietf-tools/xml2rfc/issues/751#issuecomment-1083375507 You are receiving this because you are subscribed to this thread.

Message ID: @.***>

jrlevine commented 2 years ago

As you are surely aware, RFC 7893 was a one-off using the old toolchain.

toerless commented 2 years ago

No, i am not aware. Can you please point me to the IETF policies and when they changed ? Last i was aware, it was welcome to produce the highest visual quality RFCs, including PNG images into PDF renderings.

It seems counterproductive if that option was eliminated by new rules.

On Wed, Mar 30, 2022 at 10:47:05AM -0700, John L wrote:

As you are surely aware, RFC 7893 was a one-off using the old toolchain.

-- Reply to this email directly or view it on GitHub: https://github.com/ietf-tools/xml2rfc/issues/751#issuecomment-1083435806 You are receiving this because you are subscribed to this thread.

Message ID: @.***>

jrlevine commented 2 years ago

Oh, my. You can start with RFCs 7990, 7991, 7992, 7993, 7994, 7995, 7996, 7997, and 7998. Particularly 7996.

cabo commented 2 years ago

And 6949.

      8.  Graphics may include ASCII art and a more complex form to be
          defined, such as SVG line art [SVG].  Color and grayscale will
          not be accepted.  RFCs must correctly display in monochromatic
          black-and-white to allow for monochrome displays, black-and-
          white printing, and support for visual disabilities.

Where were you 2013?

Welcome to the wonderful world of RFCXMLv3.

jrlevine commented 2 years ago

To be clear, I think PNG is a reasonable candidate as an enhancement, give or take accessibility issues, but it's not going to happen any time soon.