Exhibit/Formats

From SIMILE Widgets
Revision as of 01:21, 3 November 2015 by Tullyhansen (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

You can modify the ways values of various value types (date, url, image, etc.) are rendered by adding an ex:formats attribute to any element that has ex:role. The content of an ex:formats attribute looks a bit like a list of CSS rules, e.g.,

 <div ex:formats="date { mode: medium; show: date } number { decimal-digits: 2 } item { title: expression(concat(.label, ': ', .gender)) }" ...

which looks easier to read if you spread it vertically like in CSS

 date {
   mode: medium;
   show: date
 }
 number {
   decimal-digits: 2
 }
 item {
   title: expression(concat(.label, ': ', .gender))
 }

In the example above, there are 3 rules applied to 3 value types: date, number, and item. Each rule consists of zero or more settings. A setting consists of the setting's name, a colon, and then some specifications. Settings are separated by semicolons, much like in CSS.

This now works in lens templates, but not in facets.

Contents

Reference

To specify a URL, wrap it with

 url(...)

To specify an expression, wrap it with

 expression(...)

To specify a string, wrap it with single or double quotation marks.

date

  • time-zone : number in unit of hours.
  • mode : short | medium | long | full; will nullify subsequent template specifications.
  • template : string; will nullify subsequent mode specifications. E.g., 'dd/MM/yyyy h:mm a'
d day of month, no zero padding
dd day of month, padded with zero
EEE day of week, abbreviated
EEEE day of week, full
MM month as number (01 - 12), padded with zero
MMM month name, abbreviated
MMMM month name, full
yy year, abbreviated
yyyy year, full
G era ("AD" or "BC")
HH hour of day (00 - 23), military style, padded with zero
hh hour of AM/PM (01 - 12), padded with zero
h hour of AM/PM (01 - 12), no padding
a "am" or "pm"
A "AM" or "PM"
mm minutes in hour (00 - 59)
ss seconds in minute (00 - 59)
S milliseconds in second (000 - 999)
  • show : date | time | date-time (default is date-time)

number

  • decimal-digits : non-negative integer | -1 or default (to mean no specific limit)

text

  • max-length : positive integer greater than 3 | 0 or none (to mean no specific limit)

image

  • tooltip : expression evaluated against current item | string
  • max-width : positive integer | -1 or 0 (to mean no specific limit) not yet implemented
  • max-height : positive integer | -1 or 0 (to mean no specific limit) not yet implemented

url

  • target : string | none
  • external-icon : url | none not yet implemented

item

  • title : expression | default (for the default rendering using the label property)

currency

  • negative-format : [ red | parentheses | signed | unsigned | no-parentheses | black ]+
  • symbol : string | default (for the locale's default symbol) | none (for no symbol)
  • symbol-placement : first | last | after-sign
  • decimal-digits : non-negative integer | -1 or default (to mean no specific limit)

list

  • separator : string
  • last-separator : string
  • pair-separator : string

The defaults for these settings are dependent on the locale. For English, separator is ", ", last-separator is ", and ", and pair-separator is " and ".

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox