Tidy does(n’t) work with the Delivery Server

Some weeks ago I planned to visit a partner in order to provide some information regarding different topics and the partner sent me a mail with a list of topics he wanted to speak about previously. One line of this mail was:

“Question: How can we produce valid XHTML code. (Note: Tidy and Delivery Server will probably not work together)”

As I didn’t exactly know whether this statement was true or not, I asked a colleague with much deeper understanding of the Delivery Server and Tidy and got a document that I would like to share with you. Maybe this is as helpful for you as for me 😉

Tidy configuration file for dynament code

In a Nutshell

  1. Use  XHTML as compliance type setting in the HTML project variant.
  2. Declare all dynaments as new-blocklevel-tags in the tidy configuration file.
  3. Insert all dynaments in your code correctly. No correction provided through tidy.

Why XHTML?

In order to publish the Dynaments from CMS to LiveServer correctly you first have to change in the HTML project variant settings the setting of WCCompliance from HTML to XHTML.  Why we have to do this? Consider the following correct dynament code.

<rde-dm:attribute mode="for-each" attribute="companies" source="user" alias="company">
  <rde-dm:attribute mode="read" attribute="company" source="context"/>
</rde-dm:attribute>

If we declare the rde-dm:attribute  both as a new-blocklevel-tag and as a new-empty-tag in our HTML tidy config file we receive the following output after running tidy:

<rde-dm:attribute mode="for-each"  attribute="companies"  source="user"  alias="company">
<rde-dm:attribute mode="read"  attribute="company"  source="context">

This output is obviously different from the input 😉

If we declare the rde-dm:attribute only as a new-blocklevel-tag we receive the following output (Note: It makes sense to try this declaration cause

<rde-dm:A/>

and

<rde-dm:A></rde-dm:A>

are equivalent.)

<rde-dm:attribute mode="for-each" attribute="companies" source="user" alias="company">
  <rde-dm:attribute mode="read" attribute="company" source="context">
</rde-dm:attribute>
  • The slash of the nested rde-dm:attribute was deleted by tidy.
  • Because of the just shown example we have to use XHTML as the type of compliance.

How to declare the dynaments?

We distinguish between block tags as <rde-dm:attribute>…other tags…</rde-dm:attribute> and empty tags as <rde-dm:cps … />.  But some dynaments as the <rde-dm:attribute> dynament for example, are existing both as block and as empty tags. This is important for our declaration. We consider the following cases:

  • Case 1:  The dynament is existing as an empty tag only -> declare it under new-empty-tags in the tidy configuration file.
  • Case 2: The dynament exists as a block tag only -> declare it under new-blocklevel-tags in the tidy configuration file.
  • Case 3: The dynament exists both as empty and block tag -> declare it under new-blocklevel-tags only.

If you don’t want to distinguish between some block and empty tags, declare all tags as new-blocklevel-tags in the HTML tidy configuration file. Because <rde-dm:A/> and <rde-dm:A>…</rde-dm:A> are equivalent, it still works.

Correction through tidy?

Unfortunately no correction is provided, as the following example shows (suppose the red slashs of the nested rde-dm:attribute dynament and the rde-dm:otherdynament are missing):

If you would use this as the tidy input:

<rde-dm:attribute mode="for-each"  attribute="companies" source="user" alias="company">
 <rde-dm:attribute mode="read"  attribute="company" source="context"/>
<rde-dm:attribute>
<rde-dm:otherdynament />

The output would like this:

<rde-dm:attribute mode="for-each"  attribute="companies"  source="user"  alias="company">
 <rde-dm:attribute mode="read" attribute="company"  source="context">
<rde-dm:attribute>
<rde-dm:otherdynament>
</rde-dm:otherdynament>
</rde-dm:attribute>
</rde-dm:attribute>
</rde-dm:attribute>
  • This is obviously incorrect output
  • No correction provided through HTML tidy.
  • So please: Insert the dynaments correctly.
The following sample code displays the content of a Tidy configuration file, where Tidy can produce valid XHTML code but doesn’t touch/modify the DynaMents which were placed within the template code:
// sample tidy file
quiet: yes
clean: yes
indent: auto
indent-spaces: 2
indent-attributes: yes
wrap-attributes: yes
wrap: 72
markup: yes
output-xhtml: yes
input-xml: no
show-warnings: yes
numeric-entities: yes
quote-marks: yes
quote-nbsp: yes
quote-ampersand: no
break-before-br: no
uppercase-tags: no
uppercase-attributes: no
char-encoding: latin1
force-output:true
new-blocklevel-tags: rde-dm:import,rde-dm:metadata,rde-dm:reporting,rde-rd:import-list,myparam1,myparam2,rde-rd:attribute,rde-dm:repository,rde-dm:if,type,rde-rd:from,rde-rd:query-fulltext,rde-rd:body,rde-dm:target,height,rde-dm:webcomponent,rde-rd:password-expires,rde-rd:created-from,border,rde-dm:query-verity,key,rde-dm:attribute,text,mark-as-read,keywords,align,width,constraints,answer,rde-dm:container,properties,msg,rde-dm:process,rde-dm:webservice,rde-dm:link,rde-dm:livelink,m:dogooglesearch,start,rde-rd:reference,rde-dm:message,safesearch,soap-env:envelope,rde-dm:constraint,rde-rd:group,rde-rd:query-property,comment,filter,rde-rd:language,rde-rd:status,rde-dm:iolet,rde-rd:username,rde-dm:rdb,rde-rd:attachment,rde-rd:user-filter,attribute,constraint,rde-dm:query,rde-rd:validto,rde-rd:import,rde-rd:recipient,rde-rd:last-logon-to,another,rde-dm:include,author,rde-rd:role,rde-rd:validfrom,rde-rd:recipients,parameter,rde-rd:role-param,rde-rd:subject,rde-rd:created-to,name,rde-rd:name,attachments,rde-dm:query-cis,rde-rd:email,rde-dm:param,rde-dm:else,rde-dm:image,rde-rd:reply-to,rde-rd:param,attachment,rde-rd:last-logon-from,rde-dm:user,rde-rd:content,rde-rd:attributes,soap-env:body,rde-rd:soap-message,rde-rd:query-native,maxresults,periodfrom,q,rde-dm:script,attributes,rde-dm:reference,rde-dm:content,parameter1,

new-empty-tags: lr,br,oe,rde-dm:reddot,ie,rde-dm:cps,rde-dm:wrapper-template,restrict,rde-dm:portal,rde-dm:link-param,
// additional setting for Word 2000
word-2000:yes
// setting for kicking out font tags
drop-font-tags: yes
drop-empty-paras: yes

bare: true
doctype: strict
drop-proprietary-attributes: true
logical-emphasis: true
quote-marks: true
indent: false
quote-nbsp: true

Note: As the content of the configuration file comes from a project, you might want to delete some things which don’t appear in your project and possibly add other things.

As some German politicians where  involved in affairs regarding plagiarismI’d like to point out that the information in this article were provided by our German Service team (Notably by Dominic Seiffert). 😉

Advertisements

3 thoughts on “Tidy does(n’t) work with the Delivery Server

  1. Hi there! I am one of the guys working for the OpenText partner Manuel is talking about and I wanted to give a short feedback here (finally). The Tidy config file Manuel sent to us provides an effective solution for getting our XHTML code valid using Tidy in Management Server without messing up the Dynament code. Thank you very much, Manuel – and see you soon!

  2. Hi there! I am one of the guys working for the OpenText partner Manuel is talking about and I wanted to give a short feedback here (finally). The Tidy config file Manuel sent to us provides an effective solution for getting our XHTML code valid using Tidy in Management Server without messing up the Dynament code. Thank you very much, Manuel – and see you soon!
    +1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s