View discussion [26 posts] | View script | License | Download documentation as: HTML or editable |
Download script | History | Other scripts by: chrisrg |
[0.064] 12.528k
Documentation for: emit-rss.rEmit RSS1. IntroductionA short script that creates RSS Markup from a REBOL Block. The block needs to be specifically constructed to closely match the RSS structure. 2. UsageThe script is designed to be modular. You can load it to your project as follows: context load %emit-rss.r It will add the function 'emit-rss to the global namespace. 3. Examplecontext load %emit-rss.r write %my-feed.rss emit-rss [ channel [ title "Journal Title" link http://www.example.com/ description "Describes this Journal" language "en-us" generator "REBOL Messaging Language" ] item [ title "Journal Entry title...." link http://www.example.com/cgi-bin/url.r?.... author "You" pubdate 30-Dec-2004/12:00+9:00 content {Journal Entry goes here...} ] ] 4. MethodologyThere are two major parts of this script and they both involve 'parse rules. The first escapes non-ascii characters; the second parses the argument block.
4.1 EscapeThe escape rule uses charset! values to decide whether to pass through each character in a string!; replace it with a numeric entity or a replace it with a question mark. 4.2 Argument StructureThe rule I've called 'build-rss assumes block parse and signifigantly uses the 'into parse command to probe into the 'channel and 'item sub blocks. As the parse routine passes through the argument block, we accumulate RSS data with the 'emit and 'emit-tags functions. 5. PlansI have no further plans for this script at this time. Any deficiencies this script has in relation to the RSS 2.0 spec can easily and obviously be remedied upon quick examination of its code. Notes
|