support previewing of sparklines: embed in data uris for preview

master
joey 2007-03-07 07:41:07 +00:00
parent 7ae2deacdf
commit 4cbb1095d6
11 changed files with 62 additions and 70 deletions

View 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,8 +144,17 @@ sub preprocess (@) { #{{{
return "[[".gettext("sparkline failed to run php")."]]";
}
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="'.
IkiWiki::abs2rel($fn, IkiWiki::dirname($params{destpage})).

View 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

View File

@ -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” не е реализирана"

View File

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

View File

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

View File

@ -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é"

View File

@ -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 અમલમાં મૂકાયેલ નથી"

View 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 ""

View File

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

View File

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

View File

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