Index: openacs-4/packages/acs-templating/www/doc/noquote.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/noquote.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-templating/www/doc/noquote.adp 27 Oct 2014 16:40:14 -0000 1.2 +++ openacs-4/packages/acs-templating/www/doc/noquote.adp 23 Jun 2015 10:52:55 -0000 1.3 @@ -1,8 +1,7 @@ {/doc/acs-templating {Templating}} {HTMLQuoting as Part of the Templating System - Requirements} -HTMLQuoting as Part of the Templating System - -Requirements +HTMLQuoting as Part of the Templating System - Requirements @@ -135,21 +134,33 @@ Strangely, this otherwise sad fact allows us to deploy a very radical but much more robust solution to the problem.

-

-Quote Always, Except -When Told Not to.

At the time when we came to realize how serious the quoting +

+ +

Quote Always, Except +When Told Not to.

+

At the time when we came to realize how serious the quoting deficiencies of ACS 4.0 were, we were about two weeks away from the release of a project for the German Bank. There was simply no time to hunt all the places where a variable needs to be quoted and -implement one of the above quoting tricks.

While examining the ADPs, we noticed that most substituted -variable fall into one of three categories:

    +implement one of the above quoting tricks.

    +

    While examining the ADPs, we noticed that most substituted +variable fall into one of three categories:

    + +
    +
    1. Those that need to be quoted -- names and descriptions of -objects, and in general stuff that ultimately comes from the -user.

    2. Those for which it doesn't make a difference whether they are -quoted or not -- e.g. all the database IDs.

    3. Those that must not be quoted -- e.g. exported form vars stored -to a variable.

    4. Finally we also remembered the fact that almost none of the +objects, and in general stuff that ultimately comes from the user.

    5. +
    6. Those for which it doesn't make a difference whether they are +quoted or not -- e.g. all the database IDs.

    7. +
    8. Those that must not be quoted -- e.g. exported form vars stored +to a variable.

    9. +
    10. Finally we also remembered the fact that almost none of the variables are quoted in the current source base.

    11. -

    Our reasoning went further: if it is a fact that most variables +

+ +

Our reasoning went further: if it is a fact that most variables are not quoted, and if the majority of variables either require quoting or are not harmed by it, then we are in a much better position if we make the templating system quote all variables by default! That way @@ -158,7 +169,9 @@ need to be marked as noquote to function correctly. But even those should not be a problem, because HTML code that ends up quoted in the page is immediately visible, and all you need to do to fix it -is add the marker.

We decided to test whether the idea will work by attempting to +is add the marker.

+ +

We decided to test whether the idea will work by attempting to convert our system to work that way. I spent several minutes making the change to the templating system. Then we went through all the ADPs and replaced the instances of \@foo\@ where foo contained HTML