Simple HTML Renderer / Browser?

Discussion in 'Ruby' started by Randy Kramer, Feb 24, 2005.

  1. Randy Kramer

    Randy Kramer Guest

    I need a simple HTML renderer (to get started--eventually, I want to be able
    to interface to the gecko, khtml, and possibly other renderers/browsers, but
    for now I'm looking for something simple that won't be too hard for me (as a
    Ruby newbie) to get working).

    Suggestions?

    Current Questions:

    I have been doing some research and have some thoughts / questions:

    * tkhtml () sounds like a possibility, but I don't know if there is a Ruby
    interface to it--I 've been searching the web and reading up on Tk in Teach
    Yourself Ruby in 21 Days and Programming Ruby. Anybody have any experience
    with it (in Ruby).

    * Programming Ruby says I can access a Tk widget by prefixing it with
    Tk--is that all that has to be done (along with whatever you get with
    'require Tk') or does that depend on someone having created a Ruby
    "interface" specifically for tkhtml beforehand?

    * If I use tkhtml I should name it something like Tktkhtml based on what
    the book says? (Uncertain about the double tk and capitalization in
    general.)

    As I said, someday I'll want to use khtml (kde/qt) and gecko (Gtk) but I'm
    afraid Gtk and qt would overwhelm me at this point. I'd like to stay in a
    simpler (and lighter) GUI family, like Tk or Fox (at least I'm assuming they
    are simpler and lighter).

    Ideally, it would be nice to find a "cookbook" example, where I could copy
    some code verbatim to get something working, then expand from there.

    Simple rendering will do to start, for an application I'm envisioning, I'll
    eventually want both multiple renderers and at least one full-fledged
    browser.

    Randy Kramer
    Randy Kramer, Feb 24, 2005
    #1
    1. Advertising

  2. Randy Kramer

    Luke Graham Guest

    On Fri, 25 Feb 2005 01:31:24 +0900, Randy Kramer <> wrote:

    > As I said, someday I'll want to use khtml (kde/qt) and gecko (Gtk) but I'm
    > afraid Gtk and qt would overwhelm me at this point. I'd like to stay in a
    > simpler (and lighter) GUI family, like Tk or Fox (at least I'm assuming they
    > are simpler and lighter).


    Im hopelessly biased of course, but Qt really is very easy to learn.
    I dont know much about the KDE layers on top of it but there
    are Ruby wrappers for both. You probably already knew that tho.

    Just remember the simple rhyme:
    stay away from gtk
    qt is a cutie

    :D

    --
    spooq
    Luke Graham, Feb 25, 2005
    #2
    1. Advertising

  3. Luke Graham wrote:
    > Just remember the simple rhyme:
    > stay away from gtk
    > qt is a cutie


    Tk's Ok,
    Fox Rox!

    SCNR. Fox doesn't have a HTML widget yet, AFAIK. See
    http://www.fox-toolkit.org/xml.html.
    Joel VanderWerf, Feb 25, 2005
    #3
  4. On Feb 24, 2005, at 5:31 PM, Randy Kramer wrote:
    > I need a simple HTML renderer (to get started--eventually, I want to
    > be able
    > to interface to the gecko, khtml, and possibly other
    > renderers/browsers, but
    > for now I'm looking for something simple that won't be too hard for me
    > (as a
    > Ruby newbie) to get working).


    rendering a piece of html with korundum/khtml is a
    matter of just a few lines. interested in the code?

    Alex
    Alexander Kellett, Feb 25, 2005
    #4
  5. Randy Kramer

    Randy Kramer Guest

    On Friday 25 February 2005 04:31 am, Alexander Kellett wrote:
    > rendering a piece of html with korundum/khtml is a
    > matter of just a few lines. interested in the code?


    Alex,

    Yes, please! ;-)

    Randy Kramer
    Randy Kramer, Feb 25, 2005
    #5
  6. On Feb 25, 2005, at 1:21 PM, Randy Kramer wrote:
    > On Friday 25 February 2005 04:31 am, Alexander Kellett wrote:
    >> rendering a piece of html with korundum/khtml is a
    >> matter of just a few lines. interested in the code?

    >
    > Alex,
    > Yes, please! ;-)


    hehe :)

    for a complex application using it see:
    www.lypanov.net/websitedata/RubberDoc-0.2.7.tbz2
    just extracting the basics i guess its something like:
    require 'Korundum'
    about = KDE::AboutData.new("one", "two", "three")
    KDE::CmdLineArgs.init(1, ["RubberDoc"], about)
    app = KDE::Application.new()
    m = KDE::MainWindow.new
    htmlview = KDE::HTMLPart.new m
    htmlview.openURL KDE::URL.new("")

    (untested, if there are any problems i think richard
    will be able to help :) - i'm unable to test at the
    moment for various reasons)

    Alex
    Alexander Kellett, Feb 25, 2005
    #6
  7. Randy Kramer

    Jeremy Henty Guest

    Joel VanderWerf wrote:
    > Luke Graham wrote:
    >> stay away from gtk
    >> qt is a cutie

    > Tk's Ok,
    > Fox Rox!

    FLTK is ... er, ... um, ... *darn*!
    Jeremy Henty, Feb 25, 2005
    #7
  8. Randy Kramer

    Randy Kramer Guest

    On Friday 25 February 2005 06:04 pm, you wrote:
    > in the mean time if you get stuck


    Yup!

    I'm having trouble installing korundum (on Mandrake 10.0). I couldn't find an
    rpm, so I downloaded the tar file (3.3.1). I was going to try the
    standard ./configure, make, make install route, but ./configure doesn't
    work--there are two configure files, configure.in.in and configure.in.bot.
    Neither is executable. Autoconf 1.7 is not installed on Mandrake 10 (maybe
    that's the problem??).

    Also, kde is at 3.2.1 on Mandrake 10--which makes me wonder, will korundum
    3.3.1 work with that?

    I hope to have the Mandrake 10.1 disks in a week or so, maybe that will make
    things easier (I don't have any plans/hope of updating kde 3.2 to 3.3. other
    than by installing Mandrake 10.1 (I tried things like that back in the
    Mandrake 6.1-7.2 days, it was just an exercise in frustration).

    In the meantime (pending any helpful insights) I'll go back to trying to get
    TkHTML to work (by finding a cookbook example).

    regards,
    Randy Kramer

    PS: The tutorial looks helpful, but doesn't (AFAICS) address installing
    korundum.

    > i was just reading over the latest
    > version of the docs page that richards
    > been working on and found this wonderful
    > little tutorial:
    > http://developer.kde.org/language-bindings/ruby/kde3tutorial/p4.html
    > basically exactly what you wanted :)
    > glad to be of help :)
    > Alex
    >
    > On Feb 25, 2005, at 10:20 PM, Randy Kramer wrote:
    > > On Friday 25 February 2005 11:33 am, Alexander Kellett wrote:
    > >> hehe :)

    > >
    > > Alex,
    > >
    > > Thanks for your prompt reply! I'm downloading RubberDoc and hope that
    > > between
    > > that and the the basics below, I hope to get something working soon.
    > >
    > > If I do have any questions, I'll ask on the list. (I assume Richard
    > > hangs out
    > > there.)
    > >
    > > regards,
    > > Randy Kramer
    > >
    > > ---<good stuff snipped>---
    Randy Kramer, Feb 26, 2005
    #8
  9. Randy Kramer

    Randy Kramer Guest

    On Saturday 26 February 2005 10:33 am, you wrote:
    > can you try make -f Makefile.cvs before configure?
    > we should make this more obvious in the documentation :)
    > a wiki would be a good path for installation docs i
    > think... i'll ask richard about this.


    Thanks, that's helped--make has been chugging along for close to 3 hours now.
    (Not quite like the good ol' Turbo Pascal days ;-)

    I did have to upgrade autoconf and automake, but fortunately (for me), there
    were RPMs on the Mandrake 10 install disks.

    regards,
    Randy Kramer
    Randy Kramer, Feb 26, 2005
    #9
  10. next time use a distribution with a prebuilt package :)
    (we simply don't have the man power to build these ourselves,
    too many distributions too little time :( )

    On Feb 26, 2005, at 8:35 PM, Randy Kramer wrote:
    > On Saturday 26 February 2005 10:33 am, you wrote:
    >> can you try make -f Makefile.cvs before configure?
    >> we should make this more obvious in the documentation :)
    >> a wiki would be a good path for installation docs i
    >> think... i'll ask richard about this.

    >
    > Thanks, that's helped--make has been chugging along for close to 3
    > hours now.
    > (Not quite like the good ol' Turbo Pascal days ;-)
    >
    > I did have to upgrade autoconf and automake, but fortunately (for me),
    > there
    > were RPMs on the Mandrake 10 install disks.
    >
    > regards,
    > Randy Kramer
    Alexander Kellett, Feb 26, 2005
    #10
  11. On Fr, 2005-02-25 at 09:33 +0900, Luke Graham wrote:
    >Just remember the simple rhyme:
    >stay away from gtk
    >qt is a cutie
    >

    absolute bullshit...

    Ruby-gtk+/gnome are very nice bindings to Gtk+ / GNOME wich provide
    almost all widgets you need.

    before you ever else write such things you'll take a look at the
    advantages of the alternatives.

    cheers
    detlef
    Detlef Reichl, Feb 26, 2005
    #11
  12. On Feb 26, 2005, at 10:34 PM, Detlef Reichl wrote:
    > Ruby-gtk+/gnome are very nice bindings to Gtk+ / GNOME wich provide
    > almost all widgets you need.
    >
    > before you ever else write such things you'll take a look at the
    > advantages of the alternatives.


    dear good sir.

    it was a joke.
    lighten up.

    either that or i could get
    started on about my experiences
    with gtk :p
    Alexander Kellett, Feb 26, 2005
    #12
  13. Randy Kramer

    Randy Kramer Guest

    Thanks, Bugs, and Observations re. KDE Tutorial (was Re: Simple HTML Renderer / Browser?)

    On Saturday 26 February 2005 02:39 pm, you wrote:
    > next time use a distribution with a prebuilt package :)
    > (we simply don't have the man power to build these ourselves,
    > too many distributions too little time :( )


    Thanks:

    Just wanted to come back and thank Alexander Kellet again for pointing me to
    the Ruby/Qt/KDE tutorial at
    http://developer.kde.org/language-bindings/ruby/kde3tutorial/index.html it is
    very helpful. Thanks also to the authors of the tutorial . (So far I've
    mostly just copied and pasted the code to run the examples, now I need to go
    back and understand them. ;-)

    Bugs:

    I did run into a few bugs (iiuc) in the 9th example program
    (http://developer.kde.org/language-bindings/ruby/kde3tutorial/p9.html):

    * First of all, in the line:

    "Original Developer/Mantainer"),"",

    the ) is not required (and it should be Maintainer)--this created the error
    message:

    bash-2.05b$ ./p9.rb:96: syntax error
    "Original Developer/Mantainer"),"",
    ^

    (Caret doesn't show in proper place except in a fixed width font.)

    * Even after fixing that line, I get the error:

    kparts: ERROR: No such XML file /home/rhk/work/ruby/qt/p9ui.rc

    I haven't spent much time looking for the problem, maybe it is a BKAC
    error--maybe I am supposed to create that file?

    I probably won't pursue this for a few days, so I thought I'd mention thosse
    things.

    Observations:

    I am going to continue to look for some lighter weight HTML widgets. (I do
    like the khtml rendering, and I like the signal / slot communication method
    (vs. callbacks), but most of the widgets take 4 to 7 seconds to appear on my
    screen. (Some of that may be general program startup overhead, maybe
    creating a 2nd similar widget will not take nearly as long, but I would think
    there are some lighter weight alternatives. All I have to do is find some
    simple Ruby examples for using them.

    regards,
    Randy Kramer
    Randy Kramer, Feb 27, 2005
    #13
  14. Re: Thanks, Bugs, and Observations re. KDE Tutorial (was Re: Simple HTML Renderer / Browser?)

    concealed at the bottom of
    http://developer.kde.org/language-bindings/ruby/kde3tutorial/p9.html
    is the following:
    > <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
    > <kpartgui name="p9" version="1">
    > <MenuBar>
    > <Menu name="file"><text>&amp;File</text>
    > <Action name="set_default_page"/>
    > </Menu>
    > </MenuBar>
    > <ToolBar fullWidth="true" name="mainToolBar">
    > <Action name="add_to_bookmarks"/>
    > <Action name="back"/>
    > <Separator/>
    > <Action name="file_quit"/>
    > </ToolBar>
    > </kpartgui>

    i suppose a tarball with the entire example
    would be really useful for people that just
    like looking at code :) (e.g, me ;))

    i guess richard can commit the additional )
    fix in the near future. i forgot my cvs
    password :p

    strange that its so slow. my 2000-ish line
    application (rubberdoc) only takes a second
    or so to start here. widget creation should
    be basically instantaneous. (note, i don't
    have a fast computer)

    did u just try running once? second time load
    should be *much* faster. the bindings library is
    fairly big unfortunately as its the only way
    to allow for subclassing as gcc doesn't provide
    anything useful :(

    qt also has a rich text view. subset html.
    not sure if thats useful enough :)

    see:
    http://doc.trolltech.com/3.3/qtextbrowser.html

    Alex

    On Feb 27, 2005, at 4:26 PM, Randy Kramer wrote:
    > On Saturday 26 February 2005 02:39 pm, you wrote:
    >> next time use a distribution with a prebuilt package :)
    >> (we simply don't have the man power to build these ourselves,
    >> too many distributions too little time :( )

    >
    > Thanks:
    >
    > Just wanted to come back and thank Alexander Kellet again for pointing
    > me to
    > the Ruby/Qt/KDE tutorial at
    > http://developer.kde.org/language-bindings/ruby/kde3tutorial/
    > index.html it is
    > very helpful. Thanks also to the authors of the tutorial . (So far
    > I've
    > mostly just copied and pasted the code to run the examples, now I need
    > to go
    > back and understand them. ;-)
    >
    > Bugs:
    >
    > I did run into a few bugs (iiuc) in the 9th example program
    > (http://developer.kde.org/language-bindings/ruby/kde3tutorial/p9.html):
    >
    > * First of all, in the line:
    >
    > "Original Developer/Mantainer"),"",
    >
    > the ) is not required (and it should be Maintainer)--this created the
    > error
    > message:
    >
    > bash-2.05b$ ./p9.rb:96: syntax error
    > "Original Developer/Mantainer"),"",
    > ^
    >
    > (Caret doesn't show in proper place except in a fixed width font.)
    >
    > * Even after fixing that line, I get the error:
    >
    > kparts: ERROR: No such XML file /home/rhk/work/ruby/qt/p9ui.rc
    >
    > I haven't spent much time looking for the problem, maybe it is a BKAC
    > error--maybe I am supposed to create that file?
    >
    > I probably won't pursue this for a few days, so I thought I'd mention
    > thosse
    > things.
    >
    > Observations:
    >
    > I am going to continue to look for some lighter weight HTML widgets.
    > (I do
    > like the khtml rendering, and I like the signal / slot communication
    > method
    > (vs. callbacks), but most of the widgets take 4 to 7 seconds to appear
    > on my
    > screen. (Some of that may be general program startup overhead, maybe
    > creating a 2nd similar widget will not take nearly as long, but I
    > would think
    > there are some lighter weight alternatives. All I have to do is find
    > some
    > simple Ruby examples for using them.
    >
    > regards,
    > Randy Kramer
    Alexander Kellett, Feb 27, 2005
    #14
  15. Randy Kramer

    Randy Kramer Guest

    Re: Thanks, Bugs, and Observations re. KDE Tutorial (was Re: Simple HTML Renderer / Browser?)

    On Sunday 27 February 2005 10:46 am, Alexander Kellett wrote:
    > concealed at the bottom of
    > http://developer.kde.org/language-bindings/ruby/kde3tutorial/p9.html


    Ahh, thanks, that's (part of) what I needed! (more below)

    > i suppose a tarball with the entire example
    > would be really useful for people that just
    > like looking at code :) (e.g, me ;))


    Yes, that would be helpful, or additionally/alternatively, make it a little
    more obvious in the text that you must also create file p9ui.rc. I had
    skimmed the text, but even reading it more carefully after knowing I have to
    do that, I'm not sure it would be clear to someone reading it for the first
    time. Maybe a note at/near the top of the page like, "To run this example
    you must create two files, ... and also for full effect, you must run an
    instance of p8 as well." (starting it first, iirc, or does it matter?)

    More comments (as always ;-)

    * I feel like I must apologize again for not having thoroughly studied this
    tutorial, but it seems like the concepts demonstrated here will meet a lot of
    my needs, so I've tentatively moved on to figuring out how to "parse" TWiki
    markup.

    * For the sake of completeness, it seems there is still an error (or
    another EBKAC)--p7 and p8 work fine together as a pair, but p8 and p9
    don't--from p9 I can save bookmarks to p8, but choosing a bookmark in p8 does
    not cause it to be loaded in p9.

    * Which reminds me to thank everyone responsible for these tutorials
    again--they are helpful and demonstrate some useful functionality of the type
    I need! Part of what I intend is to have a "supervisory" window that knows
    what "pages" are open in any number of "subsidiary" windows. I'm fairly
    certain the signals and slots mechanism will make that fairly easy to do.
    (Note though that the subsidiary windows will all be independent "instances",
    so a crash or closure of one will not close any of the others.)

    I guess what that part of what I'm trying to say is that not only is the
    tutorial a good way to start learning how to use Korundum and (Ruby)Qt (??),
    it is a good demonstration of some of the power of Qt!

    > strange that its so slow. my 2000-ish line
    > application (rubberdoc) only takes a second
    > or so to start here. widget creation should
    > be basically instantaneous. (note, i don't
    > have a fast computer)


    There is no significant improvement for opening the same program
    (experimenting with p8 and p9) a 2nd time (after closing it). Also, I tried
    opening the same program a 2nd time when it is already open. It won't open a
    2nd copy (does this mean the programs are somehow singletons--something else
    for me to learn), but it still takes a significant amount of time (3-4
    seconds) for the "focus" to shift to the already open instance.

    Just to try to put the 3 to 6 seconds in context, perhaps some of this is
    because I have a heck of a lot of things loaded (kmail, konsole with 6
    "sessions", epiphany with ~10 tabs, 3 instances of konqueror with a total of
    ~35 - 40 tabs, top, samba (etc.), 5 instances of Nedit, 4 instances of gjots)
    and not all that much memory and swap space: 384 KB of RAM (all this MB can
    handle), ~1 GB of swap (often up to half in use, and (aside) I do notice a
    general slowdown when over half of my swap starts being used), and a 500 MHz
    processor. (But, this is the environment the program will typically run in
    (for me).)

    > qt also has a rich text view. subset html.
    > not sure if thats useful enough :)
    >
    > see:
    > http://doc.trolltech.com/3.3/qtextbrowser.html


    That's good to know!

    regards,
    Randy Kramer
    Randy Kramer, Feb 28, 2005
    #15
  16. Randy Kramer

    Luke Graham Guest

    Re: Thanks, Bugs, and Observations re. KDE Tutorial (was Re: Simple HTML Renderer / Browser?)

    How long does it take to open a roughly equivalent pure-C Qt program?


    On Mon, 28 Feb 2005 23:14:13 +0900, Randy Kramer <> wrote:
    > On Sunday 27 February 2005 10:46 am, Alexander Kellett wrote:
    > > concealed at the bottom of
    > > http://developer.kde.org/language-bindings/ruby/kde3tutorial/p9.html

    >
    > Ahh, thanks, that's (part of) what I needed! (more below)
    >
    > > i suppose a tarball with the entire example
    > > would be really useful for people that just
    > > like looking at code :) (e.g, me ;))

    >
    > Yes, that would be helpful, or additionally/alternatively, make it a little
    > more obvious in the text that you must also create file p9ui.rc. I had
    > skimmed the text, but even reading it more carefully after knowing I have to
    > do that, I'm not sure it would be clear to someone reading it for the first
    > time. Maybe a note at/near the top of the page like, "To run this example
    > you must create two files, ... and also for full effect, you must run an
    > instance of p8 as well." (starting it first, iirc, or does it matter?)
    >
    > More comments (as always ;-)
    >
    > * I feel like I must apologize again for not having thoroughly studied this
    > tutorial, but it seems like the concepts demonstrated here will meet a lot of
    > my needs, so I've tentatively moved on to figuring out how to "parse" TWiki
    > markup.
    >
    > * For the sake of completeness, it seems there is still an error (or
    > another EBKAC)--p7 and p8 work fine together as a pair, but p8 and p9
    > don't--from p9 I can save bookmarks to p8, but choosing a bookmark in p8 does
    > not cause it to be loaded in p9.
    >
    > * Which reminds me to thank everyone responsible for these tutorials
    > again--they are helpful and demonstrate some useful functionality of the type
    > I need! Part of what I intend is to have a "supervisory" window that knows
    > what "pages" are open in any number of "subsidiary" windows. I'm fairly
    > certain the signals and slots mechanism will make that fairly easy to do.
    > (Note though that the subsidiary windows will all be independent "instances",
    > so a crash or closure of one will not close any of the others.)
    >
    > I guess what that part of what I'm trying to say is that not only is the
    > tutorial a good way to start learning how to use Korundum and (Ruby)Qt (??),
    > it is a good demonstration of some of the power of Qt!
    >
    > > strange that its so slow. my 2000-ish line
    > > application (rubberdoc) only takes a second
    > > or so to start here. widget creation should
    > > be basically instantaneous. (note, i don't
    > > have a fast computer)

    >
    > There is no significant improvement for opening the same program
    > (experimenting with p8 and p9) a 2nd time (after closing it). Also, I tried
    > opening the same program a 2nd time when it is already open. It won't open a
    > 2nd copy (does this mean the programs are somehow singletons--something else
    > for me to learn), but it still takes a significant amount of time (3-4
    > seconds) for the "focus" to shift to the already open instance.
    >
    > Just to try to put the 3 to 6 seconds in context, perhaps some of this is
    > because I have a heck of a lot of things loaded (kmail, konsole with 6
    > "sessions", epiphany with ~10 tabs, 3 instances of konqueror with a total of
    > ~35 - 40 tabs, top, samba (etc.), 5 instances of Nedit, 4 instances of gjots)
    > and not all that much memory and swap space: 384 KB of RAM (all this MB can
    > handle), ~1 GB of swap (often up to half in use, and (aside) I do notice a
    > general slowdown when over half of my swap starts being used), and a 500 MHz
    > processor. (But, this is the environment the program will typically run in
    > (for me).)
    >
    > > qt also has a rich text view. subset html.
    > > not sure if thats useful enough :)
    > >
    > > see:
    > > http://doc.trolltech.com/3.3/qtextbrowser.html

    >
    > That's good to know!
    >
    > regards,
    > Randy Kramer
    >
    >



    --
    spooq
    Luke Graham, Feb 28, 2005
    #16
  17. Randy Kramer

    Randy Kramer Guest

    Re: Thanks, Bugs, and Observations re. KDE Tutorial (was Re: Simple HTML Renderer / Browser?)

    On Monday 28 February 2005 06:17 pm, Luke Graham wrote:
    > How long does it take to open a roughly equivalent pure-C Qt program?


    Well I'm not sure how to judge, so I tried the following:

    konsole ~3 seconds
    konqueror ~6 seconds
    kedit ~4.5 seconds
    kwrite ~5 seconds

    for comparison:

    nedit ~2 seconds

    Retrying p7, p8, and p9

    p7 ~5.5 seconds
    p8 ~5.5 seconds
    p9 ~6 seconds

    Randy Kramer
    Randy Kramer, Mar 1, 2005
    #17
    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. Xiaolei Li

    Looking for HTML Renderer

    Xiaolei Li, Oct 6, 2004, in forum: Java
    Replies:
    7
    Views:
    539
    Xiaolei Li
    Oct 7, 2004
  2. unbending
    Replies:
    0
    Views:
    344
    unbending
    Dec 17, 2004
  3. Robert kebernet Cooper

    html renderer

    Robert kebernet Cooper, Jun 27, 2005, in forum: Java
    Replies:
    2
    Views:
    2,290
    Roedy Green
    Jun 28, 2005
  4. Michele Simionato

    html renderer

    Michele Simionato, Nov 16, 2003, in forum: Python
    Replies:
    2
    Views:
    422
    John J. Lee
    Nov 17, 2003
  5. Ian Bicking

    HTML to Text renderer

    Ian Bicking, Nov 2, 2004, in forum: Python
    Replies:
    0
    Views:
    288
    Ian Bicking
    Nov 2, 2004
Loading...

Share This Page