Difference between revisions of "Number Inline Expressions"
(12 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | It is possible to convert numbers (indicated in milliseconds) with inline expressions into date, time, or duration values. The expressions are similar to the [[Live Inline Expressions]] and look like this: <code>{num:{NUMBER}:{TYPE}:{FORMAT}}</code>. It is also possible to add colored values with the expression syntax <code>{txt:{COLOR}:num:{NUMBER}:{TYPE}:{FORMAT}}</code>. Please see [[Colors]] for possible color values. This feature is available since version '''0.1.91'''. Since version '''0.1.160''', a number can also be basically formatted by using the syntax <code>{num:{NUMBER}:format}</code> | + | It is possible to convert numbers (indicated in milliseconds) with inline expressions into date, time, or duration values. The expressions are similar to the [[Live Inline Expressions]] and look like this: <code>{num:{NUMBER}:{TYPE}:{FORMAT}}</code>. It is also possible to add colored values with the expression syntax <code>{txt:{COLOR}:num:{NUMBER}:{TYPE}:{FORMAT}}</code>. Please see [[Colors]] for possible color values. This feature is available since version '''0.1.91'''. Since version '''0.1.160''', a number can also be basically formatted by using the syntax <code>{num:{NUMBER}:format}</code> or <code>{num:{NUMBER}:format:{FORMAT}}</code>. In the first case, the number format is taken from the dictionary. Please see [[#Basic Number Format Expressions]] for examples. |
− | + | == Basic Number Format Expressions == | |
− | |||
− | == Basic Number Format == | ||
{| class="wikitable sortable" | {| class="wikitable sortable" | ||
− | |+ | + | |+ Expression syntax of basic number format expressions |
|- | |- | ||
− | ! | + | ! Expression !! Example !! Output !! Since Version |
|- | |- | ||
− | | | + | | |
+ | <code>{num:{NUMBER}:format}</code><br/> | ||
+ | || | ||
<code>{num:123:format}</code><br/> | <code>{num:123:format}</code><br/> | ||
<code>{num:1234:format}</code><br/> | <code>{num:1234:format}</code><br/> | ||
Line 16: | Line 16: | ||
<code>123</code><br/> | <code>123</code><br/> | ||
<code>1,234</code><br/> | <code>1,234</code><br/> | ||
− | <code>12, | + | <code>12,345.12345</code><br/> |
| data-sort-value=160|'''0.1.160''' | | data-sort-value=160|'''0.1.160''' | ||
|- | |- | ||
| | | | ||
+ | <code>{num:{NUMBER}:format:{DECIMAL_DIGITS}}</code><br/> | ||
+ | <code>{num:{NUMBER}:format:{DECIMAL_DIGITS}{DECIMAL_TRIMMING}}</code><br/> | ||
+ | || | ||
<code>{num:123:format:0}</code><br/> | <code>{num:123:format:0}</code><br/> | ||
<code>{num:123:format:1}</code><br/> | <code>{num:123:format:1}</code><br/> | ||
Line 25: | Line 28: | ||
<code>{num:123:format:02}</code><br/> | <code>{num:123:format:02}</code><br/> | ||
<code>{num:123:format:12}</code><br/> | <code>{num:123:format:12}</code><br/> | ||
+ | <code>{num:123:format:21}</code><br/> | ||
<code>{num:1234.1:format:0}</code><br/> | <code>{num:1234.1:format:0}</code><br/> | ||
<code>{num:1234.1:format:1}</code><br/> | <code>{num:1234.1:format:1}</code><br/> | ||
− | <code>{num:1234.1:format: | + | <code>{num:1234.1:format:3}</code><br/> |
− | <code>{num:1234.1:format: | + | <code>{num:1234.1:format:03}</code><br/> |
− | <code>{num:1234.1:format: | + | <code>{num:1234.1:format:23}</code><br/> |
+ | <code>{num:1234.1:format:32}</code><br/> | ||
<code>{num:12345.12345:format:0}</code><br/> | <code>{num:12345.12345:format:0}</code><br/> | ||
Line 36: | Line 41: | ||
<code>{num:12345.12345:format:4}</code><br/> | <code>{num:12345.12345:format:4}</code><br/> | ||
<code>{num:12345.12345:format:04}</code><br/> | <code>{num:12345.12345:format:04}</code><br/> | ||
+ | <code>{num:12345.12345:format:24}</code><br/> | ||
<code>{num:12345.12345:format:42}</code><br/> | <code>{num:12345.12345:format:42}</code><br/> | ||
|| | || | ||
Line 43: | Line 49: | ||
<code>123</code><br/> | <code>123</code><br/> | ||
<code>123.0</code><br/> | <code>123.0</code><br/> | ||
+ | <code>123.00</code><br/> | ||
− | <code>1, | + | <code>1,234</code><br/> |
− | <code>1, | + | <code>1,234.1</code><br/> |
− | <code>1, | + | <code>1,234.100</code><br/> |
− | <code>1, | + | <code>1,234.1</code><br/> |
− | <code>1, | + | <code>1,234.10</code><br/> |
+ | <code>1,234.100</code><br/> | ||
<code>12,345</code><br/> | <code>12,345</code><br/> | ||
<code>12,345.1</code><br/> | <code>12,345.1</code><br/> | ||
− | <code>12,345. | + | <code>12,345.1234</code><br/> |
− | <code>12,345. | + | <code>12,345.1234</code><br/> |
+ | <code>12,345.1234</code><br/> | ||
<code>12,345.1200</code><br/> | <code>12,345.1200</code><br/> | ||
+ | | data-sort-value=160|'''0.1.160''' | ||
+ | |- | ||
+ | | | ||
+ | <code>{num:{NUMBER}:format:{THOUSANDS_SEPARATOR}}</code><br/> | ||
+ | <code>{num:{NUMBER}:format:{THOUSANDS_SEPARATOR}{DECIMAL_SEPARATOR}}</code><br/> | ||
+ | <code>{num:{NUMBER}:format:{THOUSANDS_SEPARATOR}{DECIMAL_SEPARATOR}{DECIMAL_DIGITS}}</code><br/> | ||
+ | <code>{num:{NUMBER}:format:{THOUSANDS_SEPARATOR}{DECIMAL_SEPARATOR}{DECIMAL_DIGITS}{DECIMAL_TRIMMING}}</code><br/> | ||
+ | || | ||
+ | <code>{num:12345.12345:format:.,}</code><br/> | ||
+ | <code>{num:12345.12345:format: .}</code><br/> | ||
+ | <code>{num:12345.12345:format: ,}</code><br/> | ||
+ | <code>{num:12345.12345:format:.,0}</code><br/> | ||
+ | <code>{num:12345.12345:format: .1}</code><br/> | ||
+ | <code>{num:12345.12345:format: ,24}</code><br/> | ||
+ | || | ||
+ | <code>12.345,12345</code><br/> | ||
+ | <code>12 345.12345</code><br/> | ||
+ | <code>12 345,12345</code><br/> | ||
+ | <code>12.345</code><br/> | ||
+ | <code>12 345.1</code><br/> | ||
+ | <code>12 345,1234</code><br/> | ||
| data-sort-value=160|'''0.1.160''' | | data-sort-value=160|'''0.1.160''' | ||
|} | |} | ||
Line 91: | Line 121: | ||
"title": "Colored Duration", | "title": "Colored Duration", | ||
"action": "info:{txt:msx-blue:num:5640000:duration:text:dhms}" | "action": "info:{txt:msx-blue:num:5640000:duration:text:dhms}" | ||
+ | }, { | ||
+ | "badge": "Formatter", | ||
+ | "title": "Specific Date/Time", | ||
+ | "titleFooter": "0.1.160+", | ||
+ | "action": "info:{num:1548335764000:formatter:day_full}" | ||
+ | }, { | ||
+ | "badge": "Formatter", | ||
+ | "title": "Current Date/Time", | ||
+ | "titleFooter": "0.1.160+", | ||
+ | "action": "info:{num:now:formatter:day_full}" | ||
+ | }, { | ||
+ | "badge": "Formatter", | ||
+ | "title": "Colored Date/Time", | ||
+ | "titleFooter": "0.1.160+", | ||
+ | "action": "info:{txt:msx-blue:num:1548335764000:formatter:day_full}" | ||
+ | }, { | ||
+ | "badge": "Format", | ||
+ | "title": "Default Number", | ||
+ | "titleFooter": "0.1.160+", | ||
+ | "action": "info:{num:12345.12345:format}" | ||
+ | }, { | ||
+ | "badge": "Format", | ||
+ | "title": "Rounded Number", | ||
+ | "titleFooter": "0.1.160+", | ||
+ | "action": "info:{num:12345.12345:format:0}" | ||
+ | }, { | ||
+ | "badge": "Format", | ||
+ | "title": "Colored Number", | ||
+ | "titleFooter": "0.1.160+", | ||
+ | "action": "info:{txt:msx-blue:num:12345.12345:format: ,24}" | ||
}] | }] | ||
} | } |
Latest revision as of 10:25, 1 November 2024
It is possible to convert numbers (indicated in milliseconds) with inline expressions into date, time, or duration values. The expressions are similar to the Live Inline Expressions and look like this: {num:{NUMBER}:{TYPE}:{FORMAT}}
. It is also possible to add colored values with the expression syntax {txt:{COLOR}:num:{NUMBER}:{TYPE}:{FORMAT}}
. Please see Colors for possible color values. This feature is available since version 0.1.91. Since version 0.1.160, a number can also be basically formatted by using the syntax {num:{NUMBER}:format}
or {num:{NUMBER}:format:{FORMAT}}
. In the first case, the number format is taken from the dictionary. Please see #Basic Number Format Expressions for examples.
Basic Number Format Expressions[edit]
Expression | Example | Output | Since Version |
---|---|---|---|
|
|
|
0.1.160 |
|
|
|
0.1.160 |
|
|
|
0.1.160 |
Example[edit]
Screenshot[edit]
Code[edit]
{
"type": "pages",
"headline": "Number Inline Expressions",
"template": {
"type": "separate",
"layout": "0,0,2,3",
"icon": "msx-white-soft:info",
"color": "msx-glass"
},
"items": [{
"title": "Specific Date/Time",
"action": "info:{num:1548335764000:date:DD, MM d, yyyy}, {num:1548335764000:time:h:mm/ampm}"
}, {
"title": "Current Date/Time",
"action": "info:{num:now:date:DD, MM d, yyyy}, {num:now:time:h:mm/ampm}"
}, {
"title": "Colored Date/Time",
"action": "info:{txt:msx-blue:num:1548335764000:date:DD, MM d, yyyy}, {txt:msx-blue:num:1548335764000:time:h:mm/ampm}"
}, {
"title": "Duration Time",
"action": "info:{num:5640000:duration:time:hh:mm:ss}"
}, {
"title": "Duration Text",
"action": "info:{num:5640000:duration:text:dhms}"
}, {
"title": "Colored Duration",
"action": "info:{txt:msx-blue:num:5640000:duration:text:dhms}"
}, {
"badge": "Formatter",
"title": "Specific Date/Time",
"titleFooter": "0.1.160+",
"action": "info:{num:1548335764000:formatter:day_full}"
}, {
"badge": "Formatter",
"title": "Current Date/Time",
"titleFooter": "0.1.160+",
"action": "info:{num:now:formatter:day_full}"
}, {
"badge": "Formatter",
"title": "Colored Date/Time",
"titleFooter": "0.1.160+",
"action": "info:{txt:msx-blue:num:1548335764000:formatter:day_full}"
}, {
"badge": "Format",
"title": "Default Number",
"titleFooter": "0.1.160+",
"action": "info:{num:12345.12345:format}"
}, {
"badge": "Format",
"title": "Rounded Number",
"titleFooter": "0.1.160+",
"action": "info:{num:12345.12345:format:0}"
}, {
"badge": "Format",
"title": "Colored Number",
"titleFooter": "0.1.160+",
"action": "info:{txt:msx-blue:num:12345.12345:format: ,24}"
}]
}