SXML parser for a simplified version of svnwiki syntax.

  1. svnwiki-sxml
    1. Overview
    2. API
      1. Configuration
    3. About this egg
      1. Author
      2. Requirements
      3. History
      4. License


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.


[procedure] (svnwiki->sxml PORT)

Reads from PORT until EOF and returns an SXML representation of the parsed wiki contents.


[parameter] svnwiki-signature-parser
[procedure] ((svnwiki-signature-parser) sig type)

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))

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.")
[procedure] (svnwiki-signature->identifier sig type)

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


Jim Ursetto, with some maintenance by Peter Bex.



Report test failure to shell; #foo link without description gets desc 'foo'; ignore empty link href; use href when link desc empty
test-depend on test
Allow trailing space after directives (tags, toc)
Fix apostrophes in bold/italic; fix .+- in external url schemes
svnwiki-signature-parser API; add semantic 'syntax' tag (and convert 'macro' to 'syntax')
Fix SRFI-18 compatibility issue in line buffering [Peter Bex]
Parse inline markup in LINK and INT-LINK
Accept any scheme for external hyperlinks
Add setter definition type [Peter Bex]
Don't split DT to DD at a colon inside inline markup in DT; don't output DD for null definition
Rename script tag to highlight [Peter Bex]
Initial release