question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

References from object treated as local, break pdf

See original GitHub issue

Expected Behavior

I’ve got the following object element:

<object data="https://www.youtube.com/embed/BaUjhYw8IK4" width="640" height="480" props="kc">
<desc>Sample video</desc>
</object>

For HTML, I expect this to render proprely as <object>, which it does in 2.5 and 3.0. For PDF, I expect to at least get a PDF, whether or not any video link appears.

Actual Behavior

  • In DITA-OT 2.5.4 this generates errors in the copy-html step: [copy] Failed to copy https://www.youtube.com/embed/BaUjhYw8IK4 to C:\DCS\2.5.4\test\object\outot25\https:\www.youtube.com\embed\BaUjhYw8IK4 due to java.io.FileNotFoundException C:\DCS\2.5.4\test\object\outot25\https:\www.youtube.com\embed\BaUjhYw8IK4 (The filename, directory name, or volume label syntax is incorrect.)
  • In DITA-OT 3.0, the HTML5 build begins generating errors in gen-list and actually writes the full linked file into the log, beginning with:
 [gen-list] Processing https://www.youtube.com/embed/BaUjhYw8IK4
 [gen-list] Warning at xsl:stylesheet on line 6 column 31 of utils.xsl:
 [gen-list]   Stylesheet module classpath:///utils.xsl is included or imported more than once. This is
 [gen-list]   permitted, but may lead to errors or unexpected behavior
 [gen-list] <html lang="en" dir="ltr" data-cast-api-enabled="true"><head><meta name="viewport" content="width=device-width, initial-scale=1"/>.....
  • In DITA-OT 2.5.4, for PDF, I just don’t get any output for the <object> which is probably expected? But I also get the errors in copy-html step.
  • In DITA-OT 3.0 I get a build failure from preprocess2 during topic-reader:
topic-reader:
[topic-reader] Using Xerces grammar pool for DTD and schema caching.
[topic-reader] Reading file:/C:/Users/IBM_AD~1/AppData/Local/Temp/temp20171204114654541/3c1800f39f5b7298def0161594fc05a5c1b1c37f.ditamap
[topic-reader] Processing file:/C:/DCS/2.5.3/test/object/objecttopic.dita to file:/C:/Users/IBM_AD~1/AppData/Local/Temp/temp20171204114654541/301cafc00339e9b3edf1b835f7da0f7852dfb307.dita
[topic-reader] Processing https://www.youtube.com/embed/BaUjhYw8IK4 to file:/C:/Users/IBM_AD~1/AppData/Local/Temp/temp20171204114654541/44100a95ff76fdda357167ae391ab249a6fdecfb
[topic-reader] Warning at xsl:stylesheet on line 6 column 31 of utils.xsl:
[topic-reader]   Stylesheet module classpath:///utils.xsl is included or imported more than once. This is
[topic-reader]   permitted, but may lead to errors or unexpected behavior
Error: java.nio.file.InvalidPathException: Illegal char <:> at index 5: https:\www.youtube.com\embed\BaUjhYw8IK4

Possible Solution

The workaround is to use @datakeyref, and on the key definition set scope="external". But, we shouldn’t be crashing (and I’ve got a lot of objects coded like this in older material). Not sure of the code solution.

Steps to Reproduce

Samples attached - build to html5 or pdf to reproduce. Samples include the broken <object> as well as one that uses keys to get better results: object.zip

Environment

  • DITA-OT version: 2.5.4, 3.0
  • Operating system and version: Windows 7
  • How did you run DITA-OT? dita command
  • Transformation type: html5, pdf

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
xephon2commented, Dec 4, 2017

Offtopic The followng Ant snippet downloads the YouTube teaser image. Maybe this helps someone, who wants to use it as a placeholder in PDF:

<?xml version="1.0" encoding="UTF-8"?>
<project name="YouTubeAnt" default="all">
    
    <macrodef name="getYouTubeTeaserImage">
        <attribute name="url"/>
        <attribute name="dest"/>
        <sequential>
            <property name="youtube-url" value="@{url}"/>
            <script language="javascript">
                <![CDATA[
                    var youtubeURL = YouTubeAnt.getProperty("youtube-url");
                    var delimIndex = youtubeURL.lastIndexOf('=');
                    var youtubeID = youtubeURL.substring(delimIndex + 1, youtubeURL.length());
                    YouTubeAnt.setProperty("video-id", youtubeID);
                ]]>
            </script>
            <get src="http://img.youtube.com/vi/${video-id}/0.jpg" dest="@{dest}"/>
        </sequential>
    </macrodef>

    <target name="all">
        <getYouTubeTeaserImage url="https://www.youtube.com/watch?v=h7OyOsFv5AQ" dest="teaser.jpg"/>
    </target>
</project>
0reactions
robandercommented, May 14, 2019

Fixed with #3306

Read more comments on GitHub >

github_iconTop Results From Across the Web

Objects With Fields Treated by Reference (OOP-style) - R
Computations with objects from reference classes invoke methods on them and extract or set their fields, using the `$` operator in R. The...
Read more >
Java Where do Local variables,Object references,instance ...
Local variable d (allocated on stack) contains a reference to an object of class Duck . In general objects are allocated on the...
Read more >
basic-legal-citation.pdf - Law.Cornell.Edu
and, in states where one exists, a local citation guide. ... While the principal citation reference works still treat the citation of electronically ......
Read more >
Manipulating documents - Learn web development | MDN
You can use this object to return and manipulate information on the HTML and CSS that comprises the document, for example get a...
Read more >
Understanding JSON Schema
JSON Schema is a powerful tool for validating the structure of JSON data. However, learning to use it by reading its.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found