summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-03-18 15:46:46 -0700
committerKaz Kylheku <kaz@kylheku.com>2012-03-18 15:46:46 -0700
commit9d06c8e9b36e94295c62eb0598cff7afae0c5a45 (patch)
tree70118a8c5df73c70158eb60c6004621f74df4330 /txr.1
parentd268addccbf0cfdb19f84103f85874daf410e1a6 (diff)
downloadtxr-9d06c8e9b36e94295c62eb0598cff7afae0c5a45.tar.gz
txr-9d06c8e9b36e94295c62eb0598cff7afae0c5a45.tar.bz2
txr-9d06c8e9b36e94295c62eb0598cff7afae0c5a45.zip
* eval.c (eval_init): url_decode has two parameters now,
so we make the second one optional. * filter.c (topercent_k, frompercent_k): New keyword variables. (url_encode, url_decode): Take a second parameter, space_plus. This determines whether or not to apply the rule that a space encodes as a + character. (filter_init): Initialize new keyword variables, and register :topercent and :frompercent filters. Fix the previous registrations of :tourl and :fromurl using currying. * filter.h (urlencode, urldecode): Declarations updated. (topercent_k, frompercent_k): Declared. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.118
1 files changed, 14 insertions, 4 deletions
diff --git a/txr.1 b/txr.1
index e3ab1535..a95f23b7 100644
--- a/txr.1
+++ b/txr.1
@@ -3697,15 +3697,15 @@ Convert the 26 lower case letters of the English alphabet to upper case.
.IP :downcase
Convert the 26 upper case letters of the English alphabet to lower case.
-.IP :fromurl
-Decode URL-encoded (a.k.a. percent-encoded) text. Character triplets consisting
+.IP :frompercent
+Decode percent-encoded text. Character triplets consisting
of the % character followed by a pair of hexadecimal digits (case insensitive)
are are converted to bytes having the value represented by the hexadecimal
digits (most significant nybble first). Sequences of one or more such bytes are
treated as UTF-8 data and decoded to characters.
-.IP :tourl
-Convert to URL encoding according to RFC 3986. The text is first converted
+.IP :topercent
+Convert to percent encoding according to RFC 3986. The text is first converted
to UTF-8 bytes. The bytes are then converted back to text as follows.
Bytes in the range 0 to 32, and 127 to 255 (note: including the ASCII DEL),
bytes whose values correspond to ASCII characters which are listed by RFC 3986
@@ -3716,6 +3716,16 @@ byte value (most significant nybble first, upper case). All other bytes
are converted directly to characters of the same value without any such
encoding.
+.IP :fromurl
+Decode from URL encoding, which is like percent encoding, except that
+if the unencoded + character occurs, it is decoded to a space character.
+Of course %20 still decodes to space, and %2B to the + character.
+
+.IP :tourl
+Encode to URL encoding, which is like percent encoding except that
+a space maps to + rather than %20. The + character, being in the
+reserved set, encodes to %2B.
+
Example: to escape HTML characters in all variable substitutions occuring in an
output clause, specify :filter :to_html in the directive: