Opened 2 years ago

Closed 2 years ago

#929 closed defect (duplicate)

WebComment: better washing of list and links for email

Reported by: jcaffaro Owned by: jcaffaro
Priority: major Milestone:
Component: WebComment Version:
Keywords: Cc:

Description

Ticket #764 was trying to introduce nicer handling of lists and links markup in email notifications but some issues remain (or have been introduced).

For example when processing a list, one gets:

from invenio.webcomment_washer import *
washer = EmailWasher()

a = '<ol><li>foo</li><li>bar</li></ol>'
print washer.wash(a)
1. foo2. bar

while we would expect the following output:

1. foo
2. bar

It works however if '\n' are already inserted into the source string:

b = '''<ol><li>foo</li>
<li>bar</li></ol>'''
print washer.wash(b)
1. foo
2. bar

Also when dealing with links:

c = '<a href="http://foo">bar</a>'
print washer.wash(c)
<http://foo>bar

we would expect instead the following output:

<http://foo>(bar)

It works however nicely when the the link label is identified as a URL:

d = '<a href="http://foo">http://foo</a>'
print washer.wash(d)
<http://foo>

e = '<a href="http://foo">http://bar</a>'
print washer.wash(e)
<http://foo>(http://bar)

Fix the handling of such tags and add the above example as unit tests (as well as other unit tests).

Change History (4)

comment:1 Changed 2 years ago by jcaffaro

  • Owner set to jcaffaro
  • Status changed from new to assigned

comment:2 Changed 2 years ago by jcaffaro

  • Status changed from assigned to in_work

comment:3 Changed 2 years ago by jcaffaro

  • Status changed from in_work to in_merge

comment:4 Changed 2 years ago by jcaffaro

  • Resolution set to duplicate
  • Status changed from in_merge to closed

Duplicate of #845

Note: See TracTickets for help on using tickets.