World: r3wp
[Power Mezz] Discussions of the Power Mezz
older newer | first last |
Gabriele 31-Jan-2010 [33x4] | 1) Download the built zip, or download the scripts individually from http://www.rebol.it/power-mezz/. (Of course it would be nice to get the whole repo and setup your system to be able to make changes as well. It currently requires GNU Make, however, those crazy people still using Windows could rewrite remake.r to do all the work.) |
2) In your script, use something like: do %/path/to/module.r load-module/from %/path/to/power-mezz/ module [ Imports: [%mezz/filter-html.r] ] [ ; .... ] | |
Since filter-html is defined globally, you can also use: load-module %mezz/filter-html.r | |
however, I recommend the former as I don't like making things global and I will remove that eventually | |
Graham 31-Jan-2010 [37] | Thanks ... I'll give it a go. But it seems that it would require a bit of work to use this within an encapped script? |
Gabriele 1-Feb-2010 [38] | yes, though it would be easy to add support to prebol. |
Janko 22-Sep-2010 [39x2] | First of all.. thanks for making this and making it awailable. I am working with emails now for usrjoy and if I would have to manaually detect and decode (or write all this) various encodings in subject or content I would just shoot myself (like quoted printable / base64 ). |
I can use decode-email-field to decode various encodings of subject. But I wasn't able to figure out how can I decode the content of an email which is in my case encoded with quoted-printable / utf8 . I found to-netmsg library on codeconscius.com code that loads the email text and parses it into structure. It doesn't decode the subject =?UTF-8?B...?= but it does the content. I could use that and power mezz to get the effect I want. If there is a way to encode content in power-mezz I would rather use it alone. | |
Gabriele 23-Sep-2010 [41] | http://www.rebol.it/power-mezz/mezz/text-encoding.html See the list of supported encodings. |
florin 25-Sep-2010 [42] | Is there any documentation on how to use these modules? I've had a couple of hours this beautiful weekend and all I did was try to find a way to load load-html.r with no results. Dependent modules change the current directory in the console and as a result one module cannot find another another. Yes, I am a poor soul on windows. Heck, I got to take the kids to the Fall Festival and am late already. |
BrianH 25-Sep-2010 [43] | http://www.rebol.it/power-mezz/mezz/module.html |
florin 25-Sep-2010 [44] | So this: %./ wasted 2 hours of my precious Saturday! I hate dots and slashes. |
Graham 25-Sep-2010 [45x2] | only 2 hours? lol |
I think Gab built them into one package .. check http://sourceforge.net/projects/rebol-power-mez/ | |
florin 25-Sep-2010 [47x3] | Well, well. I thought I could just type and things heppen. I actually need to read code. Bummer. This guy, BrianH, is a heartless man. |
The package you mention has files with a different extension, .rlp. Apparently the package needs to be cooked on a strange OS different than Windows. (Gabriele: It currently requires GNU Make, however, those crazy people still using Windows could rewrite remake.r to do all the work). | |
Keeping things obscure is part of the nefarious goals of the Genius Network United (GNU). | |
Andreas 26-Sep-2010 [50] | http://gnuwin32.sourceforge.net/downlinks/make-bin-zip.php has a single binary in the bin/ subfolder, "make.exe", that's all you need. |
BrianH 26-Sep-2010 [51] | Gabriele likes what is called "literate programing". RLP is his own processor that implements it. The .rpl files are the source of both the .r code files and the .html doc files, one .rlp generates both. If you want to understand his code, either read the .html or the .rlp file; the .r file is not formatted for human consumption. |
florin 26-Sep-2010 [52] | Thanks BrianH. You guys are awesome. |
BrianH 26-Sep-2010 [53x2] | I am not an RLP advocate, for good reasons, but it has its fans and I respect that. It's a matter of taste. |
Note, I mean that I am not a LP advocate. However, if you are a LP fan, I *definitely* recommend RLP, it's a great implementation of the LP concept and a great piece of code. | |
Gabriele 27-Sep-2010 [55x2] | Florin, if you go here: http://sourceforge.net/projects/rebol-power-mez/files/ you'll find power-mezz-built-1.0.0.zip which contains pre-built .r scripts. Inside tools/ , there is a module-console.r which defines a IMPORT function so that you can just write "import %mezz/load-html.r" and have its exported words available in the console. Otherwise, from your own code: do %<path to power-mezz>/mezz/module.r load-module/from %<path to power-mezz> module [ Imports: [%mezz/load-html.r] ] [ ; your code that uses load-html ] |
of note, if you have the normal package, from windows you can go to tools/ and double click on wetan-test.r (assuming you have View associated with .r files), and it will just ask you for a file to process. select any of the .rlp file to process it and produce .html and .r files. make is only required if you want everything to happen automatically. i'm not sure if it is obscure, as it is the tool used by basically every C programmer on this planet since 1980 or so... | |
florin 27-Sep-2010 [57x3] | Gabriele, thank you so much. I realize that you don't like to litter the global namespace, yet I doubt that (poking) ~Humor should have it's own group on Altme. I barely get an hour every now and then for Rebol so I appreciate all the shortcuts that I can get. I need to change my name to Nonchalant. You guys are an awesome bunch. |
And I did get it work to this point: ** Script Error: make-node has no value ** Where: context ** Near: root: current-node: make-node 'root | |
Is it not enough to pass an html (string!) to load-html ? | |
Gabriele 28-Sep-2010 [60x2] | yes, html string should be enough. Script: {Allows "importing" modules at the console} (none) Script: "Modules for REBOL 2" (none) >> import %mezz/load-html.r >> result: load-html "<p>This is a paragraph<p>This is another one" == [root none [] [html [...] [] [head [...] [] [title [...] []]] [body [...] [] [p [...] [] [text [...] [value "This is a paragraph... |
>> import %mezz/trees.r >> print mold-tree result [root [] [html [] [head [] [title []]] [body [] [p [] [text [value "This is a paragraph"]]] [p [] [text [value "This is another one"]]]]]] | |
florin 28-Sep-2010 [62] | Gabriele, thanks, it worked. I downloaded the build provided from above and it worked. Thank you. |
Gabriele 28-Sep-2010 [63] | modules were designed to help with building larger applications. i understand it can get in your way if you are doing something very small. You can still just DO the scripts but then you need to resolve the dependencies yourself, ie. do all the needed scripts in order. (there is a function inside tests/run.r that returns a block with all the modules a module depends on.) |
florin 1-Oct-2010 [64x5] | In the following segment: p [...] [id "myId" class "pclass"] [text [...] [value "Some text in the paragraph"]] what does [...] represent? Except "root" every html element is followed by this [...]. |
Is there a way to navigate this tree? Something similar to, let's say xslt path? | |
If I want to find a tag with a given ID, how is it done? | |
I'll try this: http://www.rebol.org/view-script.r?script=xpath.r | |
How do you eat your words on Altme? | |
Maxim 1-Oct-2010 [69] | hehehe |
Gabriele 3-Oct-2010 [70x3] | if you use MOLD-TREE, you won't see those [...]. they are back-references that are necessary internally. MOLD won't print them or it would be an infinite cycle. |
you can navigate with GET-NODE, I haven't needed something like XSLT Paths yet (I had something closer to that in Temple). root: load-html ... p: get-node root/childs/html/childs/body/childs/p ; for eg. most of the logic to do what you want is already in trees.r actually, because of the rewrite-tree function (that I don't use anymore). Anyway, a simple way would be: get-node-with-id: func [root id] [ if id = get-node root/prop/id [return root] foreach child get-node root/childs [ if get-node-with-id child id [return child] ] none ] | |
(warning: not tested) | |
florin 3-Oct-2010 [73] | Thanks. |
PatrickP61 15-Dec-2010 [74x3] | Hi Gabriele, I'm trying out your power-mezz for the first time. Do you have any other documentation on how to set it up properly? Here is what I'm doing: power-mezz-path: to-path e:/Projects/PT/Rebol/power-mezz-built-1.0.0/ print "Starting mezz/module.r" do power-module: to-url ajoin [power-mezz-path 'mezz/module.r] print "Returned mezz/module.r" load-module/from power-mezz-path module [ imports: [%mezz/html-to-text.r] ] --> e:/Projects/PT/Rebol/power-mezz-built-1.0.0/ --> Starting mezz/module.r ** Access Error: Invalid port spec: e:/Projects/PT/Rebol/power-mezz-built-1.0.0/mezz/module.r ** Near: do power-module: to-url ajoin [power-mezz-path 'mezz/module.r] Any ideas on what I did wrong? |
I've got a meeting to run to -- will check back in couple of hours :-) | |
Here now, Anyone have ideas on how to use Power-Mezz for the beginner? Also, what is the difference between power-mezz-1.0.0 and power-mezz-built-1.0.0? | |
PatrickP61 17-Dec-2010 [77] | Anyone have info on how to use Power-Mezz? |
Maxim 17-Dec-2010 [78x2] | I installed it yesterday, it worked pretty well for what I needed. |
do you need help on install or on what the actually mezz code does? | |
PatrickP61 17-Dec-2010 [80] | Hi Maxim, I'm still learning Rebol, but I'd like to see how I can use Power-Mezz. How do you install it? |
Gabriele 18-Dec-2010 [81] | Patrick, e:/Projects/... is not a valid rebol file path. try with something like: power-mezz-path: %/E/Projects/PT/Rebol/power-mezz-built-1.0.0/ do power-mezz-path/mezz/module.r load-modules/from power-mezz-path ; etc. |
PatrickP61 18-Dec-2010 [82] | Oops -- Didn't see the malformed file path!!! Where can I find examples of how to use Power Mezz? |
older newer | first last |