%ICON{}%
searches the icon first in the site topic, then in the system topic (that way it is possible to overload system images)
Variable | Description | Type | Size | Alias | |
---|---|---|---|---|---|
%ICON{airplane}% |
Airplane | gif | 16x16 | ||
%ICON{award}% |
Award | gif | 16x16 | ||
%ICON{barcode}% |
Barcode | gif | 16x16 | ||
%ICON{jpg}% |
JPEG | gif | 16x16 | jfif, jpe, jpeg | |
%ICON{zip}% |
Compressed Zip archive | gif | 16x16 | arc, arj, b64, bhx, cab, hqx, lzh, mim, tar, taz, tgz, tz, z |
%SYSTEMWEB%.TWikiDocGraphics
. This setting is extended to support multiple topic names. Topics may overload icons defined in previous topic(s). Default new setting is as follows:
* Set ICONTOPIC = %SYSTEMWEB%.TWikiDocGraphics, %USERSWEB%.SiteDocGraphicsTWiki does not ship with a Main.SiteDocGraphics topic. The TWiki06x01.TWikiDocGraphics documents how to create a topic in the Main web. A conditional link is provided to create the SiteDocGraphics topic based on a TWikiDocGraphicsTemplate topic in case it does not exist. The ICON variable handles a new
format=""
parameter. It understands these variables (with example): default=""
parameter to define a default icon name in case the icon is not found. This is optional; if not specified, the icon is assumed to exist in the default location, which is the second entry in the ICONTOPIC (if it exists, else the first), e.g. Main.SiteDocGraphics.
A list of icons or icon names is shown with special token %ICON{list:...}%
:
Format: | List all icons, including aliases: |
List unique icons only: | Example: |
---|---|---|---|
Name list, comma-space delimited: |
%ICON{list:all-names}% |
%ICON{list:unique-names}% |
addon, air, airplane, ... |
Icon list: | %ICON{list:all-icons}% |
%ICON{list:unique-icons}% |
... |
Info list, icons with usage info: |
%ICON{list:all-info}% |
%ICON{list:unique-info}% |
... |
Detailed list, table format: |
%ICON{list:all-table}% |
%ICON{list:unique-table}% |
(similar to table format above) |
rss-feed
)
gif
)
TWiki
)
TWikiDocGraphics
)
36
)
14
)
RSS feed
)
| %ICON{...
%ICON{qwerty}%
creates an img tag pointing to qwerty.gif
in Main.SiteDocGraphics, description "Qwerty", size 16x16.
# hash
hash key, name, web, topic, file type, width, height, description
from name => to hash key
twiki/working/work_areas/VarICON/icon_cache.txt
Example:
# Cached icon data; do not edit. See TWiki.TWikiDocGraphics _default: _default, Main, SiteDocGraphics, gif, 16, 16, Default abs: wav, TWiki, TWikiDocGraphics, gif, 16, 16, Waveform sound file addon: addon, TWiki, TWikiDocGraphics, gif, 16, 16, Add-on air: air, TWiki, TWikiDocGraphics, gif, 16, 16, Adobe Air airplane: airplane, TWiki, TWikiDocGraphics, gif, 16, 16, Airplane ... xla: xls, TWiki, TWikiDocGraphics, gif, 16, 16, Microsoft Excel Spreadsheet xml: xml, TWiki, TWikiDocGraphics, gif, 16, 16, XML xml-feed: xml-feed, TWiki, TWikiDocGraphics, gif, 36, 14, XML feed xml-small: xml-small, TWiki, TWikiDocGraphics, gif, 16, 16, XML feed xsl: xsl, TWiki, TWikiDocGraphics, gif, 16, 16, XSL (XML style sheet) ying-yang: ying-yang, TWiki, TWikiDocGraphics, gif, 16, 16, Ying Yang aif => abs aiff => abs arj => arc au => abs ... xlt => xla xlw => xla z => arc zip => arc # EOF
Action | Old spec | Using Data::Dumper- based cache |
Using homegrown cache |
---|---|---|---|
Cache rebuild | N/A | 42.0 ms | 21.0 ms |
Read cache (or _filetypes.txt) | 1.8 ms | 19.6 ms | 8.8 ms |
Read from memory (after 1st icon) | 0.34 ms | 0.12 ms | 0.13 ms |
Time to render 10 icons on a page | 5.2 ms | 20.8 ms | 10.1 ms |
use Time::HiRes; my $t1 = Time::HiRes::gettimeofday(); # ...statements under scrutiny here... my $t2 = Time::HiRes::gettimeofday(); my $diff = sprintf( '%.6f', ($t2 - $t1) * 1000 ); print STDERR "HiRes time diff: $diff ms\n";-- Contributors: PeterThoeny - 2009-12-23
format
parameter that expands tokens $name
, $type
, $file
, $path
, $description
, $width
, $height
, $icon
, $iconurl
, $iconurlpath
. For example, tokens for /path/to/somefile.doc
are doc
, gif
, doc.gif
, /p/pub/TWiki/TWikiDocGraphics
, Microsoft Word file
, 16
, 16
, full img tag, https://twiki.org/p/pub/TWiki/TWikiDocGraphics/doc.gif
, /p/pub/TWiki/TWikiDocGraphics/doc.gif
, respectively. Useful to construct a custom format, such as %ICON{ "%URLPARAM{type}%" format="$icon $type is a $description file" }%
that renders as: doc is a Microsoft Word file
.
-- PeterThoeny - 11 Feb 2006
Ping. This came up in Support.AllowICONsInWebPreferences.
-- PeterThoeny - 29 Nov 2006
Good idea. We could easily use the code from the template search path to create other search paths. Whatever we do, it should be consistent, so that users need to learn only one search path scheme. (I assume that this is not a 4.1 action?)
The other idea in this topic is to migrate the Main topic into a site customization web, and have the system configuration in the TWiki web. Let's look through what else is in Main and start moving into that direction.
-- ThomasWeigert - 29 Nov 2006
With yet another thing to search for - how about performance?
It can only be negative. It this worth it? Maybe it would be better to have a static alternative you can define in configure which would not cause further slowdown of an already too slow TWiki.
-- KennethLavrsen - 29 Nov 2006
Yes, it needs to be done with performance in mind, as I noted above. It can be done with intelligent caching (on search path and on icons attached to topics in search path).
Having said that, we can do things step by step: First simply support a TWiki.TWikiDocGraphics and Main.TWikiDocGraphics (with caching), then add a search path later (if inclined).
-- PeterThoeny - 30 Nov 2006
I refined the spec and set a date of commitment to 2009-12-13.
-- PeterThoeny - 2009-12-13
I implemented this on my machine. If no objections I can check this in before the 14 day review period.
-- PeterThoeny - 2009-12-24
This is tracked in TWikibug:Item6380. I changed the topic summary to better reflect the scope of enhancement.
Enhancement is committed into trunk as TWikirev:18259. Unit tests are pending
-- PeterThoeny - 2009-12-31
This is now done.
-- PeterThoeny - 2010-01-19
ChangeProposalForm | |
---|---|
TopicClassification | FeatureRequest |
TopicSummary | TWiki Doc Graphics: Add search path, icon size defined in topics, add cache |
CurrentState | MergedToCore |
CommittedDeveloper | PeterThoeny |
ReasonForDecision | AcceptedBy14DayRule |
DateOfCommitment | 2009-12-13 |
ConcernRaisedBy | |
BugTracking | TWikibug:Item6380 |
OutstandingIssues | |
RelatedTopics | LetICONCalculateImageSize |
InterestedParties | PeterThoeny |
ProposedFor | HelsinkiRelease |
TWikiContributors | PeterThoeny |