1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
//! Wiki text parsing configurations for Mediawiki sites and languages.c
//!
//! These are the currently supported Mediawiki websites and languages:
//! * Wikipedia
//!     * English
//! * Simple English Wikipedia
//!
//! ## Example
//! ```rust
//! use wikidump::{config, Parser};
//! let parser = Parser::new()
//!     .use_config(config::wikipedia::english());
//!```

/// Configurations for [Wikipedia, the free encyclopedia](https://www.wikipedia.org/).
pub mod wikipedia {
    use parse_wiki_text::ConfigurationSource;

    /// Configuration for the English Wikipedia.
    pub fn english<'c>() -> ConfigurationSource<'c> {
        ConfigurationSource {
            category_namespaces: &["category"],
            extension_tags: &[
                "categorytree",
                "ce",
                "charinsert",
                "chem",
                "gallery",
                "graph",
                "hiero",
                "imagemap",
                "indicator",
                "inputbox",
                "mapframe",
                "maplink",
                "math",
                "nowiki",
                "poem",
                "pre",
                "ref",
                "references",
                "score",
                "section",
                "source",
                "syntaxhighlight",
                "templatedata",
                "templatestyles",
                "timeline",
            ],
            file_namespaces: &["file", "image"],
            link_trail: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
            magic_words: &[
                "DISAMBIG",
                "EXPECTUNUSEDCATEGORY",
                "FORCETOC",
                "HIDDENCAT",
                "INDEX",
                "NEWSECTIONLINK",
                "NOCC",
                "NOCOLLABORATIONHUBTOC",
                "NOCONTENTCONVERT",
                "NOEDITSECTION",
                "NOGALLERY",
                "NOGLOBAL",
                "NOINDEX",
                "NONEWSECTIONLINK",
                "NOTC",
                "NOTITLECONVERT",
                "NOTOC",
                "STATICREDIRECT",
                "TOC",
            ],
            protocols: &[
                "//",
                "bitcoin:",
                "ftp://",
                "ftps://",
                "geo:",
                "git://",
                "gopher://",
                "http://",
                "https://",
                "irc://",
                "ircs://",
                "magnet:",
                "mailto:",
                "mms://",
                "news:",
                "nntp://",
                "redis://",
                "sftp://",
                "sip:",
                "sips:",
                "sms:",
                "ssh://",
                "svn://",
                "tel:",
                "telnet://",
                "urn:",
                "worldwind://",
                "xmpp:",
            ],
            redirect_magic_words: &["REDIRECT"],
        }
    }

    /// Configuration for Simple English Wikipedia. At the moment, this is
    /// exactly the same as the English Wikipedia configuration.
    pub fn simple_english<'c>() -> ConfigurationSource<'c> {
        english()
    }
}