MCPcopy Create free account
hub / github.com/webpy/webpy / read_text

Method read_text

web/template.py:232–243  ·  view source on GitHub ↗

r"""Reads a text node from the given text. >>> read_text = Parser().read_text >>> read_text('hello $name') (t'hello ', '$name')

(self, text)

Source from the content-addressed store, hash-verified

230 return self.read_text(text)
231
232 def read_text(self, text):
233 r"""Reads a text node from the given text.
234
235 >>> read_text = Parser().read_text
236 >>> read_text('hello $name')
237 (t'hello ', '$name')
238 """
239 index = text.find("$")
240 if index < 0:
241 return TextNode(text), ""
242 else:
243 return TextNode(text[:index]), text[index:]
244
245 def read_keyword(self, text):
246 line, text = splitline(text)

Callers 1

read_nodeMethod · 0.95

Calls 1

TextNodeClass · 0.85

Tested by

no test coverage detected