return slugify_hyphens_rx.sub('-', slugify_nonalnum_rx.sub('', text.lower()).strip())
def add_wbr(text: str) -> str:
+ # Stuff contains HTML code, do not touch!
+ if '<' in text: return text
+
if '::' in text: # C++ names
return text.replace('::', '::<wbr/>')
elif '_' in text: # VERY_LONG_UPPER_CASE macro names
self.assertEqual(add_wbr('CORRADE_TEST_MAIN()'), 'CORRADE_<wbr/>TEST_<wbr/>MAIN()')
self.assertEqual(add_wbr('http://magnum.graphics/showcase/'), 'http:/<wbr/>/<wbr/>magnum.graphics/<wbr/>showcase/<wbr/>')
self.assertEqual(add_wbr('<strong>a</strong>'), '<strong>a</strong>')
-
-if __name__ == '__main__':
- unittest.main()