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

References from object treated as local, break pdf #2861

Closed
robander opened this issue Dec 4, 2017 · 6 comments

Comments

Projects
3 participants
@robander
Copy link
Member

commented Dec 4, 2017

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
@xephon2

This comment has been minimized.

Copy link
Contributor

commented 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>
@raducoravu

This comment has been minimized.

Copy link
Member

commented Dec 5, 2017

Looks like a duplicate of: #2722

@robander

This comment has been minimized.

Copy link
Member Author

commented Dec 5, 2017

Yes, looks like a duplicate for at least the 2.5 behavior, but I don't think the 3.0 crash had been reported yet. I commented on that other one just a few days ago but missed it here because I was looking for a report about the 3.0 crash...

@raducoravu

This comment has been minimized.

Copy link
Member

commented Dec 5, 2017

Also from what I tested at some point the behavior when running on Linux/Mac is different, it actually manages to create in the temporary files and output folder a structure containing folder names like "http:" because on Linux you can have ":" in a file or folder name.

@robander

This comment has been minimized.

Copy link
Member Author

commented Jan 5, 2018

The PDF failure here is a duplicate of #2862 -- another case of finding @href that doesn't explicitly set scope="external", assuming it is format dita, and attempting to process the referenced link to a generated topic.

@robander robander added this to To do in 3.3.2 via automation May 14, 2019

@robander robander added this to the 3.3.2 milestone May 14, 2019

@robander

This comment has been minimized.

Copy link
Member Author

commented May 14, 2019

Fixed with #3306

@robander robander closed this May 14, 2019

3.3.2 automation moved this from To do to Done May 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.