Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions botogram/syntaxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
r"_(.*)_|"
r"\[(.*)\]\((.*)\)|"
r"`(.*)`|"
r"```(.*)```"
r"```(.*)```|"
r"~(.*)~"
r").*")

_html_re = re.compile(r".*("
Expand All @@ -38,7 +39,12 @@
r"<em>(.*)<\/em>|"
r"<a\shref=\"(.*)\">(.*)<\/a>|"
r"<code>(.*)<\/code>|"
r"<pre>(.*)<\/pre>"
r"<pre>(.*)<\/pre>|"
r"<u>(.*)<\/u>|"
r"<ins>(.*)<\/ins>|"
r"<s>(.*)<\/s>|"
r"<strike>(.*)<\/strike>|"
r"<del>(.*)<\/del>"
r").*")


Expand Down
8 changes: 7 additions & 1 deletion docs/changelog/0.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,15 @@ New features
* New argument ``vcard`` in :py:meth:`botogram.User.send_contact`
* New argument ``vcard`` in :py:meth:`botogram.Message.reply_with_contact`
* New attribute :py:attr:`Contact.vcard`

* Added automatic type conversion for command arguments

Changes
-------

* added support for new html and markdown tags to the syntax detector


Bug fixes
---------

Expand Down
5 changes: 3 additions & 2 deletions tests/test_syntaxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_is_markdown():
assert not botogram.syntaxes.is_markdown("not markdown, sorry!")
assert not botogram.syntaxes.is_markdown("*a [wonderfully](broken syntax`")

for delimiter in "*", "_", "`", "```":
for delimiter in "*", "_", "`", "```", "~":
assert botogram.syntaxes.is_markdown(delimiter+"a"+delimiter)
assert botogram.syntaxes.is_markdown("!"+delimiter+"a"+delimiter+"!")
assert botogram.syntaxes.is_markdown("a\n"+delimiter+"a"+delimiter)
Expand All @@ -47,7 +47,8 @@ def test_is_html():
assert not botogram.syntaxes.is_html("not HTML, sorry!")
assert not botogram.syntaxes.is_html("<a some </really> <b>roken html</i>")

for tag in "b", "strong", "i", "em", "pre", "code":
for tag in "b", "strong", "i", "em", "code", "pre", "u", "ins", "s",\
"strike", "del":
assert botogram.syntaxes.is_html("<"+tag+">a</"+tag+">")
assert botogram.syntaxes.is_html("!<"+tag+">a</"+tag+">!")
assert botogram.syntaxes.is_html("a\n<"+tag+">a</"+tag+">")
Expand Down