Forum Bugs

requirejs support?

sglaser
I'm trying to display a document that uses respect (www.w3.org/respec). It doesn't seem to run any of the javascript code.

for example

prince --javascript -v -i html -o foo.pdf http://www.w3.org/respec/guide.html

Respec is a javascript library for writing w3c specs. It uses requirejs (http://requirejs.org). Requirejs in turn, appears to use setTimeout to wait for modules to load. I'm guessing that that is the source of the problem.

Any thoughts? Workarounds?
mikeday
Support for setTimeout and AJAX requests will be necessary for requirejs to work. Our latest development builds of Prince support setTimeout, but AJAX is still only partially supported, so it still isn't quite enough:
prince: Running scripts...
prince: loading script: http://www.w3.org/respec/js/beryl-config.js
prince: loading script: http://www.w3.org/respec/js/beryl.min.js
RESPEC PROCESSING STARTED
prince: error: TypeError: invalid this value
prince: loading AJAX request: http://www.w3.org/respec/examples/minimal-w3c.html
prince: error: TypeError: invalid this value
ERROR: Error including URI=examples/minimal-w3c.html: error (TypeError: value is not an object)
sglaser
Thanks. I was able to save a snapshot in the browser and convert that file instead. This way the browser javascript engine was doing all the work.
dauwhe
Tell them to write the spec with Bikeshed instead of ReSpec :)

I made a PDF from a W3C spec produced with Bikeshed using Prince with no issues.

Dave (who is editing specs using both Bikeshed and ReSpec)

mmcgillion
Hi Mike

Is there a timeline for requirejs support? I see its on the roadmap but is there a chance it could be included in the next release or a patch release during 2015?

http://www.princexml.com/roadmap/

Thanks
Mark
mikeday
Difficult to say, we will need to investigate and see what is the major issue.
mikeday
The major issue turned out to be onload events for scripts, which we now support. However, libraries such as HighCharts need many other DOM features which will take further time to develop.
mikeday
Prince 11 has a number of JavaScript DOM improvements, and we now have a repository of helper scripts to boost compatibility with popular frameworks.