support previewing of sparklines: embed in data uris for preview
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 7 Mar 2007 07:41:07 +0000 (07:41 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 7 Mar 2007 07:41:07 +0000 (07:41 +0000)
IkiWiki/Plugin/sparkline.pm
doc/plugins/sparkline.mdwn
po/bg.po
po/cs.po
po/es.po
po/fr.po
po/gu.po
po/ikiwiki.pot
po/pl.po
po/sv.po
po/vi.po

index a44e062520f9132d89f91f83ef37a8d3e49f50bc..63c2cf94391127018dbc57460ecb5a8569c73e46 100644 (file)
@@ -108,10 +108,6 @@ sub preprocess (@) { #{{{
                $php.=qq{\$sparkline->RenderResampled($width, $height);\n};
        }
        
-       if ($params{preview}) {
-               return "[[".gettext("sparkline previewing not implemented")."]]";
-       }
-       
        $php.=qq{\$sparkline->Output();\n?>\n};
 
        # Use the sha1 of the php code that generates the sparkline as
@@ -148,7 +144,16 @@ sub preprocess (@) { #{{{
                        return  "[[".gettext("sparkline failed to run php")."]]";
                }
 
-               writefile($fn, $config{destdir}, $png, 1);
+               if (! $params{preview}) {
+                       writefile($fn, $config{destdir}, $png, 1);
+               }
+               else {
+                       # can't write the file, so embed it in a data uri
+                       eval q{use MIME::Base64};
+                       error($@) if $@;
+                       return "<img src=\"data:image/png;base64,".
+                               encode_base64($png)."\" />";
+               }
        }
 
        return '<img src="'.
index 738c6fa955cc92651dc12af56a94d22bb37603f3..1b22054a65a66b580938fe682d8701144b09078d 100644 (file)
@@ -17,9 +17,8 @@ to use the plugin, you will need:
 * A "php" program in the path, that can run standalone php programs.
 * [[cpan Digest::SHA1]]
 
-On a Debian system, this can be accomplished by installing the
-`libsparkline-php`, `php5-gd`, `php5-cli`, and `libdigest-sha1-perl`
-packages.
+On a Debian system, this can be accomplished by installing these packages:
+`libsparkline-php` `php5-gd` `php5-cli` `libdigest-sha1-perl`
 
 # examples
 
index 3e54381335fe63b158f50bed2fb3836bf8ec5bb8..05603d833f5556e29b547760d369f4a7c72c7843 100644 (file)
--- a/po/bg.po
+++ b/po/bg.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ikiwiki-bg\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-03-07 01:22-0500\n"
+"POT-Creation-Date: 2007-03-07 02:29-0500\n"
 "PO-Revision-Date: 2007-01-12 01:19+0200\n"
 "Last-Translator: Damyan Ivanov <dam@modsodtsys.com>\n"
 "Language-Team: Bulgarian <dict@fsa-bg.org>\n"
@@ -343,12 +343,7 @@ msgstr "липсващ параметър „id” на шаблона"
 msgid "sparkline bad width value"
 msgstr "приставката „linkmap”: грешка при изпълнение на „dot”"
 
-#: ../IkiWiki/Plugin/sparkline.pm:112
-#, fuzzy
-msgid "sparkline previewing not implemented"
-msgstr "функцията „getctime” не е реализирана"
-
-#: ../IkiWiki/Plugin/sparkline.pm:148
+#: ../IkiWiki/Plugin/sparkline.pm:144
 #, fuzzy
 msgid "sparkline failed to run php"
 msgstr "приставката „linkmap”: грешка при изпълнение на „dot”"
@@ -509,3 +504,7 @@ msgstr "Грешка"
 #, perl-format
 msgid "%s preprocessing loop detected on %s at depth %i"
 msgstr "открита е циклична завидимост при %s на „%s” на дълбочина %i"
+
+#, fuzzy
+#~ msgid "sparkline previewing not implemented"
+#~ msgstr "функцията „getctime” не е реализирана"
index 70c90d7df2bc911c85883c091b09b3b103af1f35..3197174cf3d1befb42e2a4529fd50fe499b6b47e 100644 (file)
--- a/po/cs.po
+++ b/po/cs.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ikiwiki\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-03-07 01:22-0500\n"
+"POT-Creation-Date: 2007-03-07 02:29-0500\n"
 "PO-Revision-Date: 2007-02-17 12:07+0100\n"
 "Last-Translator: Miroslav Kure <kurem@debian.cz>\n"
 "Language-Team: Czech <debian-l10n-czech@lists.debian.org>\n"
@@ -339,12 +339,7 @@ msgstr "šabloně chybí parametr id"
 msgid "sparkline bad width value"
 msgstr "linkmapu se nepodařilo spustit dot"
 
-#: ../IkiWiki/Plugin/sparkline.pm:112
-#, fuzzy
-msgid "sparkline previewing not implemented"
-msgstr "getctime není implementováno"
-
-#: ../IkiWiki/Plugin/sparkline.pm:148
+#: ../IkiWiki/Plugin/sparkline.pm:144
 #, fuzzy
 msgid "sparkline failed to run php"
 msgstr "linkmapu se nepodařilo spustit dot"
@@ -503,5 +498,9 @@ msgstr "Chyba"
 msgid "%s preprocessing loop detected on %s at depth %i"
 msgstr "Byla rozpoznána smyčka direktivy %s na %s v hloubce %i"
 
+#, fuzzy
+#~ msgid "sparkline previewing not implemented"
+#~ msgstr "getctime není implementováno"
+
 #~ msgid "in late morning %A"
 #~ msgstr "%A pozdě dopoledne"
index 14ebddccb44b734a76b91a1bf5ced56c622fdd23..73cd380dbac22f941f98ba053b206ecf7f8f6e22 100644 (file)
--- a/po/es.po
+++ b/po/es.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: es\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-03-07 01:22-0500\n"
+"POT-Creation-Date: 2007-03-07 02:29-0500\n"
 "PO-Revision-Date: 2007-02-12 10:31+0100\n"
 "Last-Translator: Víctor Moral <victor@taquiones.net>\n"
 "Language-Team: spanish <es@li.org>\n"
@@ -345,12 +345,7 @@ msgstr "A el complemento template le falta el parámetro id"
 msgid "sparkline bad width value"
 msgstr "El complemento linkmap no ha podido ejecutar el programa dot"
 
-#: ../IkiWiki/Plugin/sparkline.pm:112
-#, fuzzy
-msgid "sparkline previewing not implemented"
-msgstr "la funcionalidad getctime no está incluida"
-
-#: ../IkiWiki/Plugin/sparkline.pm:148
+#: ../IkiWiki/Plugin/sparkline.pm:144
 #, fuzzy
 msgid "sparkline failed to run php"
 msgstr "El complemento linkmap no ha podido ejecutar el programa dot"
@@ -516,3 +511,7 @@ msgid "%s preprocessing loop detected on %s at depth %i"
 msgstr ""
 "se ha detectado un bucle de preprocesado %s en la página %s en la vuelta "
 "número %i"
+
+#, fuzzy
+#~ msgid "sparkline previewing not implemented"
+#~ msgstr "la funcionalidad getctime no está incluida"
index 5d61d57793962afc73ae2c1d22e8d0341be31720..2a61182ab83a96036e09007df632ed853445a9d9 100644 (file)
--- a/po/fr.po
+++ b/po/fr.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ikiwiki\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-03-07 01:22-0500\n"
+"POT-Creation-Date: 2007-03-07 02:29-0500\n"
 "PO-Revision-Date: 2007-02-13 13:02+0100\n"
 "Last-Translator: Jean-Luc Coulon (f5ibh) <jean-luc.coulon@wanadoo.fr>\n"
 "Language-Team: French <debian-l10n-french@lists.debian.org>\n"
@@ -344,12 +344,7 @@ msgstr "Paramètre d'identification manquant dans le modèle"
 msgid "sparkline bad width value"
 msgstr "Échec de lancement de dot par linkmap"
 
-#: ../IkiWiki/Plugin/sparkline.pm:112
-#, fuzzy
-msgid "sparkline previewing not implemented"
-msgstr "getctime n'est pas implémenté"
-
-#: ../IkiWiki/Plugin/sparkline.pm:148
+#: ../IkiWiki/Plugin/sparkline.pm:144
 #, fuzzy
 msgid "sparkline failed to run php"
 msgstr "Échec de lancement de dot par linkmap"
@@ -514,3 +509,7 @@ msgid "%s preprocessing loop detected on %s at depth %i"
 msgstr ""
 "%s une boucle a été détectée dans le prétraitement de %s, à la profondeur de "
 "%i"
+
+#, fuzzy
+#~ msgid "sparkline previewing not implemented"
+#~ msgstr "getctime n'est pas implémenté"
index bcec055fa8b5e98e786a6bdb6db26b1abac07702..53914d1b1e82b6909c5a282958a1429c393db0a6 100644 (file)
--- a/po/gu.po
+++ b/po/gu.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ikiwiki-gu\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-03-07 01:22-0500\n"
+"POT-Creation-Date: 2007-03-07 02:29-0500\n"
 "PO-Revision-Date: 2007-01-11 16:05+0530\n"
 "Last-Translator: Kartik Mistry <kartik.mistry@gmail.com>\n"
 "Language-Team: Gujarati <team@utkarsh.org>\n"
@@ -337,12 +337,7 @@ msgstr "ટેમ્પલેટને આઇડી વિકલ્પ મળત
 msgid "sparkline bad width value"
 msgstr "લીંકમેપ ડોટ ચલાવવામાં નિષ્ફળ"
 
-#: ../IkiWiki/Plugin/sparkline.pm:112
-#, fuzzy
-msgid "sparkline previewing not implemented"
-msgstr "getctime અમલમાં મૂકાયેલ નથી"
-
-#: ../IkiWiki/Plugin/sparkline.pm:148
+#: ../IkiWiki/Plugin/sparkline.pm:144
 #, fuzzy
 msgid "sparkline failed to run php"
 msgstr "લીંકમેપ ડોટ ચલાવવામાં નિષ્ફળ"
@@ -499,3 +494,7 @@ msgstr "ક્ષતિ"
 #, perl-format
 msgid "%s preprocessing loop detected on %s at depth %i"
 msgstr "%s પર શોધાયેલ લુપ  %s પર ચલાવે છે %i ઉંડાણ પર"
+
+#, fuzzy
+#~ msgid "sparkline previewing not implemented"
+#~ msgstr "getctime અમલમાં મૂકાયેલ નથી"
index 6fb6a901aaeb7904add4b7857f42a06d5ee6624a..f53c6bd4ecb5efca3fe5f236fafb3df9bbeecd73 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-03-07 01:22-0500\n"
+"POT-Creation-Date: 2007-03-07 02:29-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -334,11 +334,7 @@ msgstr ""
 msgid "sparkline bad width value"
 msgstr ""
 
-#: ../IkiWiki/Plugin/sparkline.pm:112
-msgid "sparkline previewing not implemented"
-msgstr ""
-
-#: ../IkiWiki/Plugin/sparkline.pm:148
+#: ../IkiWiki/Plugin/sparkline.pm:144
 msgid "sparkline failed to run php"
 msgstr ""
 
index d22f5ee1c4f973cd043abca8e39216f00731db25..ffbb4b58675f8cb5c62a791286746861a82ca3a1 100644 (file)
--- a/po/pl.po
+++ b/po/pl.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ikiwiki 1.37\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-03-07 01:22-0500\n"
+"POT-Creation-Date: 2007-03-07 02:29-0500\n"
 "PO-Revision-Date: 2007-01-05 16:33+100\n"
 "Last-Translator: Paweł Tęcza <ptecza@net.icm.edu.pl>\n"
 "Language-Team: Debian L10n Polish <debian-l10n-polish@lists.debian.org>\n"
@@ -347,12 +347,7 @@ msgstr "brakujący parametr id we wtyczce template"
 msgid "sparkline bad width value"
 msgstr "awaria wtyczki linkmap"
 
-#: ../IkiWiki/Plugin/sparkline.pm:112
-#, fuzzy
-msgid "sparkline previewing not implemented"
-msgstr "niedostępna funkcja getctime"
-
-#: ../IkiWiki/Plugin/sparkline.pm:148
+#: ../IkiWiki/Plugin/sparkline.pm:144
 #, fuzzy
 msgid "sparkline failed to run php"
 msgstr "awaria wtyczki linkmap"
@@ -513,3 +508,7 @@ msgstr "Błąd"
 #, perl-format
 msgid "%s preprocessing loop detected on %s at depth %i"
 msgstr "polecenie preprocesora %s wykryte w %s na głębokości %i"
+
+#, fuzzy
+#~ msgid "sparkline previewing not implemented"
+#~ msgstr "niedostępna funkcja getctime"
index e99d17358c623a0b9d1f8e79b81de35d8772789d..8800177f2133c05dfaef6060c2855189a02dbba4 100644 (file)
--- a/po/sv.po
+++ b/po/sv.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ikiwiki\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-03-07 01:22-0500\n"
+"POT-Creation-Date: 2007-03-07 02:29-0500\n"
 "PO-Revision-Date: 2007-01-10 23:47+0100\n"
 "Last-Translator: Daniel Nylander <po@danielnylander.se>\n"
 "Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
@@ -339,12 +339,7 @@ msgstr "mall saknar id-parameter"
 msgid "sparkline bad width value"
 msgstr "linkmap misslyckades att köra dot"
 
-#: ../IkiWiki/Plugin/sparkline.pm:112
-#, fuzzy
-msgid "sparkline previewing not implemented"
-msgstr "getctime inte implementerad"
-
-#: ../IkiWiki/Plugin/sparkline.pm:148
+#: ../IkiWiki/Plugin/sparkline.pm:144
 #, fuzzy
 msgid "sparkline failed to run php"
 msgstr "linkmap misslyckades att köra dot"
@@ -503,3 +498,7 @@ msgstr "Fel"
 #, perl-format
 msgid "%s preprocessing loop detected on %s at depth %i"
 msgstr "%s förbehandlingsslinga detekterades på %s, djup %i"
+
+#, fuzzy
+#~ msgid "sparkline previewing not implemented"
+#~ msgstr "getctime inte implementerad"
index 93527efaf8d620e34689ccad489f8791ab6b5aa0..ea96c3d888b326cd7f2855dae0f32977ba76239c 100644 (file)
--- a/po/vi.po
+++ b/po/vi.po
@@ -6,7 +6,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ikiwiki\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-03-07 01:22-0500\n"
+"POT-Creation-Date: 2007-03-07 02:29-0500\n"
 "PO-Revision-Date: 2007-01-13 15:31+1030\n"
 "Last-Translator: Clytie Siddall <clytie@riverland.net.au>\n"
 "Language-Team: Vietnamese <vi-VN@googlegroups.com>\n"
@@ -340,12 +340,7 @@ msgstr "mẫu thiếu tham số id"
 msgid "sparkline bad width value"
 msgstr "linkmap không chạy dot được"
 
-#: ../IkiWiki/Plugin/sparkline.pm:112
-#, fuzzy
-msgid "sparkline previewing not implemented"
-msgstr "chưa thực hiện getctime"
-
-#: ../IkiWiki/Plugin/sparkline.pm:148
+#: ../IkiWiki/Plugin/sparkline.pm:144
 #, fuzzy
 msgid "sparkline failed to run php"
 msgstr "linkmap không chạy dot được"
@@ -504,3 +499,7 @@ msgstr "Lỗi"
 #, perl-format
 msgid "%s preprocessing loop detected on %s at depth %i"
 msgstr "vòng lặp tiền xử lý %s được phát hiện trên %s ở độ sâu %i"
+
+#, fuzzy
+#~ msgid "sparkline previewing not implemented"
+#~ msgstr "chưa thực hiện getctime"