Changeset 2504 in project


Ignore:
Timestamp:
11/26/06 03:23:15 (15 years ago)
Author:
azul
Message:

Fixes.

File:
1 edited

Legend:

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

    r2503 r2504  
    9797; tags is a hash table of record objects of type tags.
    9898
    99 ; last-header is a list of numbers corresponding to the position in the
     99; sections-numbers is a stream of numbers corresponding to the position in the
    100100; headers hierarchy of the last header.
    101101;
     
    109109;   === Dup ,
    110110;
    111 ; last-header would be (2 3), since we're in section "2.3 Dup".
    112 
    113 (define-record wikidata driver open include name linktypes extensions extension-args linktypes-current last-header)
     111; sections-numbers would be (2 3), since we're in section "2.3 Dup".
     112
     113(define-record wikidata driver open include name linktypes extensions extension-args linktypes-current sections-numbers)
    114114
    115115; Macro used to generate the functions in the HTML driver.
     
    10851085  (global-token-info (make-wikidata output open include name linktypes extensions extensions-args '() stream-null)))
    10861086
    1087 (define (increase-header wikidata depth)
    1088   (wikidata-last-header-set! wikidata
    1089     (increase-header-adjust (wikidata-last-header wikidata) depth)))
    1090 
    1091 (define (increase-header-adjust current depth)
    1092   (let ((current-len (stream-length current)))
    1093     (if (< current-len depth)
    1094       (stream-append
    1095         current
    1096         (make-stream (- depth current-len) 1))
    1097       (stream-append
    1098         (stream-take current (- depth 1))
    1099         (stream (+ (stream-ref current (- depth 1)) 1))))))
    1100 
    11011087; This is the global parser which gets called by wiki->html.  It
    11021088; splits the input in chunks of lines (corresponding to
     
    11231109        (or #\newline ((end))))
    11241110       (let ((depth (stream-length (stream-cdr depth))))
    1125          (increase-header wikidata depth)
     1111         (wikidata-sections-numbers-set! wikidata
     1112           (sections-numbers-adjust (wikidata-sections-numbers wikidata) depth))
    11261113         (wikidata-header
    11271114           info
    11281115           (stream-append
    1129              (stream-concatenate
    1130                (stream-intersperse
    1131                  (stream-map
    1132                    number->stream
    1133                    (list->stream (wikidata-last-header wikidata)))
    1134                  (stream #\.)))
     1116             (sections-numbers->text (wikidata-sections-numbers wikidata))
    11351117             (stream #\space)
    11361118             name)
    1137            (min 5 depth)))
     1119           (min 5 depth))))
    11381120
    11391121      ; Skip empty lines:
Note: See TracChangeset for help on using the changeset viewer.