Software /
code /
prosody
Comparison
fallbacks/lxp.lua @ 5776:bd0ff8ae98a8
Remove all trailing whitespace
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Fri, 09 Aug 2013 17:48:21 +0200 |
parent | 3899:eff0c5fe9119 |
comparison
equal
deleted
inserted
replaced
5775:a6c2b8933507 | 5776:bd0ff8ae98a8 |
---|---|
59 end | 59 end |
60 local function peek() | 60 local function peek() |
61 while #data == 0 do data = coroutine.yield(); end | 61 while #data == 0 do data = coroutine.yield(); end |
62 return data:sub(1,1); | 62 return data:sub(1,1); |
63 end | 63 end |
64 | 64 |
65 local ns = { xml = "http://www.w3.org/XML/1998/namespace" }; | 65 local ns = { xml = "http://www.w3.org/XML/1998/namespace" }; |
66 ns.__index = ns; | 66 ns.__index = ns; |
67 local function apply_ns(name, dodefault) | 67 local function apply_ns(name, dodefault) |
68 local prefix,n = name:match("^([^:]*):(.*)$"); | 68 local prefix,n = name:match("^([^:]*):(.*)$"); |
69 if prefix and ns[prefix] then | 69 if prefix and ns[prefix] then |
98 local function pop() | 98 local function pop() |
99 local tag = ns[0]; | 99 local tag = ns[0]; |
100 ns = getmetatable(ns); | 100 ns = getmetatable(ns); |
101 return tag; | 101 return tag; |
102 end | 102 end |
103 | 103 |
104 while true do | 104 while true do |
105 if peek() == "<" then | 105 if peek() == "<" then |
106 local elem = read_until(">"):sub(2,-2); | 106 local elem = read_until(">"):sub(2,-2); |
107 if elem:sub(1,1) == "!" or elem:sub(1,1) == "?" then -- neglect comments and processing-instructions | 107 if elem:sub(1,1) == "!" or elem:sub(1,1) == "?" then -- neglect comments and processing-instructions |
108 elseif elem:sub(1,1) == "/" then -- end tag | 108 elseif elem:sub(1,1) == "/" then -- end tag |