Changeset 12650 in project


Ignore:
Timestamp:
11/29/08 16:15:43 (11 years ago)
Author:
azul
Message:

implemented wiki-extension, to let an extension aggregate data.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/stream-wiki/trunk/stream-wiki.scm

    r12540 r12650  
    2424    wiki->latex latex-page
    2525    wiki->texi texi-page
     26    wiki-extension
    2627    wiki-links
    2728    wiki-tags
     
    175176    (lambda (f) (f file))
    176177    (stream identity stream-downcase name-to-base)))
     178
     179;;; Generic Extension Driver
     180
     181; Certain extensions will aggregate information only if called by a driver
     182; named after them.  They will use an iterator function passed in the
     183; environment as parameter 'return.  This function makes it easy to create one
     184; such driver.
     185
     186(define (extension-driver name)
     187  (make-driver
     188    ; format
     189    name
     190    ; horizontal-line
     191    (constantly stream-null)
     192    ; header
     193    (constantly stream-null)
     194    ; blockquote
     195    (compose (constantly stream-null) stream-traverse)
     196    ; center
     197    (compose (constantly stream-null) stream-traverse)
     198    ; small
     199    (compose (constantly stream-null) stream-traverse)
     200    ; big
     201    (compose (constantly stream-null) stream-traverse)
     202    ; literal
     203    (compose (constantly stream-null) stream-traverse)
     204    ; literal-line
     205    (compose (constantly stream-null) stream-traverse)
     206    ; paragraph
     207    (compose (constantly stream-null) stream-traverse)
     208    ; strong
     209    (compose (constantly stream-null) stream-traverse)
     210    ; em
     211    (compose (constantly stream-null) stream-traverse)
     212    ; link
     213    (constantly stream-null)
     214    ; image
     215    (constantly stream-null)
     216    ; math
     217    (constantly stream-null)
     218    ; ordered-list
     219    (compose (constantly stream-null) stream-traverse)
     220    ; unordered-list
     221    (compose (constantly stream-null) stream-traverse)
     222    ; list-item
     223    (compose (constantly stream-null) stream-traverse)
     224    ; definition-list
     225    (compose (constantly stream-null) stream-traverse)
     226    ; definition-item
     227    (lambda (t d)
     228      (stream-traverse t)
     229      (stream-traverse d)
     230      stream-null)
     231    ; toc
     232    (constantly stream-null)
     233    ; special-char
     234    (constantly stream-null)
     235    ; tags
     236    (constantly stream-null)
     237    ; comments
     238    (constantly stream-null)
     239    ; line-break
     240    (constantly stream-null)
     241    ; anchor
     242    (constantly stream-null)))
    177243
    178244;;; OpenOffice.org Driver
     
    807873
    808874      ((#\< (all char-whitespace?) (bind tag (all char-alphabetic?))
    809         (assert (wiki-extension tag 'code-span))
     875        (assert (wiki-extension-get tag 'code-span))
    810876        ; Parameters
    811877        (* (+ char-whitespace?)
     
    826892
    827893      ((#\< (all char-whitespace?) (bind tag (all char-alphabetic?))
    828         (assert (wiki-extension tag 'code-break))
     894        (assert (wiki-extension-get tag 'code-break))
    829895        ; Parameters
    830896        (* (+ char-whitespace?)
     
    11381204
    11391205      ((#\< (all char-whitespace?) (bind tag (all (or char-alphabetic? char-numeric?)))
    1140         (assert (wiki-extension tag 'code-span))
     1206        (assert (wiki-extension-get tag 'code-span))
    11411207        ; Parameters
    11421208        (* (+ char-whitespace?)
     
    11591225
    11601226      ((#\< (all char-whitespace?) (bind tag (all char-alphabetic?))
    1161         (assert (wiki-extension tag 'code-break))
     1227        (assert (wiki-extension-get tag 'code-break))
    11621228        ; Parameters
    11631229        (* (+ char-whitespace?)
     
    11941260(define wiki-tags
    11951261  (accum-with-driver tags-driver))
     1262
     1263(define (wiki-extension name . rest)
     1264  (stream-traverse
     1265    (apply (accum-with-driver (lambda (dummy) (extension-driver name))) rest)))
    11961266
    11971267; TODO: This is already broken: we need to split PROCEDURE into two procs, one
     
    14461516;;; Extensions
    14471517
    1448 (define (wiki-extension name type)
     1518(define (wiki-extension-get name type)
    14491519  (svnwiki-extensions-get type (stream->symbol (stream-downcase name))))
    14501520
     
    14861556
    14871557(define (run-span-extension name text params info)
    1488   ((wiki-extension name 'code-span)
     1558  ((wiki-extension-get name 'code-span)
    14891559   (environment
    14901560     (environment-code-extensions info params)
     
    14921562
    14931563(define (run-break-extension name params info)
    1494   ((wiki-extension name 'code-break)
     1564  ((wiki-extension-get name 'code-break)
    14951565   (environment-code-extensions info params)))
    14961566
Note: See TracChangeset for help on using the changeset viewer.