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

World: r3wp

[Script Library] REBOL.org: Script library and Mailing list archive

Gabriele
27-Apr-2007
[480]
Sunanda: just in case you eventually decide to do something like 
that, my code is described here: http://www.colellachiara.com/soft/MD3/emitters/wetan.html#section-4
Sunanda
27-Apr-2007
[481]
Thanks.

Basically, we use this code of Carl's when displaying a script in 
color:

http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=color-code.r

Thogh we've adapted it for CSS and  a couple of other minor tweaks.
What we are lacking is beautiful CSS :-)
Gabriele
27-Apr-2007
[482x2]
my code is very similar to Carl's, most of the additions are just 
to support literate programming and you won't need them. i'm emitting 
clean xhtml (no <font> etc. stuff) so that the look can be 100% configured 
via CSS.
i don't think my CSS is very good, I know Chris could make it 10x 
better. but until someone does a better one... i have something to 
use :)
Sunanda
27-Apr-2007
[484]
Same here !
Gabriele
27-Apr-2007
[485]
feel free to copy from mine - i took the colors for the datatypes 
from the css on rebol.org iirc :)
Sunanda
27-Apr-2007
[486]
Thanks......And if anyone wants to play with the CSS tha colors scripts 
on REBOL.org, the code is here:
http://www.rebol.org/cgi-bin/cgiwrap/rebol/css-view-system.r

(look for the SC-xxxx styles). You can copy them into your personal 
settings and change them.
Geomol
29-Apr-2007
[487]
Noted. I'll see, if I can come up with something, when I have some 
time. It's very important to make things clear and easy to understand 
for everyone interested, so making REBOL code easier to read is something, 
I'm very interested in.
Sunanda
29-Apr-2007
[488]
Thanks.....If you need some HTML tweaks to make the CSS really sing 
and dance, please let me know, and we can probably arrange it.
Chris
30-Apr-2007
[489]
I have a function that I'd like to add to the Library that takes 
some user data (could be from CGI query, or from View fields), processes 
and validates it according to a given spec, eg. [word "2007/4/30"] 
-> [word: date!] -> [word 30-Apr-2007]  I've named this function 
'import, but I realise that %import.r may be too generic a script 
name for the Library.  Any suggestions?
Anton
30-Apr-2007
[490]
mask-import

 ?  Your validator seems general but I presume you made it for a specific 
 purpose.
Chris
30-Apr-2007
[491]
That works.  %mask-import.r -- %input-mask.r -- %import-mask.r
Anton
30-Apr-2007
[492x2]
It's short, but still leaves room for confusion.

How about being more descriptive ? Eg. "validation-filtered-load" 
?
or "Chris-validated-import-loader" ?
I could get longer...
Chris
30-Apr-2007
[494x2]
I'd rather it was still somewhat succinct.
It's still a reasonably generic function.
Sunanda
30-Apr-2007
[496]
Assuming you don't just validate, but also load the data according 
to the filter, then coerce might be a good name:
  coerce [date! "1 jan 2007"] ==> 1-jan-2007
Chris
30-Apr-2007
[497]
Sort of, I have a helper function 'as that acts as 'coerce.  The 
meat of this script is filtering a block of [word! any-type!] values.
Sunanda
30-Apr-2007
[498]
I see, thanks. I have various things like your script. (Never wrote 
one generic enough for piublication).
They have names like check-type or check-data-type.
Chris
30-Apr-2007
[499]
I'm thinking %filtered-import.r
Sunanda
30-Apr-2007
[500]
Sounds good.
btiffin
30-Apr-2007
[501]
Give us a "C"....give us an "h"   ... Sorry, Deja-vu  :)
Thanks again Chris.
Chris
30-Apr-2007
[502]
Halfway there, just need to add a quick explanation...
btiffin
30-Apr-2007
[503]
%datascreen.r  %screening.r?  Naming is fun.  %filtered-import.r 
is nice too.


Note to everybody:  If you haven't, check out Chris's %form-date.r, 
newly in the library...
Chris's func'ies are funky, and a nice learn.
Chris
30-Apr-2007
[504x2]
How does this look? -- http://www.rebol.org/cgi-bin/cgiwrap/rebol/documentation.r?script=filtered-import.r
It's perhaps not the most exhaustive documentation, but it covers 
most points.  Feel free to revise...
btiffin
30-Apr-2007
[506]
Looks good.  Groks nicely.
Dockimbel
1-May-2007
[507]
Can I upload a ZIP archive in the Library or does it require to upload 
only a single REBOL script ?
Sunanda
1-May-2007
[508]
You can upload *packages* -- assemblies of any type of file you like.
Some examples here:

http://www.rebol.org/cgi-bin/cgiwrap/rebol/search.r?filter=type-package
Maxim
1-May-2007
[509x3]
zip file upload would be cool and easier... (nudge nudge, wink, wink)
but we've had the discussion before... so many things... so little 
time.
(the zip would be opened and converted to a package btw) its just 
sooo easy to prepare a zip file.
Sunanda
1-May-2007
[512x2]
If there was a standard REBOL library that could open *any* common 
zip format, then yes: it'd be easy to accept a zip upload and turn 
it into a package.
Otherwise, it'd be a support headache.
***

The current method of uploading package files (via a browser interface) 
is itself a headache. But (this is where I toss the ball back to 
you Maxim), LDS (the Library's API) supports package file uploading. 
So *you* could write an easy package assembly routine to run on the 
contributor's computer. Problem solved!
It could even work from a zip file, so no server scripts need be 
harmed in the writing of it :-)
Maxim
1-May-2007
[514x2]
hehe.
another pet project in queue  ;-)
Sunanda
1-May-2007
[516]
There's a lot that can be done to make the Library easier to use 
without waking up the Librarians :-)
Maxim
1-May-2007
[517x2]
aren't I an honorary member  ;-)
aren't  = ain't
Sunanda
1-May-2007
[519]
yes you is!
Jean-François
1-May-2007
[520]
Thanks Sunanda. I wasn't aware one could define it's own CSS for 
library code display.


However Gabriele's emitter has very usefull tags that are missing 
in the current library emitter. In particular, it is posible to highligh 
differently standard Rebol words and new words. This is extremely 
usefull for a beginner like me who doesn't yet know all of Rebols 
vocabulary. There is also the TAB tag that helps a lot.


Unfortunately, writing a new emitter using Gabriele's code is beyond 
my ability.


And from the dreamer in me... here is a suggestion for this better 
emitter: 

When one clicks (or maybe hover) on one of the standard Rebol words, 
you are presented with it's definition.
Sunanda
1-May-2007
[521]
That's a nice idea for a sort of "REBOL explainer" application.
But it would be difficult to do in the Library.

The Library does attempt to load and parse scripts -- that's how 
we do the colorisation. But (as with Gabriele's code) we rely on 
REBOL's own reflective abilities to tell us what is a word, function, 
operator etc.

The Library runs an old version of Core (and even if we update that, 
we'd never run a version of View on a webserver) so it does not have 
access to all the information a proper explainer.highlighter would 
need.
Take this script for example:

http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?color=yes&script=reboldiff.r

'new-line is a valid REBOL word, but it is not colored: that's because 
it is not a word in the version we use.

So sadly, the colorisation at REBOL.or remains a nice bit of eye 
candy rather than a solidly dependable feature.
Maxim
1-May-2007
[522]
REBOL's scopeless binding makes it VERY hard to analyse code without 
actually evaluating it... which can be pretty dangerous.  :-(
Sunanda
1-May-2007
[523]
That's true -- not something we could do safely on a server.....Hence 
we are limited to load/header etc.

A desktop application may be able to be more daring -- provided you 
don't let arbitrary code out of the sandbox.
Jean-François
1-May-2007
[524]
I understand about the "Rebol Explainer" app. ... maybe someday in 
a Rebol IDE.


But are the enhancements "à la Gabriele" still possible (i.e. Keywords, 
Words, and Tabs tags ) ?
Gabriele
1-May-2007
[525x2]
Jean: did you try overing on a bold word in my output? :)
Sunanda: i keep the list of know words external to the script. there's 
a link to it from the html doc i posted (look for the #include directive 
and click on it). there's also a script that generates that file 
(apache directory index is enabled for that dir, so you'll be able 
to see it there)
Sunanda
1-May-2007
[527]
Gabriel -- Thanks....A word list sounds a good way to go.
***

Jean-Francois -- a hover-over on kewords is certainly do-able and 
could look fun for the first couple of minutes on colorised scripts. 
Though it has drawbacks:
** it'd just about double the size of the page

** I think I'd be serious annoyed by it after 30 seconds -- though 
that may just be me

** lots of hidden-by-css styles (that's the way I'd do it, usng some 
of Eric Meyer's clevernesses) could create confusion for anyone using 
an elderly web browser or screen reader.


A good step in the right direction would be better styles for the 
code as we display it now.....So anyone experimenting with that is 
doing us all a great service ... Amd it would pave the way by creating 
a better foundation for higher cleverness.
Jean-François
1-May-2007
[528]
Gabriele, That is great !

I hadn't noticed the extra info poping up. Just that simple extra 
info is very helpful when inspecting/reading code (well for me anyway). 
Thank you.

The fact I hadn't noticed it might be a counter argument to Sunanda's 
fear of being annoyed by it. You really have to leave your pointer 
on it.


Any new language (natural or artificial) feels like "Scriptio continua" 
( http://en.wikipedia.org/wiki/Scriptio_continua) 

at first and all these visual cues are very helpfull in building 
the program's tree in your mind.


Imagine yourself a beginner at german reading a text that would have 
been colorized to accentuate its different elements. Hovering over 
a colored word would give you a translation or even maybe just a 
picture to prevent you from thinking in your first language.
Geomol
29-May-2007
[529]
I got some time to look at the CSS style sheet for displaying script 
code, Jean-Franois asked for. Where is the CSS located?