chickadee » cock-utils » wiki-write-docexprs

wiki-write-docexprs docexprsprocedure
wiki-write-docexprs docexprs metafileprocedure
wiki-write-docexprs docexprs metafile repoprocedure
wiki-write-docexprs docexprs metafile repo fragment?procedure

Write the source-derived docexprs as svnwiki.

docexprs
The parsed docexprs
metafile
The egg's .meta file
repo
The e.g. git-repo
fragment?
Whether to produce a document-fragment as opposed to a whole document (useful for debugging)
(define wiki-write-docexprs
  (case-lambda
    ((docexprs) (wiki-write-docexprs docexprs #f))
    ((docexprs metafile) (wiki-write-docexprs docexprs #f #f))
    ((docexprs metafile repo) (wiki-write-docexprs docexprs #f #f #f))
    ((docexprs metafile repo fragment?)
     (let* ((document (make-document (make-hash-table) (make-stack)))
            (parsed-docexprs (wiki-parse-docexprs document docexprs)))
       (let ((data (hash-table-merge
                     (hash-table-merge
                       (document-data document)
                       (parse-metafile metafile))
                     (repo-metadata repo))))
         (let ((author (hash-table-ref/default data 'author (default-author)))
               (username
                 (or (hash-table-ref/default data 'username #f)
                     (hash-table-ref/default data 'user #f)
                     (default-user)))
               (email (hash-table-ref/default data 'email (default-email)))
               (repository
                 (or (hash-table-ref/default data 'repository #f)
                     (hash-table-ref/default data 'repo #f)))
               (title (let ((title (hash-table-ref/default data 'title #f))
                            (egg (hash-table-ref/default data 'egg #f)))
                        (or title egg (default-title))))
               (description
                 (or (hash-table-ref/default data 'description #f)
                     (hash-table-ref/default data 'synopsis #f)
                     (default-synopsis)))
               (dependencies
                 (or (hash-table-ref/default data 'depends #f)
                     (hash-table-ref/default data 'needs #f)
                     '()))
               (license (hash-table-ref/default data 'license #f))
               (versions (hash-table-ref/default data 'versions '())))
           (unless fragment? (display (wiki-preamble title description)))
           (stack-for-each parsed-docexprs (lambda (docexpr) (docexpr)))
           (unless
             fragment?
             (display
               (wiki-postamble
                 author
                 username
                 license
                 repository
                 dependencies
                 versions)))))))))