Changeset 171 for trunk/markup/input.py
- Timestamp:
- Aug 6, 2006, 8:07:21 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/markup/input.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/markup/input.py
r74 r171 110 110 if pos is None: 111 111 pos = self._getpos() 112 if kind is Stream.TEXT: 113 # Expat reports the *end* of the text event as current position. We 114 # try to fix that up here as much as possible. Unfortunately, the 115 # offset is only valid for single-line text. For multi-line text, 116 # it is apparently not possible to determine at what offset it 117 # started 118 if '\n' in data: 119 lines = data.splitlines() 120 lineno = pos[1] - len(lines) + 1 121 offset = -1 122 else: 123 lineno = pos[1] 124 offset = pos[2] - len(data) 125 pos = (pos[0], lineno, offset) 112 126 self._queue.append((kind, data, pos)) 113 127 114 128 def _getpos_unknown(self): 115 return (self.filename or '<string>', -1, -1)129 return (self.filename, -1, -1) 116 130 117 131 def _getpos(self): 118 return (self.filename or '<string>', self.expat.CurrentLineNumber,132 return (self.filename, self.expat.CurrentLineNumber, 119 133 self.expat.CurrentColumnNumber) 120 134
Note: See TracChangeset
for help on using the changeset viewer.
