Implements a (largely) HTML5 compliant markup parser in Red and Ren-C and LOAD-MARKUP function using said parser. This is an experimental hybrid script and uses Red macros in a way that might conflict with other Red code--use with caution.
LOAD-MARKUP returns a block akin to Rebol 2's LOAD/MARKUP except that attributes are contained in a MAP! following the associated tag and self-closing tags are indicated by a </> closing tag following the tag or attributes (if present).
To do: tree-based model and DOM (likely similar to AltXML). Some work to be done here--the HTML5 rules for tree-building are labyrinthine.
I've added the tree constructor per the HTML5 spec and added a few more standard error codes (with source positions). There's a few kinks--while table nesting seems to be working and for the most part misnested formatting is resolved properly, there are still failures on the odd test or two*.
It's all still a bit slow for my liking--the parser is set up near exactly the way the spec suggests which in no way works to Rebol's (or Red's) parsing strength--pretty sure that's ripe for optimization**. Also still not sure about my choice of linked lists for trees either--there's a real gain in fidelity (good for editing when the time comes), but I'm not convinced there's not an insurmountable hit on navigation speed***.
Am still working in a Red/Ren-C compatible way (has it's challenges but is great for rooting out bugs!). In Red you can just DO the raw github url. In Ren-C, you can: import <markup>
LOAD-HTML will return a document node from a given string, MARKUP-AS-BLOCK will convert that into a more familiar block hierarchy. If you get an actual Rebol/Red error, let me know--shouldn't happen.
*I feel as if I've read the 'Adoption Agency' algorithm 30 times over and still don't understand how it's supposed to work **my only reservation here is while it does slow things down, it would work well with an incremental byte stream, say from a network source, where that might not be as noticeable ***if anyone has any thoughts on the efficacy of linked lists, would be interested to hear--have two versions: one with maps (no key/value clashes) and one with blocks (does seem faster)
AltJSON v0.3.6.1 for Red
JSON decoder/encoder for Red--features copied from Rebol 2 version.
- Converts object (map) keys to words where compatible, strings otherwise - Decodes large integers as issues (for e.g. Twitter IDs) - Encodes dates as RFC3339 - Support for surrogate pairs (decoding/encoding characters higher than the BMP as ascii) - 'Flat' mode for parsing, duplicate keys - Contracts Flickr's '_content' objects
Located and rebuilt the articles from Rebol Forces. For historical and informational reasons mainly.
Lately at work I have had to do much dissecting and assembling of spreadsheets, as well as cleaning up things accumulated over the years. Learning from previous experience, any time I find any code that could possibly by used in the future, I try to encapsulate it into a module or function. Then I produce a version sanitized of any employer-specific data and put it on a little web site in case it might be of use to others. With today's batch of uploads, I have hit the small milestone of 100 little programs. Most are extremely simple, and extremely specialized. It is sort of like the rebol-dot-org script library but much simpler, maybe more useful to beginners. It does show, like Nick's tutorials show, the value of being able to program one's own computer. The scripts are in the "free stuff" area of http://cobolrebol.com/
It's a QT app which runs a QTextEdit widget as a console and links to the Rebol evaluator, and the C++ API. You can setup watch points to see changes in values in your code for debugging purposes. So, you could run this when debugging your r3/ren-c code.
renc support read-pdf /lines from read-string (use deline/lines instead) /compact from load-dsv /preserve from load-dsv
enzero unarchive archive
split-line bug write-dsv bug load-dsv bug to-string-time now returns "HH:MM:SS" put returns value latin1-to-utf8 handles split strings correctly load-dsv/part/flat formats data correctly
Added /map to sqlcmd Added /flat to load-dsv, load-excel and load-fixed load-fixed now auto detects widths read-string with large files about 10-15x faster load-dsv about 3x faster rows? faster Added /flat to list write-excel now uses archive instead of 7z
build, platform and target moved from global context to settings append-column ascii-file? average-of call-oledb delta load-excel (replaced with oledb) map-source oledb-file? order remove-column split-line sum-of to-rebol-date to-rebol-time
crc32 excel? load-xml (uses unarchive) oledb (refactored from load-excel) settings literal column support to load-dsv, load-xml and munge (e.g. load-dsv/part file [1 "No"]) named column support to load-dsv, load-xml and munge (e.g. munge/where next [["Name" "Age"]["Sam" 50]] [&Age > 30])
munge/update refinement removed (use munge/where blk [row/1: 0]) munge/delete is now the same as munge/delete/where R2 support in archive and unarchive (requires /View) Excel support (using unarchive) added to cols?, fields?, rows? and sheets? replace-deep replaces multiple values in a single pass to-string-date and to-string-time now support Excel XML date (e.g. "41000") and time (e.g. ("0.33") formats list uses settings/console (default TRUE) to control new-line behaviour load-dsv (plus oledb, sqlcmd and sqlite) and load-xml use settings/as-is (default TRUE) to control trim/lines behaviour read-string optimized read-binary lost its /seek refinement added load-dsv/csv
Several parse copy words that escaped to the global context Unarchive bug
I will be hosting a Rebol Developers Conference in Philadelphia this summer (July 6th-7th). I've a great location lined up just around the corner from the Independence Mall (across the street from Ben Franklin's Post Office) and have some great talks lined up (more on this to follow--some epic projects: some you'll know about, one or two you won't).
I'll have registration up shortly, for now I've a wee questionnaire to get an idea of what kind of interest there is. Aside from the featured talks, I'd like to now issue a call for participation for anyone that would like to talk about their Rebol, Red or Ren-C projects. We'll have streaming and will record the talks for posterity.
If you're in the northeastern US, Philly is very accessible (great rail/bus access) about 90mins from NYC and DC. If not, it's a culturally rich city that is very much worth a visit even without a Rebol conference as an excuse, and we'll be here for July 4th at the very location where July 4th became a thing. Our hosts will provide co-working space on July 5th for any conference participant arriving from out of town.