Revision: 22379
          http://sourceforge.net/p/bibdesk/svn/22379
Author:   hofman
Date:     2018-06-30 12:14:30 +0000 (Sat, 30 Jun 2018)
Log Message:
-----------
Add secret attribute to help img elements when high resolution image is 
present, so supporting browsers can display those

Modified Paths:
--------------
    trunk/bibdesk/BibDeskHelp/applehelp.init

Modified: trunk/bibdesk/BibDeskHelp/applehelp.init
===================================================================
--- trunk/bibdesk/BibDeskHelp/applehelp.init    2018-06-30 11:59:11 UTC (rev 
22378)
+++ trunk/bibdesk/BibDeskHelp/applehelp.init    2018-06-30 12:14:30 UTC (rev 
22379)
@@ -36,7 +36,7 @@
        }
     if (($tag_level eq "chapter") || ($tag_level eq "section") || ($tag_level 
eq "subsection") || ($tag_level eq "appendix"))
     {
-        $text = "<img src=\"gfx/BibDeskIcon.png\" alt=\"BibDesk\"> " . $text;
+        $text = 
&$image("gfx/BibDeskIcon.png","BibDesk",0,"gfx/BibDeskIcon.png") . " " . $text;
     }
     return "<h$level class=\"$tag_level\"> $text</h$level>$node\n";
 }
@@ -101,15 +101,28 @@
 
 $simple_map{'*'} = '<br/>';
 
+sub has_include_file($)
+{
+    my $file = shift;
+    foreach my $dir (@Texi2HTML::Config::INCLUDE_DIRS)
+    {
+        return 1 if (-e "$dir/$file" && -r "$dir/$file");
+    }
+    return 0;
+}
+
 $image = \&appleHelp_image;
 
 sub appleHelp_image{
-   my $file = shift;
-   my $base = shift;
-   my $preformatted = shift;
-   my $file_name = shift;
-   return "[ $base ]" if ($preformatted);
-   return "<img src=\"$file_name\" alt=\"$base\">";
+    my $file = shift;
+    my $base = shift;
+    my $preformatted = shift;
+    my $file_name = shift;
+    my $file_name_2x = "$file_name";
+    $file_name_2x =~ s/(.*)\./$1\@2x\./;
+    return "[ $base ]" if ($preformatted);
+    return "<img src=\"$file_name\" srcset=\"$file_name 1x, $file_name_2x 2x\" 
alt=\"$base\" />" if has_include_file("$file_name_2x");
+    return "<img src=\"$file_name\" alt=\"$base\" />";
 }
 
 $index_entry_label = \&appleHelp_index_entry_label;
@@ -120,7 +133,7 @@
     $was_pre = shift;
     $lin = shift;
     $anchor_str = "<a name=\"$id\"></a>";
-    $label_str = "<META name=\"keywords\" content=\"$lin\">";
+    $label_str = "<META name=\"keywords\" content=\"$lin\" />";
     $anchor_str .= $label_str;
     $anchor_str .= "\n" if $was_pre;
     print "FOUND" if $was_pre;
@@ -167,11 +180,11 @@
     #$longtitle .= ": $Texi2HTML::NO_TEXI{'This'}" if exists 
$Texi2HTML::NO_TEXI{'This'};
     my $description = $DOCUMENT_DESCRIPTION;
     $description = $longtitle if (!defined($description));
-    $description = "<meta name=\"description\" content=\"$description\">" if
+    $description = "<meta name=\"description\" content=\"$description\" />" if
          ($description ne '');
     $description = $Texi2HTML::THISDOC{'documentdescription'} if 
(defined($Texi2HTML::THISDOC{'documentdescription'}));
     my $encoding = '';
-    $encoding = "<meta http-equiv=\"Content-Type\" content=\"text/html; 
charset=$ENCODING\">" if (defined($ENCODING) and ($ENCODING ne ''));
+    $encoding = "<meta http-equiv=\"Content-Type\" content=\"text/html; 
charset=$ENCODING\" />" if (defined($ENCODING) and ($ENCODING ne ''));
     print $fh <<EOT;
 $DOCTYPE
 <html>
@@ -183,11 +196,11 @@
 <title>$longtitle</title>
 
 $description
-<meta name="keywords" content="$longtitle">
-<meta name="resource-type" content="document">
-<meta name="distribution" content="global">
-<meta name="Generator" content="$Texi2HTML::THISDOC{program}">
-<meta name="robots" content="anchors">
+<meta name="keywords" content="$longtitle" />
+<meta name="resource-type" content="document" />
+<meta name="distribution" content="global" />
+<meta name="Generator" content="$Texi2HTML::THISDOC{program}" />
+<meta name="robots" content="anchors" />
 $encoding
 $CSS_LINES
 </head>

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to