Saxotech contains many different ways to format text output in an object file. What does this mean exactly? Well, for example, the other day I noticed a page layout was broken on a client’s newslist page. The editor had added an iframe tag that was getting output in a <%Summary%> variable in a newslistitem.pbo file. The problem of the layout breaking was caused by the Summary variable being set to only display a certain amount of characters, followed by ellipses.
[%{[Summary]>100}<%Summary$w(1,100)%>…%|%<%Summary%>%]
The iframe tag was started, but the word count had reached 100 so the ellipses were added and the iframe was never closed. We needed to remove the html from the summary we added $t to strip out the HTML. I changed my code to
[%{[Summary]>100}<%Summary$t$w(1,100)%>…%|%<%Summary$t%>%]
and the iframe was removed (there was no need for the iframe to be displayed in this case).
Below are some before and after examples that will demonstrate formatting options.
Saxotech provides a list of formatting options in their wiki, that I have attached below.
This screencap has been copied from Saxo docs, and changes might not be reflected in this post. For the most accurate information go to https://docs.saxotech.com/display/Onl/Object+script
$a is used to generate HTML links of URL’s and email addresses found in non-HTML text
Text added to the story paragraph in the EI accessible by the <%Body%> tag
http://tamberra.wpengine.com
kara@tamberra.com
Output using <%Body%> variable in newsitemparagraphitem.pbo
www.tamberra.com
http://tamberra.wpengine.com
kara@tamberra.com
Output using <%Body$a%> variable in newsitemparagraphitem.pbo
http://www.tamberra.com
www.tamberra.com
http://tamberra.wpengine.com
kara@tamberra.com
Explanation: You can see that by adding $a to the variable it turns the URL starting with “http://www.” into an active href. It also turns the email address into an active “Mailto:” href. Note that the URL’s that don’t have the full “http://www.” do not turn into active links.
$e is used to replace ASCII characters 161 to 255 with HTML entities
Text Added to the EI
€ ‹ › ‡
Output using <%Body%>
€ ‹ › ‡
Output using <%Body$e%>
€ ‹ › ‡
Explanation: While testing this concept, I had entered the ASCII characters into the EI and verified they weren’t showing as HTML entities (in both the paragraph section of the EI, as well as the HTML version of the paragraph section of the EI) and they weren’t. I wasn’t able to not have the ASCII characters NOT display as HTML entities when viewing the source code. This leads me to wonder if this is still a necessary formatting type.
$j is used to convert text from plain text to URL encoded text
Text Added to the EI
http://tamberra.wpengine.com/ways_to_pass_variables_into_$S_script.html
Output using <%Body%>
http://tamberra.wpengine.com/ways_to_pass_variables_into_$S_script.html
Output using <%Body$j%>
%3Chardreturn%3Ehttp%3A%2F%2Ftamberra.wpengine.com%2Fways_to_pass_variables_into_%24S_script.html%3Cbr%20class%3D%22hardreturn%22%20%2F%3E
Explanation: I used a link to another one of our blog posts, that I knew contained special chars in the link. You can see the difference in the URL’s.
$J is used to convert text from URL encoded to plain text
Text Added to the EI
%3Chardreturn%3Ehttp%3A%2F%2Ftamberra.wpengine.com%2Fways_to_pass_variables_into_%24S_script.html%3Cbr%20class%3D%22hardreturn%22%20%2F%3E
Output using <%Body%>
%3Chardreturn%3Ehttp%3A%2F%2Ftamberra.wpengine.com%2Fways_to_pass_variables_into_%24S_script.html%3Cbr%20class%3D%22hardreturn%22%20%2F%3E
Output using <%Body$J%>
http://tamberra.wpengine.com/ways_to_pass_variables_into_$S_script.html
Explanation: This does the opposite of $j, by decoding URL encoded text.
$h is used to convert the variable from text to HTML
Text Added to the EI
Tamberra.com was built using Saxotech templating system.
Output using <%Body%>
Tamberra.com was built using Saxotech templating system.
Output using <%Body$h%>
Explanation: The output of this is the HTML that is created in the EI when adding data. To view the HTML you can click on the HTML Source Editor found at the bottom of each paragraph while editing an article.
$l is used to convert the variable to lowercase
Text Added to the EI
Tamberra.com was built using Saxotech templating system.
Output using <%Body%>
Tamberra.com was built using Saxotech templating system.
Output using <%Body$l%>
tamberra.com was built using saxotech templating system.
Explanation: This is straightforward. All uppercase letters are now lowercase. We almost never use this type of formatting and rely on CSS for text design.
$n is used to convert the first letter of every word to uppercase
Text Added to the EI
Tamberra.com was built using Saxotech templating system.
Output using <%Body%>
Tamberra.com was built using Saxotech templating system.
Output using <%Body$n%>
tamberra.com Was Built Using Saxotech Templating System.
Explanation: The strange thing about this is that the first letter in the first word of the <%Body$n%> was capitalized initially, and after adding the formatting, is now lowercase. Strange, but again, this is why we manage these things with CSS.
$u is used to convert the variable to uppercase
Text Added to the EI
Tamberra.com was built using Saxotech templating system.
Output using <%Body%>
Tamberra.com was built using Saxotech templating system.
Output using <%Body$u%>
TAMBERRA.COM WAS BUILT USING SAXOTECH TEMPLATING SYSTEM.
Explanation: The strange thing about this is that the first letter in the first word of the <%Body$n%> was capitalized initially, and after adding the formatting, is now lowercase. Strange, but again, this is why we manage these things with CSS.
$p is used to convert the variable to Norwegian proper case.
Text Added to the EI
Tamberra.com was built using Saxotech templating system.
Output using <%Body%>
Tamberra.com was built using Saxotech templating system.
Output using <%Body$p%>
tamberra.com was built using saxotech templating system.
Explanation: We have never needed to use this and aren’t familiar with Norwegian proper case, but all of our text was turned to lowercase.
$b is used to convert the variable to US proper case.
Text Added to the EI
tamberra.com was built using Saxotech templating system.
Output using <%Body%>
tamberra.com was built using Saxotech templating system.
Output using <%Body$b%>
tamberra.com was built using Saxotech templating system.
Explanation: This does not work as expected, which is to have the “t” in tamberra.com be capitalized. It does say in Saxo docs that this format type is no longer supported, so it isn’t a surprise that it doesn’t work (we still had to try).
$t is used to strip out all HTML codes
Text Added to the EI
Tamberra.com was built using Saxotech templating system.
Output using <%Body%>
Tamberra.com was built using Saxotech templating system.
Output using <%Body$t%>
Tamberra.com was built using Saxotech templating system.
Explanation: The text in the EI was added with bold tags around “Saxotech templating System.”. You can see the output shows the text with the bold tags stripped out.
$o converts date to text in FAST InStream search compatible format
From date variable in the newsItemParagraphItem.pbo file
Output using <%StoryDate%>
20131120
Output using <%StoryDate$o%>
2013-11-20
Explanation: This is likely deprecated on systems that use the updated SOLR search features instead of FAST.
$O converts date to text in FAST InStream search compatible format
From date variable in the newsItemParagraphItem.pbo file
Output using <%StoryDate%>
20131120
Output using <%StoryDate$O%>
2013-11-20T00:00:00
Explanation: This is likely deprecated on systems that use the updated SOLR search features instead of FAST.
$C surrounds variable contents in CDATA tags
Text Added to the EI
Tamberra.com contains tips & info about Saxotech.
Output using <%Body%>
Tamberra.com contains tips & info about Saxotech.
Output using <%Body$C%>
<hardreturn>Tamberra.com contains tips & info about Saxotech.<br class=”hardreturn” />
Explanation: I played around with this because I was curious if the CDATA tags showed in the source. I was able to get them to show once, but there was quite a bit of formatting going on in my paragraph HTML. Once I stripped down the paragraph in the EI to contain the one sentence, I don’t see CDATA tags, but the output is what would show in CDATA tags.
$s returns the length of the variable
Text Added to the EI
Tamberra.com contains tips & info about Saxotech.
Output using <%Body%>
Tamberra.com contains tips & info about Saxotech.
Output using <%Body$s%>
90
Explanation: This does exactly what it says and returns the length of the variable.
$D converts ISODateTime into Extended format
From date variable in the newsItemParagraphItem.pbo file
Output using <%StoryDate%>
20131120
Output using <%StoryDate$D%>
Wed, 20 Nov 2013 00:00:00 -0500
Explanation: I used the <%StoryDate%> variable and it was converted to extended format as expected.
$S runs a script, which name is given as the input parameter.
$S is not easily displayed in this format, luckily, we have already written a post on this Ways to Pass Variables into $S Script.
$E performs date calculation on a date using ISO format
From date variable in the newsItemParagraphItem.pbo file
Output using <%StoryDate%>
20131120
Output using <%StoryDate$E(86400)$d(yyyy/mm/dd HH:NN:SS)%>
2013/11/21 00:00:00
Explanation: In the example above, we added a day (86400 seconds), and it returned the date 24 hours from 20131120.
Do you have any formatting examples you would like to share?