bugGNU Octave - Bugs: bug #45628, generate_package_html doesn't copy...

 
 

bug #45628: generate_package_html doesn't copy svg images

Submitter:  Oliver Heimlich <oheim>
Submitted:  Sat 25 Jul 2015 05:43:29 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Oliver Heimlich Open/Closed:  * Closed
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 14 Sep 2015 08:13:25 PM UTC, comment #4: 

Ok, I have pushed the change. Bug can be closed.

Oliver Heimlich <oheim>
Mon 14 Sep 2015 08:02:34 PM UTC, comment #3: 

Looks ok to me, feel free to push it.

Julien Bect <jbect>
Mon 14 Sep 2015 05:16:09 PM UTC, comment #2: 

push Any objections to this change?

Oliver Heimlich <oheim>
Sat 25 Jul 2015 06:22:55 PM UTC, comment #1: 

Also, while we are at this line, please consider support for multiple image references per line:


diff -r bcd1979b0601 inst/generate_package_html.m
--- a/inst/generate_package_html.m        Wed Jul 15 23:13:15 2015 +0200
+++ b/inst/generate_package_html.m        Sat Jul 25 20:20:33 2015 +0200
@@ -602,9 +602,9 @@
     error ("Couldn't open %s for reading", file);
   endif
   while (! isnumeric (l = fgetl (fid)))
-    m = regexp (l, "<img.+src=""([^""]+)"".*>", "tokens");
-    if (! isempty (m))
-      url = m{1}{1};
+    m = regexp (l, "<(?:img.+?src|object.+?data)=""([^""]+)"".*?>", "tokens");
+    for i = 1 : numel (m)
+      url = m{i}{1};
       ## exclude external links
       if (isempty (strfind (url, "//")))
         if (! isempty (strfind (url, "..")))
@@ -625,7 +625,7 @@
           endif
         endif
       endif
-    endif
+    endfor
   endwhile
   fclose (fid);


Oliver Heimlich <oheim>
Sat 25 Jul 2015 05:43:29 PM UTC, original submission:  

During generage_package_html image files are collected and copied into the output folder.  However, svg images are not copied.  I want to use svg images in the HTML version of the package manual and the following patch solves the issue:



diff -r bcd1979b0601 inst/generate_package_html.m
--- a/inst/generate_package_html.m        Wed Jul 15 23:13:15 2015 +0200
+++ b/inst/generate_package_html.m        Sat Jul 25 19:36:19 2015 +0200
@@ -602,7 +602,7 @@
     error ("Couldn't open %s for reading", file);
   endif
   while (! isnumeric (l = fgetl (fid)))
-    m = regexp (l, "<img.+src=""([^""]+)"".*>", "tokens");
+    m = regexp (l, "<(?:img.+src|object.+data)=""([^""]+)"".*>", "tokens");
     if (! isempty (m))
       url = m{1}{1};
       ## exclude external links



For testing purpose you can use the following HTML snippet:

<object data="image/example.svg" type="image/svg+xml">
   <param name="src" value="image/example.svg" />
   <!-- If the browser can't render svg, use the
        rasterized version instead -->
   <img src="image/example.png" />
</object>


Oliver Heimlich <oheim>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by jbect (Posted a comment)
  • -email is unavailable- added by oheim (Submitted the item)
  • -email is unavailable- added by oheim (package maintainer)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-09-14 mtmiller StatusNone Fixed
        Open/ClosedOpen Closed
    2015-07-25 oheim Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code