r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Power Mezz] Discussions of the Power Mezz

Gabriele
30-Apr-2011
[142x6]
You can also do things like:

>> mold-tree get-node t/childs/html/childs/head/childs/title
== {[title [] [text [value "t"]]]}
get-node and set-node are also from %mezz/trees.r ; most likely you 
don't want to mess around with %mezz/macros/trees.r , that is deep 
vodoo i use to make the html filter fast.
(if you have performance problems, we'll talk about it :)
other examples:


>> get-node t/childs/html/childs/head/childs/title/childs/text/prop/value 
== "t"


>> get-node t/childs/html/childs/body/childs/h2/childs/text/prop/value 
           
== "HEADING"
Also note that:


>> print form-html/with load-html "<p>A paragraph!" [pretty?: yes]
<html>
    <head>
        <title></title>
        </head>
    <body>
        <p>A paragraph!</p>
        </body>
    </html>
ie. load-html tries to cope with malformed input as much as possible.
Janko
30-Apr-2011
[148x3]
wow, thank you a lot! I knew this was to obvious "bug" to be real 
and I am probably doing something wrong. GREAT!


I initially imported only needed modules but got errors .. ( I will 
try and report ) the errors went away as I manually imported them. 
Just a second
very good that you cope with bad html .. I will need that functionality 
because no html is perfect.
I was planing to use beaurtifullsoup if you didn't but since you 
do that is even much better
Janko
1-May-2011
[151x4]
I tried now, the problem with import was that I didn't set the absolute 
path to load-module/from before.
It all works now according to your example.. and I tested and it 
handles improper html very well! Thanks!
I looked at html-rules in load-html and I am stunned by how well 
the code / dialect is
s/is/looks/
Gabriele
2-May-2011
[155x2]
there are a few things that it still can't do (the dialect i mean), 
but it's very powerful on the things it can do :) The documentation 
is here: http://www.rebol.it/power-mezz/mezz/niwashi.html
it's one of the parts that i think it's best documented, so it's 
worth reading.
Pekr
2-May-2011
[157]
Gabriele - what is that? New templating system? Reminds me of Temple 
:-) (sorry, not following the discussion)
Gabriele
3-May-2011
[158:last]
No, though it could easily be used to reimplement Temple, this time 
with the ability to load any html.