diff --git a/wikitextparser/_config.py b/wikitextparser/_config.py index 7e549bf..161e686 100644 --- a/wikitextparser/_config.py +++ b/wikitextparser/_config.py @@ -339,3 +339,43 @@ def regex_pattern(words: _Iterable[str]) -> bytes: 'ucfirst', 'urlencode', } + + +# https://github.com/wikimedia/mediawiki/blob/de18cff244e8fab2e1ab2470c3b444e76b305e12/includes/libs/mime/MimeAnalyzer.php#L425 +KNOWN_FILE_EXTENSIONS = { + 'bmp', + 'djvu', + 'gif', + 'iff', + 'jb2', + 'jp2', + 'jpc', + 'jpeg', + 'jpg', + 'jpx', + 'mid', + 'mka', + 'mkv', + 'mp3', + 'oga', + 'ogg', + 'ogv', + 'ogx', + 'opus', + 'pdf', + 'png', + 'psd', + 'spx', + 'stl', + 'svg', + 'swc', + 'swf', + 'tif', + 'tiff', + 'wbmp', + 'webm', + 'webp', + 'wmf', + 'xbm', + 'xcf', +} diff --git a/wikitextparser/_wikitext.py b/wikitextparser/_wikitext.py index a2c24f7..0c11fbd 100644 --- a/wikitextparser/_wikitext.py +++ b/wikitextparser/_wikitext.py @@ -34,6 +34,7 @@ _parsable_tag_extensions, _tag_extensions, regex_pattern, + KNOWN_FILE_EXTENSIONS, ) from ._spans import ( BARE_EXTERNAL_LINK, @@ -154,45 +155,6 @@ WS = '\r\n\t ' -# https://github.com/wikimedia/mediawiki/blob/de18cff244e8fab2e1ab2470c3b444e76b305e12/includes/libs/mime/MimeAnalyzer.php#L425 -KNOWN_FILE_EXTENSIONS = { - 'bmp', - 'djvu', - 'gif', - 'iff', - 'jb2', - 'jp2', - 'jpc', - 'jpeg', - 'jpg', - 'jpx', - 'mid', - 'mka', - 'mkv', - 'mp3', - 'oga', - 'ogg', - 'ogv', - 'ogx', - 'opus', - 'pdf', - 'png', - 'psd', - 'spx', - 'stl', - 'svg', - 'swc', - 'swf', - 'tif', - 'tiff', - 'wbmp', - 'webm', - 'webp', - 'wmf', - 'xbm', - 'xcf', -} - class DeadIndexError(TypeError): pass