webmcp
annotate framework/env/encode/mime/quoted_printable_text_content.lua @ 11:d76a8857ba62
Added ui.partial and other functions, which allow partial content replacement using XMLHttpRequests; Image support for ui.link
Also includes following changes:
- Fix for rocketcgi library to accept POST data content-types, which contain additional charset information.
- Support arrays passed as params to encode.url (only for keys ending with "[]")
- Version information changed to "1.0.7"
Documentation for added functions is not yet complete.
Also includes following changes:
- Fix for rocketcgi library to accept POST data content-types, which contain additional charset information.
- Support arrays passed as params to encode.url (only for keys ending with "[]")
- Version information changed to "1.0.7"
Documentation for added functions is not yet complete.
author | jbe/bsw |
---|---|
date | Fri Feb 12 18:40:22 2010 +0100 (2010-02-12) |
parents | 9fdfb27f8e67 |
children |
rev | line source |
---|---|
jbe/bsw@0 | 1 function encode.mime.quoted_printable_text_content(str) |
jbe/bsw@0 | 2 local parts = {} |
jbe/bsw@0 | 3 for str_part in string.gmatch(str, "[^\r\n]+[\r\n]*") do |
jbe/bsw@0 | 4 local line, extra_gap = string.match(str_part, "^([^\r\n]+)\r?\n?(.*)$") |
jbe/bsw@0 | 5 local line_length = 0 |
jbe/bsw@0 | 6 for char in string.gmatch(line, ".") do |
jbe/bsw@0 | 7 if string.find(char, "^[\t -<>-~]$") then |
jbe/bsw@0 | 8 if line_length + 1 > 75 then |
jbe/bsw@0 | 9 parts[#parts+1] = "=\r\n" |
jbe/bsw@0 | 10 line_length = 0 |
jbe/bsw@0 | 11 end |
jbe/bsw@0 | 12 parts[#parts+1] = char |
jbe/bsw@0 | 13 line_length = line_length + 1 |
jbe/bsw@0 | 14 else |
jbe/bsw@0 | 15 if line_length + 3 > 75 then |
jbe/bsw@0 | 16 parts[#parts+1] = "=\r\n" |
jbe/bsw@0 | 17 line_length = 0 |
jbe/bsw@0 | 18 end |
jbe/bsw@0 | 19 parts[#parts+1] = string.format("=%02X", string.byte(char)) |
jbe/bsw@0 | 20 line_length = line_length + 3 |
jbe/bsw@0 | 21 end |
jbe/bsw@0 | 22 end |
jbe/bsw@0 | 23 for i = 1, #extra_gap do |
jbe/bsw@0 | 24 if string.sub(extra_gap, i, i) == "\n" then |
jbe/bsw@0 | 25 parts[#parts+1] = "\r\n" |
jbe/bsw@0 | 26 end |
jbe/bsw@0 | 27 end |
jbe/bsw@0 | 28 parts[#parts+1] = "\r\n" |
jbe/bsw@0 | 29 end |
jbe/bsw@0 | 30 return table.concat(parts) |
jbe/bsw@0 | 31 end |