diff options
author | David Lord <davidism@gmail.com> | 2020-04-12 09:14:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-12 09:14:30 -0700 |
commit | ce2e28b599013dbc596e84d58647f4abafc83901 (patch) | |
tree | 69aaea69f1b6a756b2b89ec5e09b0c7b3472ff2d | |
parent | e7dba622cf5efe5a2c5ff98990ce4f72f50e70b2 (diff) | |
download | markupsafe-ce2e28b599013dbc596e84d58647f4abafc83901.tar.gz |
remove u prefix, split up example sections
-rw-r--r-- | README.rst | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -26,18 +26,22 @@ Examples .. code-block:: pycon >>> from markupsafe import Markup, escape + >>> # escape replaces special characters and wraps in Markup >>> escape("<script>alert(document.cookie);</script>") - Markup(u'<script>alert(document.cookie);</script>') + Markup('<script>alert(document.cookie);</script>') + >>> # wrap in Markup to mark text "safe" and prevent escaping >>> Markup("<strong>Hello</strong>") Markup('<strong>hello</strong>') + >>> escape(Markup("<strong>Hello</strong>")) Markup('<strong>hello</strong>') + >>> # Markup is a str subclass >>> # methods and operators escape their arguments - >>> template = Markup("Hello <em>%s</em>") - >>> template % ('"World"',) + >>> template = Markup("Hello <em>{name}</em>") + >>> template.format(name='"World"') Markup('Hello <em>"World"</em>') |