SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ruby BBCode Tag?

    One feature that makes these forums easy to use is the syntax highlighting capabilities of the [ php ] bbcode tag. I think it might help this forum to have a [ ruby ] bbcode tag to syntax highlight ruby code.

    No I have never looked at vbulletin, but I hope there are others out there who are familiar with it. In my mind, I can see several steps:

    a) vbulletin is a PHP app, so the highlighting code needs to run under PHP. Is anyone aware of a Ruby syntax highlighter coded in PHP?

    b) vbulletin needs to become aware of this code, and to apply it for a [ ruby ] bbcode tag. I would hope this is some kind of a plugin, but I need to defer to people who have actually used vbulletin to answer

    c) sitepoint needs to agree to implement such a solution (or does some such solution exist in the wild already?)

    d) someone needs to code the plugin/patch and have it applied to sitepoint

    Is this a reasonable goal? Is what I layed out the correct plan of action? Can anyone answer any of the points listed above?

    Lastly, if we get resonable answers for a, b and c, does anyone want to volunteer to throw it together?
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    I actually tried to get a CSS highlighting thing going for this forum but didn't get too far with it thanks to a lack of time. All you really have to do is know your regex well and be able to write a decent vB plugin. Instructions for that can be found here.

    edit: maybe you can take a look at GeSHi and see if what they have can translate over to vBulletin.

  3. #3
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  4. #4
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When I look over the headers from sitepoint, it looks like php-4.3.11 is use, so we should be able to use the proc_open function. Can anyone confirm if

    a) this whole ruby syntax thing is viable
    b) if the sitepoint host would have enscript available
    c) some code similar to this (the core of what could highlight ruby easily) would be acceptable?

    PHP Code:
    $argv "enscript -q -p - --highlight=$lang --language=html --color";

    $desc = array(
        
    => array("pipe""r"),
        
    => array("pipe""w"),
        
    => array("pipe""w")
    );
    $proc proc_open($argv$desc$pipe);

    if (
    is_resource($proc)) {
        
    fwrite($pipe[0], $code);
        
    fclose($pipe[0]);

        
    $code '';
        while (!
    feof($pipe[1])) {
            
    $code .= fgets($pipe[1], 4096);
        }
        
    fclose($pipe[1]);
        
    fclose($pipe[2]);
        
    proc_close($proc);

    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  5. #5
    SitePoint Zealot
    Join Date
    Nov 2004
    Location
    Yakima WA.
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is also a ruby gem for syntax highlighting:

    syntax (1.0.0, 0.7.0, 0.5.0)
    Syntax is Ruby library for performing simple syntax highlighting.

    I know it is not practical for use on this forum but just an fyi.

  6. #6
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Cool

    Quote Originally Posted by sweatje
    a) vbulletin is a PHP app, so the highlighting code needs to run under PHP. Is anyone aware of a Ruby syntax highlighter coded in PHP?
    I made a Ruby language file for my syntax hiliting plugin for WordPress(see my sig) which I contributed to GeSHi project so that it comes bundled with it now!! That lang file is not extensive but still its more than a good starting point!!

    I haven't looked at vB code so don't know how hard it'll be to implement this but don't think that it'll be tough!!
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  7. #7
    SitePoint Evangelist
    Join Date
    Jun 2004
    Location
    California
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    With vB 3.5 its very easy to use the plugin APIs to create something like this. The hardest part wouldnt be getting it to work with vB, itd just be making the parser to figure out what gets highlighted.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •