When updating your RSS feed variables in the HTML, you can choose how to format the content including any of the following commands in the variable.
Possible Commands
Command
|
Type
|
Possible Parameters
|
truncate
| Integer
| Any number
|
ellipsis
| Boolean
| true or false
|
selector
| String
| ‘h1’, ‘h1.ClassName’, ‘h1#Id’
|
encode
| Boolean
| true or false
|
parseFrom
| String
| Any string within the content to be parsed.
|
parseUntil
| String
| Any string within the content to be parsed.
|
parseAs
| String
| ‘integer’, ‘datetime’
|
format
| String
| ‘ddd mm yyyy’ or ‘N4’
|
default
| String
| ‘Invalid date’
|
capitalise
| String
| ‘uppercase’, ‘lowercase’, ‘words’
|
NB: only parameters for commands of type string are to be specified with single quotes.
Convention
Single: {{ [key] | [command]:[Parameter] }}
Combo: {{ [key] | [command]:[Parameter], [command]:[Parameter] }}
Truncate & Ellipsis
When “truncate” is used, the string content returned will only contain the number of characters specified. If the number specified is greater than the number of characters in the string, the entire string is returned. To add ellipsis onto the end of the string set ‘ellipsis’ to ‘true’. See possible examples below;
EmailDigest:Title = “A string”
- {{EmailDigest:Title | truncate:4 }}
- {{ EmailDigest:Title | truncate:4, ellipsis:true }}
“1” returns “A st”
“2” returns “A st…”
Selector
When “selector” is used, the string between the tag specified is returned. If the tag specified does not exist, the initial string will be returned in its entirety. Possible combinations are “encode”, “parseFrom”, “parseUntil” & “capitalise”. See possible examples below;
EmailDigest:Description = “A description <h1>with</h1> tags, <p id=’CssId’>some content</p> <b class=’CssClass’> some more content</b>”
- {{EmailDigest: Description | selector:’h1’ }}
- {{ EmailDigest: Description | selector:’p.CssClass’ }}
- {{ EmailDigest: Description | selector:’p#CssId’ }}
“1” returns “with”
“2” returns “some content”
“3” returns “some more content”
ParseFrom
When “parseFrom” is used, everything after the character or string value specified is returned. If the character or string specified does not exist, the initial string will be returned in its entirety. Possible combinations are “encode”, “parseUntil” & “capitalise”. See possible examples below;
EmailDigest:Description = “The launch of new GCSE and A Level subjects should be delayed until Welsh language textbooks are available.”
- {{EmailDigest: Description | parseFrom:’launch’ }}
Returns “of new GCSE and A Level subjects should be delayed until Welsh language textbooks are available”
ParseUntil
When “parseUntil” is used, everything before the character or string value specified is returned. If the character or string specified does not exist, the initial string will be returned in its entirety. Possible combinations are “encode”, “parseFrom” & “capitalise”. See possible examples below;
EmailDigest:Description = “The launch of new GCSE and A Level subjects should be delayed until Welsh language textbooks are available.”
- {{EmailDigest: Description | parseUntil: ‘textbooks’ }}
Returns “The launch of new GCSE and A Level subjects should be delayed until Welsh language”
ParseAs
When “parseAs” is used, the string returned will take the format that was specified based on the data type. Only 2 data types are current supported by this command;
If an error occurs during conversion, the original value is returned. Alternatively, if a default value is specified using the “default” command, this will be returned instead.
EmailDigest:PubDate = “25/09/2017”
EmailDigest:BadPubDate = “250/09/2017”
EmailDigest:ClickCount = “200”
EmailDigest:BadClickCount = “2oo”
- {{EmailDigest: PubDate | parseAs:'DateTime' }}
- {{EmailDigest: PubDate | parseAs:'DateTime', format:'ddd MM yyyy' }}
- {{EmailDigest: BadPubDate | parseAs:'DateTime', format:'ddd MM yyyy', default:'Invalid date' }}
- {{EmailDigest: BadPubDate | parseAs:'DateTime', format:'ddd MM yyyy' }}
- {{EmailDigest: ClickCount | parseAs:’Integer’, format:'d6' }}
- {{EmailDigest: BadClickCount | parseAs:’Integer’, format:'c6', default:'Invalid integer }}
“1” returns “25-09-2017 00:00:00” (default format)
“2” returns “Mon 09 2017”
“3” returns “[Invalid Date]”
“4” returns “250/09/2017”
“5” returns “000200”
“6” returns “[Invalid integer]”
See link below for integer and datetime specifiers;
http://www.independent-software.com/string-formatting-in-c-cheat-sheet/