XML in Ruby syntax

Discussion in 'Ruby' started by Trans, Sep 30, 2007.

  1. Trans

    Trans Guest

    Recently I saw an announcement for an XML/HTML builder lib that
    embedded the XML directly in Ruby code. What was it? I can't seem to
    find it now.

    Thanks,
    T.
    Trans, Sep 30, 2007
    #1
    1. Advertising

  2. On 9/30/07, Trans <> wrote:
    > Recently I saw an announcement for an XML/HTML builder lib that
    > embedded the XML directly in Ruby code. What was it? I can't seem to
    > find it now.


    Hi,

    It was a post/email (I use the mailing list) from Michael Neumann on
    September 15th at 12:13 AM (that's the date I received the email). I
    have copied that email below. BTW, how do you guys find the link to
    the archives for a specific thread?

    Jesus.



    On 9/15/07, Michael Neumann <> wrote:
    > Hi,
    >
    > While everyone embeds Ruby into HTML code nowadays, I thought why not
    > do it the other way round? Vim syntax highlighting included :)
    >
    > http://www.ntecs.de/hg-projects/xml_in_ruby/
    >
    > Uh, and it's soo simple, and you get a lot of goodies for free (for
    > example you can split your templates into methods, or inherit from other
    > template classes etc.).
    >
    > Regards,
    >
    > Michael
    >
    > --------------------------------
    > XML in Ruby - Templating Engine
    > --------------------------------
    >
    > ABOUT
    >
    > "XML in Ruby" is a simple templating engine that allows you to embed
    > XML directly into Ruby.
    >
    > EXAMPLE
    >
    > See sample.rbx.
    >
    > class MyView < View
    > def index(title)
    > <html>
    > <head>
    > <title>${title}</title>
    > </head>
    > <body>
    > render_body
    > </body>
    > </html>
    > end
    >
    > def render_body
    > output "Hello World"
    > end
    > end
    >
    > puts MyView.render:)index, "Test")
    >
    > To start:
    >
    > ruby -r view -e "View.require 'sample.rbx'"
    >
    > Output:
    >
    > <html>
    > <head>
    > <title>Test</title>
    > </head>
    > <body>
    > Hello World</body>
    > </html>
    >
    > You can mix XML and Ruby. Everything that starts with "<" as
    > fist non-whitespace character on a line is considered as XML.
    > You can also use:
    >
    > <: This is text
    >
    > to output the text " This is text", or require other
    > "templates" with:
    >
    > View.require 'another_template.rbx'
    >
    > In XML you can embed Ruby code with #{...} and ${...}. The second
    > performs escaping.
    >
    >
    >
    Jesús Gabriel y Galán, Sep 30, 2007
    #2
    1. Advertising

  3. Trans

    Trans Guest

    On Sep 30, 6:38 am, "Jes=FAs Gabriel y Gal=E1n" <>
    wrote:

    > Hi,
    >
    > It was a post/email (I use the mailing list) from Michael Neumann on
    > September 15th at 12:13 AM (that's the date I received the email). I
    > have copied that email below. BTW, how do you guys find the link to
    > the archives for a specific thread?


    I use the Google Group link. But the archives have different views,
    providing the message number is enough for someone to quickly pull up
    a post.

    Thanks,

    T=2E
    Trans, Sep 30, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Clifford W. Racz

    Checking XML DTD syntax and validating XML

    Clifford W. Racz, Jun 7, 2004, in forum: XML
    Replies:
    8
    Views:
    1,646
    Clifford W. Racz
    Jun 23, 2004
  2. gabriele renzi
    Replies:
    2
    Views:
    200
    gabriele renzi
    Dec 31, 2005
  3. Ken Bloom
    Replies:
    3
    Views:
    204
  4. Good Night Moon
    Replies:
    9
    Views:
    275
    Rick DeNatale
    Jul 25, 2007
  5. Erik Wasser
    Replies:
    5
    Views:
    445
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page