Forge: Scalate
  1. Forge: Scalate
  2. SCALATE-29

XML based template engine - like the XML flavour of JSP? (maybe called SXML?)

    Details

    • Type: Feature Request Feature Request
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Someday
    • Component/s: None
    • Labels:
      None
    • Similar Issues:
      Show 10 results 

      Description

      folks might want to create templates using pure XML, using custom tags (mapping namespaces/elements to function calls) and the $

      {foo} notation for expressions.

      So rather than a custom parser as we have now for SSP, we can have something which parsers the XML and transforms elements based on their namespaces (and looks for ${foo}

      expressions too).

      We could then process things like this...

      <html xmlns:foo="scala:org.acme.MyTags"> 
       ... 
       <foo:cheese blah="123"> 
         ... 
         ${something} 
         ... 
       </foo:cheese> 
      </html> 

      which would translate to the equivalent of this in SSP

      <html>
      <% import org.acme.MyTags._ %> 
       ... 
       <%= cheese(blah="123")  { %> 
         ... 
         ${something} 
         ... 
       <% } %>
      </html> 

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            James Strachan added a comment -

            kinda related - though SCALATE-28 is about adding the XML tag feature to the SSP parser; whereas this issue is about a new SXML template engine

            Show
            James Strachan added a comment - kinda related - though SCALATE-28 is about adding the XML tag feature to the SSP parser; whereas this issue is about a new SXML template engine
            Hide
            Erkki Lindpere added a comment -

            Another thing I think would work well with this is a Scala compiler plug-in (or other type of generator) that generates an XSD from the code (based on some custom annotation). That would give IDE completion support for the custom tags with relatively little work (or am I wrong?). I was thinking of generating TLDs this way in case I wouldn't use Scalate but JSP taglibs.

            Show
            Erkki Lindpere added a comment - Another thing I think would work well with this is a Scala compiler plug-in (or other type of generator) that generates an XSD from the code (based on some custom annotation). That would give IDE completion support for the custom tags with relatively little work (or am I wrong?). I was thinking of generating TLDs this way in case I wouldn't use Scalate but JSP taglibs.
            Hide
            James Strachan added a comment -

            Agreed. Scalate just delegates to the Scala compiler to make the template; so it doesn't necessarily grok the function declarations and so forth - we'd need the Scala compiler plugin to help with that stuff.

            We could just annotate the objects/classes that contain 'tags'; or we could maybe analyse all the functions used in all pages and generate an XSD from that?

            Show
            James Strachan added a comment - Agreed. Scalate just delegates to the Scala compiler to make the template; so it doesn't necessarily grok the function declarations and so forth - we'd need the Scala compiler plugin to help with that stuff. We could just annotate the objects/classes that contain 'tags'; or we could maybe analyse all the functions used in all pages and generate an XSD from that?
            Hide
            Erkki Lindpere added a comment -

            I'd personally prefer annotating objects/classes. I think the annotation would also serve as documentation.
            But of course it's possible that one might want to use classes developed by someone else (and in binary form) who didn't anticipate their usage in Scalate. I don't know enough about the Scala compiler to say if a compiler plug-in would even work in that scenario.

            Show
            Erkki Lindpere added a comment - I'd personally prefer annotating objects/classes. I think the annotation would also serve as documentation. But of course it's possible that one might want to use classes developed by someone else (and in binary form) who didn't anticipate their usage in Scalate. I don't know enough about the Scala compiler to say if a compiler plug-in would even work in that scenario.

              People

              • Assignee:
                Unassigned
                Reporter:
                James Strachan
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Development