/[ascend]/trunk/tools/mediawiki/html2mediawiki/ascend_family.py
ViewVC logotype

Contents of /trunk/tools/mediawiki/html2mediawiki/ascend_family.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2198 - (show annotations) (download) (as text)
Thu May 13 14:21:03 2010 UTC (12 years, 3 months ago) by jpye
File MIME type: text/x-python
File size: 6650 byte(s)
Upload
1 # -*- coding: utf-8 -*- # REQUIRED
2 import config, family, urllib # REQUIRED
3
4 class Family(family.Family): # REQUIRED
5 def __init__(self): # REQUIRED
6 family.Family.__init__(self) # REQUIRED
7 self.name = 'ascend' # REQUIRED; replace with actual name
8
9 self.langs = { # REQUIRED
10 'en': 'ascend.cheme.cmu.edu', # Include one line for each wiki in family
11 }
12
13 # Translation used on all wikis for the different namespaces.
14 # Most namespaces are inherited from family.Family.
15 # Check the family.py file (in main directory) to see the standard
16 # namespace translations for each known language.
17
18 # You only need to enter translations that differ from the default.
19 # There are two ways of entering namespace translations.
20 # 1. If you only need to change the translation of a particular
21 # namespace for one or two languages, use this format (example):
22 self.namespaces[2]['en'] = u'User'
23 self.namespaces[3]['en'] = u'User talk'
24
25 # 2. If you need to change the translation for many languages
26 # for the same namespace number, use this format (this is common
27 # for namespaces 4 and 5, because these are usually given a
28 # unique name for each wiki) (example):
29 self.namespaces[4] = {
30 '_default': [u'ASCEND', self.namespaces[4]['_default']], # REQUIRED
31 # ETC.
32 }
33
34 # Wikimedia wikis all use "bodyContent" as the id of the <div>
35 # element that contains the actual page content; change this for
36 # wikis that use something else (e.g., mozilla family)
37 self.content_id = "bodyContent"
38
39 # On most wikis page names must start with a capital letter, but some
40 # languages don't use this. This should be a list of languages that
41 # _don't_ require the first letter to be capitalized. Example:
42 # self.nocapitalize = ['foo', 'bar']
43
44 # SETTINGS FOR WIKIS THAT USE DISAMBIGUATION PAGES:
45
46 # Disambiguation template names in different languages; each value
47 # must be a list, even if there is only one entry. Example:
48 # self.disambiguationTemplates['en'] = ['disambig', 'disambiguation']
49
50 # The name of the category containing disambiguation
51 # pages for the various languages. Only one category per language,
52 # and without the namespace, so add things like:
53 # self.disambcatname['en'] = "Disambiguation"
54
55 # SETTINGS FOR WIKIS THAT USE INTERLANGUAGE LINKS:
56
57 # attop is a list of languages that prefer to have the interwiki
58 # links at the top of the page. Example:
59 # self.interwiki_attop = ['de', 'xz']
60
61 # on_one_line is a list of languages that want the interwiki links
62 # one-after-another on a single line. Example:
63 # self.interwiki_on_one_line = ['aa', 'cc']
64
65 # String used as separator between interwiki links and the text
66 self.interwiki_text_separator = '\r\n\r\n'
67
68 # Which languages have a special order for putting interlanguage links,
69 # and what order is it? If a language is not in interwiki_putfirst,
70 # alphabetical order on language code is used. For languages that are in
71 # interwiki_putfirst, interwiki_putfirst is checked first, and
72 # languages are put in the order given there. All other languages are put
73 # after those, in code-alphabetical order.
74 self.interwiki_putfirst = {}
75
76 # Languages in interwiki_putfirst_doubled should have a number plus a list
77 # of languages. If there are at least the number of interwiki links, all
78 # languages in the list should be placed at the front as well as in the
79 # normal list.
80 self.interwiki_putfirst_doubled = {}
81
82 # Some families, e. g. commons and meta, are not multilingual and
83 # forward interlanguage links to another family (wikipedia).
84 # These families can set this variable to the name of the target
85 # family.
86 self.interwiki_forward = None
87
88 # Which language codes no longer exist and by which language code
89 # should they be replaced. If for example the language with code xx:
90 # has been replaced by code yy:, add {'xx':'yy'} to obsolete.
91 # If all links to language xx: should be removed, add {'xx': None}.
92 self.obsolete = {}
93
94 # SETTINGS FOR CATEGORY LINKS:
95
96 # Languages that want the category links at the top of the page
97 self.category_attop = []
98
99 # languages that want the category links
100 # one-after-another on a single line
101 self.category_on_one_line = []
102
103 # String used as separator between category links and the text
104 self.category_text_separator = '\r\n\r\n'
105
106 # When both at the bottom should categories come after interwikilinks?
107 self.categories_last = []
108
109 # SETTINGS FOR LDAP AUTHENTICATION
110 # If your wiki uses:
111 # http://www.mediawiki.org/wiki/Extension:LDAP_Authentication.
112 # then uncomment this line and define the user's domain required
113 # at login.
114 #self.ldapDomain = 'domain here'
115
116 def protocol(self, code):
117 """
118 Can be overridden to return 'https'. Other protocols are not supported.
119 """
120 return 'http'
121
122 def scriptpath(self, code):
123 """The prefix used to locate scripts on this wiki.
124
125 This is the value displayed when you enter {{SCRIPTPATH}} on a
126 wiki page (often displayed at [[Help:Variables]] if the wiki has
127 copied the master help page correctly).
128
129 The default value is the one used on Wikimedia Foundation wikis,
130 but needs to be overridden in the family file for any wiki that
131 uses a different value.
132
133 """
134 return ''
135
136 # IMPORTANT: if your wiki does not support the api.php interface,
137 # you must uncomment the second line of this method:
138 def apipath(self, code):
139 # raise NotImplementedError, "%s wiki family does not support api.php" % self.name
140 return '%s/api.php' % self.scriptpath(code)
141
142 # Which version of MediaWiki is used? REQUIRED
143 def version(self, code):
144 # Replace with the actual version being run on your wiki
145 return '1.13alpha'
146
147 def code2encoding(self, code):
148 """Return the encoding for a specific language wiki"""
149 # Most wikis nowadays use UTF-8, but change this if yours uses
150 # a different encoding
151 return 'utf-8'
152

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22