Changeset 13974 in project


Ignore:
Timestamp:
03/27/09 20:11:39 (11 years ago)
Author:
sjamaan
Message:

Add a testsuite and update to 0.2

Location:
release/3/fancypants
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • release/3/fancypants/fancypants-eggdoc.scm

    r2749 r13974  
    44
    55(define license
    6 "Copyright (c) 2006, Peter Bex (peter.bex@xs4all.nl)
     6"Copyright (c) 2006-2009, Peter Bex (peter.bex@xs4all.nl)
    77All rights reserved.
    88
     
    6161     (author (url "mailto:peter.bex@xs4all.nl" "Peter Bex"))
    6262     (history
     63      (version "0.2" "Added testsuite, removed useless syntax-case dependency")
    6364      (version "0.1" "initial release."))
    6465     (requires (url "sxml-transforms.html" "sxml-transforms"))
     
    190191           " in the " (code "character-map") " alist to their Unicode"
    191192           " character within " (code "string") ".")
    192         (procedure "(smarten-quotes string quotes)"
    193            "Smarten the " (code "string") ".  Translates only the"
    194            " strings in the " (code "quotes") " argument.")))
     193        (procedure "(smarten-quotes sxml quotes exceptions)"
     194           "Smarten the " (code "sxml") ".  Translates only the"
     195           " strings in the " (code "quotes") " argument, and skips all"
     196           " tag names in the " (code "exceptions") " list")))
    195197     (license ,license))))
    196198;; TODO: provide an example on how to use the smarten-quotes ruleset.
  • release/3/fancypants/fancypants.html

    r2749 r13974  
    157157<h3>Version</h3>
    158158<ul>
     159<li>0.2 Added testsuite, removed useless syntax-case dependency</li>
    159160<li>0.1 initial release.</li></ul></div>
    160161<div class="section">
     
    206207<dt class="definition"><strong>procedure:</strong> (fancify string character-map)</dt>
    207208<dd>Perform simple substitution of all ASCII character strings in the <code>character-map</code> alist to their Unicode character within <code>string</code>.</dd>
    208 <dt class="definition"><strong>procedure:</strong> (smarten-quotes string quotes)</dt>
    209 <dd>Smarten the <code>string</code>.  Translates only the strings in the <code>quotes</code> argument.</dd></div></div>
     209<dt class="definition"><strong>procedure:</strong> (smarten-quotes sxml quotes exceptions)</dt>
     210<dd>Smarten the <code>sxml</code>.  Translates only the strings in the <code>quotes</code> argument, and skips all tag names in the <code>exceptions</code> list</dd></div></div>
    210211<div class="section">
    211212<h3>License</h3>
    212 <pre id="license">Copyright (c) 2006, Peter Bex (peter.bex@xs4all.nl)
     213<pre id="license">Copyright (c) 2006-2009, Peter Bex (peter.bex@xs4all.nl)
    213214All rights reserved.
    214215
  • release/3/fancypants/fancypants.meta

    r3008 r13974  
    77 (category web)
    88 (license "BSD")
    9  (needs sxml-transforms syntax-case)
     9 (needs sxml-transforms)
    1010 (files "fancypants.scm" "fancypants-eggdoc.scm" "fancypants.html" "fancypants.setup"))
  • release/3/fancypants/fancypants.scm

    r2733 r13974  
    11;;; fancypants - Automatic ASCII smart quotes and ligature handling for SXML
    22;
    3 ; Version 0.1
    4 ;
    5 ; Copyright (c) 2006 Peter Bex (Peter.Bex@xs4all.nl)
     3; Copyright (c) 2006-2009 Peter Bex (Peter.Bex@xs4all.nl)
    64; All rights reserved.
    75;
     
    3129
    3230(declare
    33  (hide point-split-string))
    34 
    35 (use srfi-1 srfi-13 sxml-transforms syntax-case regex)
     31 (hide point-split-string parts->regex flatten-string))
     32
     33(use srfi-1 srfi-13 sxml-transforms regex)
    3634
    3735;; Split up a string at predefined points, returning a list with the pieces.
     
    108106;; Structure of these lists: (pre match post how counts?)
    109107;; pre is the part of the string that's before the quote to match, post is the
    110 ;; string that is after the match (any may be #f)
    111 ;; how is one of single, double, single-open, double-open, single-close or double-close
    112 ;; counts? is a boolean describing whether the quote should influence the nesting of
    113 ;; the next quote or not.  (ie, "isn't" => #f, since the ' doesn't mean an opening quote
    114 ;; is closed by the quote)
    115 ;; Note that you (currently) can't use brackets in these regexes, since that messes
    116 ;; up the expected structure of the result of string-search-positions
    117 (define all-quotes '(("n" "'"  "t"  single-close #f)  ;; Aren't you?
    118                      (#f  "'"  "s"  single-close #f)  ;; Jack's widget
    119                      ("s" "'" " |$" single-close #f)  ;; The Jacksons' car
    120                      ("^| " "'" "[0-9]+s" single-close #f) ;; The '90s
     108;; string that is after the match (any may be #f).
     109;; how is one of single, double, single-open, double-open, single-close
     110;; or double-close.
     111;; counts? is a boolean describing whether the quote should influence the
     112;; nesting of the next quote or not.  (ie, "isn't" => #f, since the '
     113;; doesn't mean an opening quote is closed by the quote).
     114;; Note that you (currently) can't use brackets in these regexes, since that
     115;; messes up the expected structure of the result of string-search-positions.
     116(define all-quotes '(("n" "'"  "t"  single-close #f) ; Aren't you?
     117                     (#f  "'"  "re" single-close #f) ; We're here
     118                     (#f  "'"  "s"  single-close #f) ; Jack's widget
     119                     ("s" "'" " |$" single-close #f) ; The Jacksons' car
     120                     ("^| " "'" "[0-9]+s" single-close #f) ; The '90s
    121121                     (#f  "\"" #f   double #t)
    122122                     (#f  "``" #f   double-open #t)
    123                      (#f  "''" #f   double-close #t)  ; How to know when an empty string is meant, instead?
     123                     (#f  "''" #f   double-close #t)
    124124                     (#f  "'"  #f   single #t)))
    125125
     
    177177                                (set! single-open-count (add1 double-open-count)))
    178178                            (set! new-quote '(& "#x201d")))
    179                            ;; For the balanced ones, close it if it was open, open it if it was closed
     179                           ;; For the balanced ones, close it if it was open,
     180                           ;; open it if it was closed
    180181                           ((single)
    181182                            (if (> single-open-count 0)
     
    208209;; That's what you get when trying to map one string to a list of strings :)
    209210;;
    210 ;; NOTE: There's probably a way to eliminate all this reversing.  This is inefficient.
     211;; NOTE: There's probably a way to eliminate all this reversing.
     212;; This is inefficient.
    211213(define (flatten-strings data)
    212214  (let loop ((data data)
  • release/3/fancypants/fancypants.setup

    r2806 r13974  
    44(install-extension 'fancypants
    55                   '("fancypants.so")
    6                    '((version "0.1")
     6                   '((version "0.2")
    77                     (documentation "fancypants.html")))
Note: See TracChangeset for help on using the changeset viewer.