formatting ruby code in html

Discussion in 'Ruby' started by paul vudmaska, Sep 25, 2003.

  1. paul vudmaska, Sep 25, 2003
    #1
    1. Advertising

  2. paul vudmaska

    Ara.T.Howard Guest

    On Thu, 25 Sep 2003, paul vudmaska wrote:

    > Is there a similar function in Ruby to the
    > highlight_file function of php...this function takes a
    > file and outputs it in html....
    >
    > http://us2.php.net/manual/en/function.highlight-file.php


    for f in *.[rb]; do gvim -f +"syn on" +"run! syntax/2html.vim" +"wq" +"q" $f; done

    vim is great.

    -a
    ====================================
    | Ara Howard
    | NOAA Forecast Systems Laboratory
    | Information and Technology Services
    | Data Systems Group
    | R/FST 325 Broadway
    | Boulder, CO 80305-3328
    | Email:
    | Phone: 303-497-7238
    | Fax: 303-497-7259
    | The difference between art and science is that science is what we understand
    | well enough to explain to a computer. Art is everything else.
    | -- Donald Knuth, "Discover"
    | ~ > /bin/sh -c 'for lang in ruby perl; do $lang -e "print \"\x3a\x2d\x29\x0a\""; done'
    ====================================
     
    Ara.T.Howard, Sep 25, 2003
    #2
    1. Advertising

  3. Hi!

    * Ara.T.Howard; 2003-09-25, 12:57 UTC:
    > for f in *.[rb]; do
    > gvim -f +"syn on" +"run! syntax/2html.vim" +"wq" +"q" $f;
    > done


    The line breaks I inserted don't break anything else but lines.

    '*.[rb]' matches file names that either end in '.r' or in '.r'. I
    think you want to match all files with names ending in '.rb'. This is
    done as follows:

    for f in *.rb

    That still doesn't solve the problem at hand. The task is not to
    identify files with names ending in certain characters but
    identifying files with certain content. This problem can be solved in
    two stages by first identifying the names of all files (in contrast
    to directories and other things) and then finding out which of these
    files are ruby programs:

    for f in $(file $(find . -type f)|grep -i ruby|cut -d : -f1); do

    "$(...)" is the POSIX equivalent of "`...`" that has a major
    advantage over the latter form: It can easily be nested.

    There is good reason to insist on *not* mixing up file extensions
    with file types. Under Unix and Linux programs may not have any file
    extension while still being written in Ruby.

    Also note that by

    +"colorscheme <name-of-color-scheme>"
    to
    +"syntax on"

    you can use a different color scheme for syntax highlighting than

    Please take notice of signature! / Bitte Signature beachten!

    Josef 'Jupp' Schugt
    --
    *Warning!* For sending me messages > 100 kB you need my explicit
    permission. Otherwise they will be silently discarded.
    *Vorsicht!* Mails > 100 KB nehme ich nur nach vorheriger Absprache
    entgegen. Ohne eine solche Absprache werden sie ungelesen geloescht.
     
    Josef 'Jupp' Schugt, Sep 25, 2003
    #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. Jacob Crossley
    Replies:
    6
    Views:
    491
    Jacob Crossley
    Jun 9, 2004
  2. Craig Kenisston

    HTML code warnings in asp.net html code view

    Craig Kenisston, Oct 7, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,173
    Martin Dechev
    Oct 7, 2004
  3. =?Utf-8?B?c3Ryb3V0?=

    HTML formatting question in datagrid pager area.

    =?Utf-8?B?c3Ryb3V0?=, Jan 13, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,826
    Ken Cox [Microsoft MVP]
    Jan 14, 2005
  4. =?Utf-8?B?S2VubmV0aCBQ?=

    Automatic formatting html

    =?Utf-8?B?S2VubmV0aCBQ?=, Apr 23, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    386
    =?Utf-8?B?S2VubmV0aCBQ?=
    Apr 24, 2005
  5. anne001
    Replies:
    1
    Views:
    554
Loading...

Share This Page