Skip to main content

General Reverse Publish Formatting

Reverse Publish

Support avatar
Written by Support
Updated over 9 months ago

Text Transformations

In addition to being able to add fields and make them bold or italics the you can also manually apply text transformations

Example syntax of a text transformation

`{{ Event.FieldName | text_transfomation : 'format if needed'}}`

Tagged Text Paragraph and Character Styles

When exporting to a tagged text format you can specify a custom paragraph style by beginning each line in a preset with a paragraph style tag

Example

<ParaStyle:YourStyleName>**{{Event.Name | uppercase}}**

In addition to paragraph styles you can also create a character style and apply it to a field as shown below

Example

<ParaStyle:YourStyleName><CharStyle:YourCharStyleHere>{{Event.StartDate | datef: 'dddd, mmmm d '}}<CharStyle:>


Common Formatting Options

Uppercase

{{Event.Name | uppercase}}

Lowercase

{{Event.Name | lowercase}}

If Empty

If Empty allows you to choose an alternative field if the first one is empty. The example below displays the description if the custom field is empty:

{{Event.CustomField | ifEmpty: Event.Description }}

Currency

{{Event.LowPrice | currency }} or {{Event.LowPrice | currency : '£'}}

Note that the currency formatting can only be applied to the {{Event.LowPrice}} and {{Event.HighPrice}} fields

Conditional Formatting

General conditional syntax:

{{Conditional Statement ? 'if true' : 'if false' }}

Only show the state if the state is different from where your publication is:

{{Event.State == 'NY' ? '' : Event.State}}

Include comma if there is a venue name:

{{Event.VenueName ? ',' : '' }}

Only add formatting when a field has a value (example shows bold added if there is a price):

{{Event.Price ? '*' + Event.Price + '*': ''}}

Two field conditional statement (both true):

{{Event.StartTime && Event.Price ? Event.StartTime + ', ' + Event.Price + '.' :''}}

Two field conditional statement (one true, one false):

{{Event.StartTime && !Event.Price ? Event.StartTime + '.' :''}}

Conditional statement applied if any of the given fields are true:

{{Event.ContactName || Event.ContactPhone || Event.ContactOrganization || Event.ContactEmail ? '. ' : '' }}

Has Label

{{Event.Labels | hasLabel : 'yourLabelName' }}
{{Event.Labels | hasLabel : 'yourLabelName' : 'Show this when present'}}
{{(Event.Labels | hasLabel : 'yourLabelName') ? 'Show this when present' : 'Show this when not'}}

The Has Label transformation can only be applied to the {{Event.Labels}} fields. The third example above shows the use of this transformation with a conditional statement.

Strip Character

{{Event.Description | strip: 'character or string'}}

Example stripping out all asterisks from the event name.

{{Event.Name | strip: '*'}}

Example of a strip and replace, replacing asterisks with a hash.

{{Event.Name | strip: '*' : '#'}}

Example stripping hard returns from a description (and showing multiple 'strips' applied to the same field)

{{Event.Description|strip: '\r'|strip: '\n' }}

Example showing price without any ".00" and removing the spaces next to the hyphen for price ranges. Note: To strip a period (which is a special character) you need to include two backslashes in front of it.

{{Event.Price ? ' | ' + (Event.Price | strip: '\\.00') : '' | strip: ' - ' : '-' }}

Phone Formatting

{{Event.ContactPhone | phone }}

The phone format does a best guess formatting of phone numbers. If the phone number has 10 or 11 digits with the first being a 1 it will be formatted as 777-777-7777.

7 digit phone numbers will be formatted as 777-7777, and any other number of digits in the phone number will be left as is.

{{Event.ContactPhone | phone :'()'}}

The above phone format will format 10 or 11 digit numbers as (777) 777-7777.

Url Shorten

{{Event.DetailUrl | urlShorten }}

This will shorten the URL to remove everything after the top level domain aka ".com"

Limit Field length

{{Event.Description|limitTo:30}}

Example limiting the number of characters from the description that will be displayed to 30 characters.

{{Event.Description|limitPeriod:200}}

Limits the number of characters from the description that will be displayed to 200 characters and if possible will end at the closest period, question mark or exclamation point prior to the limit.


Date & Time Formats

{{Event.Start | datef : 'shortDate'}}

or

{{Event.End | datef : 'm/d/yy'}}

or

{{Event.Occurrences | datef : 'dddd mmmm d' : true}}

Adding the date format to the occurrences field will format each of the occurrences in the timespan selected. Adding a second parameter of true as in the example above will collapse the series and only format the first and last occurrences with a dash between them if the range runs every day.

or

{{Event.Occurrences2 | datef : 'dddd mmmm d hh tt' : true : '- hh tt'}}

Event.Occurrences2 is similar to Event.Occurrences but also includes an end time and allows a third parameter to format the end date/time.

{{(Event.Occurrences2 | sameTime) ? (Event.Start|datef:'h:MM ttt') : ('Times vary') }}

Using the 'sameTime' parameter with multiple event occurrences will return a time when the times are exactly the same for all occurrences, and will return a message ("Times vary" in the example) when they are not.

Format

Description

d

Day of the month as digits; no leading zero for single-digit days.

dd

Day of the month as digits; leading zero for single-digit days.

ddd

Day of the week as a three-letter abbreviation.

dddd

Day of the week as its full name.

m

Month as digits; no leading zero for single-digit months.

mm

Month as digits; leading zero for single-digit months.

mmm

Month as a three-letter abbreviation.

mmmm

Month as its full name.

mmmmm

Month as an AP style- Jan. Feb. March April May June July Aug. Sept. Oct. Nov. Dec.

yy

Year as last two digits; leading zero for years less than 10.

yyyy

Year represented by four digits.

h

Hours; no leading zero for single-digit hours (12-hour clock).

hh

Hours; leading zero for single-digit hours (12-hour clock).

H

Hours; no leading zero for single-digit hours (24-hour clock).

HH

Hours; leading zero for single-digit hours (24-hour clock).

M

Minutes; no leading zero for single-digit minutes.

  • Uppercase M unlike CF timeFormat's m to avoid conflict with months.

MM

Minutes; leading zero for single-digit minutes.

  • Uppercase MM unlike CF timeFormat's mm to avoid conflict with months.

s

Seconds; no leading zero for single-digit seconds.

ss

Seconds; leading zero for single-digit seconds.

l or L

Milliseconds. l gives 3 digits. L gives 2 digits.

t

Lowercase, single-character time marker string: a or p.

  • No equivalent in CF.

tt

Lowercase, two-character time marker string: am or pm.

  • No equivalent in CF.

ttt

Lowercase, three-character time marker string: a.m. or p.m.

  • No equivalent in CF.

T

Uppercase, single-character time marker string: A or P.

  • Uppercase T unlike CF's t to allow for user-specified casing.

TT

Uppercase, two-character time marker string: AM or PM.

  • Uppercase TT unlike CF's tt to allow for user-specified casing.

TTT
  • Uppercase, three-character time marker string: A.M. or P.M..
    Uppercase TTT unlike CF's ttt to allow for user-specified casing.

Named Formats and Examples

Name

Equivalent Format

Example

default

ddd mmm dd yyyy HH:MM:ss

Sat Jun 09 2007 17:46:21

shortDate

m/d/yy

6/9/07

mediumDate

mmm d, yyyy

Jun 9, 2007

longDate

mmmm d, yyyy

June 9, 2007

fullDate

dddd, mmmm d, yyyy

Saturday, June 9, 2007

shortTime

h:MM TT

5:46 PM

mediumTime

h:MM:ss TT

5:46:21 PM

longTime

h:MM:ss TT Z

5:46:21 PM EST

isoDate

yyyy-mm-dd

2007-06-09

isoTime

HH:MM:ss

17:46:21

isoDateTime

yyyy-mm-dd'T'HH:MM:ss

2007-06-09T17:46:21


Additional Examples

Below are a few commonly requested examples:

Display the date only when it changes between events

The snippet below will only display the date only once at the beginning for that days events

{{(Event.StartDate !== AllEvents[$index -1].StartDate || $index === 0) ? (Event.StartDate | datef: 'dddd, mmmm d ') : ''}}

Only show the start time minutes if it doesn't start on the hour

{{Event.StartTime ? ((Event.Start|datef:'MM') == '00' ? (Event.Start|datef:'h ttt') : (Event.Start|datef:'h:MM ttt')) : ''}}

Display the category group and make it bold when it changes between events

The snippet below will only work when the category grouping feature is used.

{{(Event.GroupName!== AllEvents[$index -1].GroupName || $index === 0) ? '**' + Event.GroupName + '**' : ''}}

Output line at the top of the export

If you want custom header or text to display once at the top of your file, you can place custom text at the top of the output using the syntax below:

{{$index === 0 ? 'Display This At The Top Once' : '' }}

Output line at the bottom of the export

If you want custom footer or text to display once at the bottom of your file, you can place custom text at the bottom of the output using the syntax below:

{{(AllEvents.length-1)==$index ? 'Display This At The Bottom Once' : '' }}

Conditionally show the minutes as well as AM/PM

Only include minutes when there are minutes and only include am/pm when it changes between the start and end times.

{{Event.EndTime ? (((Event.Start|datef:'ttt') == (Event.End|datef:'ttt')) ? ((Event.Start|datef:'MM') == '00' ? (Event.Start|datef:'h') : (Event.Start|datef:'h:MM')) + '-' + ((Event.End|datef:'MM') == '00' ? (Event.End|datef:'h ttt') : (Event.End|datef:'h:MM ttt')) : ((Event.Start|datef:'MM') == '00' ? (Event.Start|datef:'h ttt') : (Event.Start|datef:'h:MM ttt')) + '-' + ((Event.End|datef:'MM') == '00' ? (Event.End|datef:'h ttt') : (Event.End|datef:'h:MM ttt'))) : (Event.StartTime ? ((Event.Start|datef:'MM') == '00' ? (Event.Start|datef:'h ttt') : (Event.Start|datef:'h:MM ttt')) : '') }}

Select HTML Examples

Below are select examples of HTML inclusions and only apply to HTML exports. Any general HTML can be applied.

Hyperlinking event elements

The snippet below will hyperlink the event title using the event detail URL

<a href="{{Event.DetailUrl}}">{{Event.Name}}</a>

Adding bullets to the event list

Bullets can be added to each event by placing the opening `<li>` and closing `</li>` tags before and after the desired section

<li>
all event fields and formatting
</li>

Modifying font styling example

Any styling can be added following the example below for font size

<a style="font-size:15px;">{{Event.Name}}</a>

Did this answer your question?