def test_transform_token(self): # def doi_id_url_transform_token(tkn,fn): # return doi_id_url_transform_token(fn, tkn) assert_that(do_dois_id_urls_to_tags(None, None, ''), equal_to('')) assert_that( do_dois_id_urls_to_tags(None, None, 'it is fine, chapter 234 see<xxyx,234>'), equal_to(Markup(escape('it is fine, chapter 234 see<xxyx,234>')))) assert_that(do_dois_id_urls_to_tags(None, None, 'http://arxiv.org'), equal_to('<a href="http://arxiv.org">this http URL</a>')) assert_that( do_dois_id_urls_to_tags( None, None, 'Stuff in the front http://arxiv.org other stuff'), equal_to( 'Stuff in the front <a href="http://arxiv.org">this http URL</a> other stuff' )) assert_that(do_dois_id_urls_to_tags(None, None, '.http://arxiv.org.'), equal_to('.<a href="http://arxiv.org">this http URL</a>.')) assert_that( do_dois_id_urls_to_tags(None, None, '"http://arxiv.org"'), equal_to( Markup( '"<a href="http://arxiv.org">this http URL</a>"')))
def arxiv_urlize(txt): return do_dois_id_urls_to_tags(_id_to_url, None, txt)
def contextualized_doi_id_url_filter(text: str) -> str: return do_dois_id_urls_to_tags(_id_to_url, ct_url_for, text)
def do_arxiv_urlize(txt): return do_dois_id_urls_to_tags(None, None, txt)
def do_arxiv_urlize(txt): return do_dois_id_urls_to_tags(lambda x: x, lambda x: x, txt)