Outdated egg!
This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.
If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.
svnwiki-sxml
SXML parser for a simplified version of svnwiki syntax.
TOC »
Overview
This extension provides a parser which reads in text in svnwiki format and converts it into an abstract SXML representation.
See also the edit help on this very wiki for info about the svnwiki format.
If you want to use this, you might also want to take a look at the multidoc or eggdoc-svnwiki eggs for generating output.
API
- svnwiki->sxml PORTprocedure
Reads from PORT until EOF and returns an SXML representation of the parsed wiki contents.
Configuration
- svnwiki-signature-parserparameter
-
sig typeprocedure Parameter which controls if and how definition signatures are parsed during svnwiki document parsing. A definition SXML clause looks like:
(def (sig (,type ,signature . ,alist)) ,body)
where TYPE is the definition tag name (e.g. procedure) and SIGNATURE is the contents of the definition tag. This parameter affects the contents of ALIST.
A call to (svnwiki-signature-parser) takes the arguments SIGNATURE and TYPE and returns an alist of parse results, which is inserted directly into the ALIST slot. The alist associations must be proper lists, i.e. of the format ((key val) (key val)), not ((key . val) (key . val)). Currently, the only defined alist key is id, whose value is the identifier used to describe this signature. If a null alist is returned, it indicates the signature parser has punted on parsing and is leaving it up to the user.
As a special case, if this procedure returns anything other than an alist -- such as a symbol or #f -- it will be considered an identifier, and converted into the single-key alist ((id VAL)).
Typically, you would use svnwiki-signature->identifier as the value of this parameter.
This parameter defaults to (constantly '()), the null alist signalling to the SXML document user that no signature parsing was attempted during document parsing.
Examples. By default a null alist is returned, indicating no signature parsing was attempted:
(def (sig (procedure "(foo bar)")) "This foos bar.")
With the parameter set to svnwiki-signature->identifier it will extract operators from procedures and so on;
(def (sig (procedure "(foo bar)" (id foo))) "This also foos bar.")
And since the signature below can't be parsed by svnwiki-signature->identifier, an #f value is left in the id to indicate parsing was attempted but failed. The user can try to re-parse if desired.
(def (sig (procedure "(foo | bar)" (id #f))) "Tries to foo bar, but the embedded pipe confuses the reader.")
- svnwiki-signature->identifier sig typeprocedure
Conventional parser for definition signatures as written in Chicken svnwiki documents. Converts a signature string (usually a list or bare identifier) into an identifier. Returns a symbol, a string, or #f.
Operation. We read the string with the scheme reader. If a list, take the car recursively. If a symbol, return the symbol. If any other scheme object, return the whole signature string. If it cannot be read as a scheme expression, return #f. As a special case, read syntax (type read) returns the entire signature without trying to read it first; note this may cause a problem with older Chicken versions due to read/write variance on symbols starting with #. Also note that results of parsing a keyword identifier are, at this time, undefined.
About this egg
Author
Jim Ursetto, with some maintenance by Peter Bex.
Requirements
History
- 0.2.11
- Report test failure to shell; #foo link without description gets desc 'foo'; ignore empty link href; use href when link desc empty
- 0.2.10
- test-depend on test
- 0.2.9
- Allow trailing space after directives (tags, toc)
- 0.2.8
- Fix apostrophes in bold/italic; fix .+- in external url schemes
- 0.2.7
- svnwiki-signature-parser API; add semantic 'syntax' tag (and convert 'macro' to 'syntax')
- 0.2.6
- Fix SRFI-18 compatibility issue in line buffering [Peter Bex]
- 0.2.5
- Parse inline markup in LINK and INT-LINK
- 0.2.4
- Accept any scheme for external hyperlinks
- 0.2.3
- Add setter definition type [Peter Bex]
- 0.2.2
- Don't split DT to DD at a colon inside inline markup in DT; don't output DD for null definition
- 0.2.1
- Rename script tag to highlight [Peter Bex]
- 0.2.0
- Initial release
License
BSD.