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

Crash in compiling ISO 10303-104 with PNG images #363

Closed
ronaldtse opened this issue May 1, 2020 · 3 comments
Closed

Crash in compiling ISO 10303-104 with PNG images #363

ronaldtse opened this issue May 1, 2020 · 3 comments
Assignees
Labels

Comments

@ronaldtse
Copy link
Contributor

This issue comes from https://github.com/metanorma/iso-10303/pull/31 .

There is an issue in compiling the document:

At this node,

==============================ERROR AT NODE
<p id="_0fe3408a-a082-4d10-b88b-fd419efa2dd8"><xref target="fig-express-g-diagram-1" type="inline"/> through <xref target="fig-express-g-diagram-86" type="inline"/> correspond to the EXPRESS listing given in <xref target="annex-computer-interpretable-listings" type="inline"/>. The diagrams use the EXPRESS-G graphical notation for the EXPRESS language. EXPRESS-G is defined in annex D of <xref target="iso10303-11" type="inline"/>.</p>
<figure id="fig-express-g-diagram-1">
<name>Structural response definition schema EXPRESS-G diagram, 1 of 86.</name>
<image src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAApUAAANYCAYAAACVUBZ5AAAACXBIWXMAAB2HAAAdhwGP5fFlAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAIABJREFUeJzs3XmYTvX/x/HXmM0MY9+LqBRlKyQhKkLakCJZy1rflAiNn
...
</figure>
<figure id="_51e48819-aeb3-44eb-94ac-b1f6a17036d8">
<name>Structural response representation schema EXPRESS-G diagram, 2 of 86.</name>
...
</figure>
<figure id="fig-express-g-diagram-86">
<name>Scalar vector tensor schema EXPRESS-G diagram, 86 of 86.</name>
<image src="data:image/png;base64,iVBORw0...uQmCC" id="_a023e991-372c-4463-8b37-97bc6d348428" mimetype="image/png" height="auto" width="auto"/>
</figure>

Metanorma compile crashes with this message:

bundler: failed to load command: metanorma (/Users/me/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/bin/metanorma)
RuntimeError: error parsing fragment (1)
  /Users/me/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/node.rb:476:in `in_context'
  /Users/me/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/node.rb:476:in `parse'
  /Users/me/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/document_fragment.rb:19:in `initialize'
  /Users/me/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/document.rb:235:in `new'
  /Users/me/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/document.rb:235:in `fragment'
  /Users/me/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/builder.rb:354:in `<<'
  /Users/me/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/bundler/gems/metanorma-standoc-c9185279bb8e/lib/asciidoctor/standoc/section.rb:136:in `block in annex_parse'
  /Users/me/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/builder.rb:394:in `insert'
  /Users/me/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/builder.rb:377:in `method_missing'
  /Users/me/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/bundler/gems/metanorma-standoc-c9185279bb8e/lib/asciidoctor/standoc/section.rb:133:in `annex_parse'
  /Users/me/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/bundler/gems/metanorma-iso-da7f9147dc47/lib/asciidoctor/iso/section.rb:31:in `block in section'

I wonder if this is due to the size of the node, or some issue with parsing? It looks correct to me, though.

@ronaldtse ronaldtse added the bug label May 1, 2020
@ronaldtse ronaldtse added this to Needs triage in Nick Nicholas via automation May 1, 2020
@ronaldtse ronaldtse moved this from Needs triage to Urgent in Nick Nicholas May 1, 2020
@ronaldtse
Copy link
Contributor Author

Related to sparklemotion/nokogiri#1442

@ronaldtse
Copy link
Contributor Author

Since this is due to size of node content caused by images, we can:

  1. Do not dereference images when parsing. Only dereference them into base64 when the document is completed.
  2. Fix our usage of "adding nodes" so that Nokogiri doesn't break.

@opoudjis
Copy link
Contributor

opoudjis commented May 4, 2020

Doing the first works for the given issue.

Not clear to me what to do to error-proof "<<"; any rescue would still result in either an incomplete or an empty document.

Nick Nicholas automation moved this from Urgent to Closed May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Nick Nicholas
  
Closed
Development

No branches or pull requests

2 participants