Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits: 9601fc16 by Mark Sapiro at 2021-05-07T17:25:06-07:00 Added example of wrap inhibiting in templates. - - - - - 538e3756 by Mark Sapiro at 2021-05-08T01:07:09+00:00 Merge branch 'wrap' into 'master' Added example of wrap inhibiting in templates. See merge request mailman/mailman!854 - - - - - 1 changed file: - src/mailman/rest/docs/templates.rst Changes: ===================================== src/mailman/rest/docs/templates.rst ===================================== @@ -170,7 +170,43 @@ Line wrapping Many, but not all, templates have their text wrapped at column 70. This can result in a nicer looking result but can also break long URLs. To avoid this, you can indent any lines you don't want wrapped by one or more spaces which -will inhibit wrapping of those lines. +will inhibit wrapping of those lines. Here are some examples. + + >>> text = """Here's some sample text + ... that should be wrapped and filled to make a pretty looking paragraph of text with no excessively short + ... or long lines, but it also contains a long url. + ... + ... https://www.example.com/mailman3/lists/mailman-users.mailman3.org/members/options/u...@example.org?role=member + ... + ... which shouldn't be wrapped. + ... """ + +The normal template wrapping process produces + + >>> from mailman.utilities.string import wrap + >>> print(wrap(text)) + Here's some sample text that should be wrapped and filled to make a + pretty looking paragraph of text with no excessively short or long + lines, but it also contains a long url. + <BLANKLINE> + https://www.example.com/mailman3/lists/mailman-users.mailman3.org/memb + ers/options/u...@example.org?role=member + <BLANKLINE> + which shouldn't be wrapped. + +We see the URL is wrapped and we don't want that so we insert a leading +blank. + + >>> import re + >>> text = re.sub('\nhttps', '\n https', text) + >>> print(wrap(text)) + Here's some sample text that should be wrapped and filled to make a + pretty looking paragraph of text with no excessively short or long + lines, but it also contains a long url. + <BLANKLINE> + https://www.example.com/mailman3/lists/mailman-users.mailman3.org/members/options/u...@example.org?role=member + <BLANKLINE> + which shouldn't be wrapped. URL placeholders View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/c37a620e332c7f7cf690c6dfa40b9fa12eb8f73d...538e3756f935c70be8f15aad827314741f15fd49 -- View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/c37a620e332c7f7cf690c6dfa40b9fa12eb8f73d...538e3756f935c70be8f15aad827314741f15fd49 You're receiving this email because of your account on gitlab.com.
_______________________________________________ Mailman-checkins mailing list -- mailman-checkins@python.org To unsubscribe send an email to mailman-checkins-le...@python.org https://mail.python.org/mailman3/lists/mailman-checkins.python.org/ Member address: arch...@jab.org