87
87
# call pagelink() for internal interwikilinks
88
88
# to make shure they get counted for self.pagelinks
89
89
wikitag, wikiurl, wikitail, wikitag_bad = wikiutil.resolve_wiki(self.request, '%s:%s' % (interwiki, pagename))
90
if wikitag=='Self' or wikitag==self.request.cfg.interwikiname:
90
if wikitag == 'Self' or wikitag == self.request.cfg.interwikiname:
91
91
if wikitail.find('#') > -1:
92
92
wikitail, kw['anchor'] = wikitail.split('#', 1)
93
93
wikitail = wikiutil.url_unquote(wikitail)
129
129
return self.attachment_link(url, text)
132
131
def anchordef(self, name):
135
134
def line_anchordef(self, lineno):
138
def anchorlink(self, on, name='', id=None):
137
def anchorlink(self, on, name='', **kw):
141
140
def line_anchorlink(self, on, lineno=0):
144
def image(self, **kw):
145
""" Take HTML <IMG> tag attributes in `attr`.
143
def image(self, src=None, **kw):
147
Attribute names have to be lowercase!
146
Extra keyword arguments are according to the HTML <img> tag attributes.
147
In particular an 'alt' or 'title' argument should give a description
150
for attr, value in kw.items():
151
if attr=='html_class':
153
attrstr = attrstr + u' %s="%s"' % (attr, wikiutil.escape(value))
154
return u'<img%s>' % attrstr
151
for titleattr in ('title', 'html__title', 'alt', 'html__alt'):
152
if kw.has_key(titleattr):
153
title = kw[titleattr]
156
return '[Image:%s]' % title
156
159
def smiley(self, text):
185
188
def _text(self, text):
186
189
raise NotImplementedError
188
def strong(self, on):
189
raise NotImplementedError
191
def emphasis(self, on):
192
raise NotImplementedError
194
def underline(self, on):
195
raise NotImplementedError
197
def highlight(self, on):
198
raise NotImplementedError
201
raise NotImplementedError
204
raise NotImplementedError
206
def strike(self, on):
191
def strong(self, on, **kw):
192
raise NotImplementedError
194
def emphasis(self, on, **kw):
195
raise NotImplementedError
197
def underline(self, on, **kw):
198
raise NotImplementedError
200
def highlight(self, on, **kw):
201
raise NotImplementedError
203
def sup(self, on, **kw):
204
raise NotImplementedError
206
def sub(self, on, **kw):
207
raise NotImplementedError
209
def strike(self, on, **kw):
207
210
raise NotImplementedError
209
212
def code(self, on, **kw):
210
213
raise NotImplementedError
212
def preformatted(self, on):
215
def preformatted(self, on, **kw):
213
216
self.in_pre = on != 0
218
def small(self, on, **kw):
216
219
raise NotImplementedError
221
def big(self, on, **kw):
219
222
raise NotImplementedError
221
224
# special markup for syntax highlighting #############################
223
def code_area(self, on, code_id, **kwargs):
226
def code_area(self, on, code_id, **kw):
224
227
raise NotImplementedError
226
229
def code_line(self, on):
234
237
def linebreak(self, preformatted=1):
235
238
raise NotImplementedError
237
def paragraph(self, on):
238
self.in_p = (on != 0)
240
def paragraph(self, on, **kw):
240
def rule(self, size=0):
243
def rule(self, size=0, **kw):
241
244
raise NotImplementedError
243
246
def icon(self, type):
246
249
# Lists ##############################################################
248
def number_list(self, on, type=None, start=None):
251
def number_list(self, on, type=None, start=None, **kw):
249
252
raise NotImplementedError
251
def bullet_list(self, on):
254
def bullet_list(self, on, **kw):
252
255
raise NotImplementedError
254
257
def listitem(self, on, **kw):
255
258
raise NotImplementedError
257
def definition_list(self, on):
258
raise NotImplementedError
260
def definition_term(self, on, compact=0):
261
raise NotImplementedError
263
def definition_desc(self, on):
260
def definition_list(self, on, **kw):
261
raise NotImplementedError
263
def definition_term(self, on, compact=0, **kw):
264
raise NotImplementedError
266
def definition_desc(self, on, **kw):
264
267
raise NotImplementedError
266
269
def heading(self, on, depth, **kw):
269
272
# Tables #############################################################
271
def table(self, on, attrs={}):
272
raise NotImplementedError
274
def table_row(self, on, attrs={}):
275
raise NotImplementedError
277
def table_cell(self, on, attrs={}):
274
def table(self, on, attrs={}, **kw):
275
raise NotImplementedError
277
def table_row(self, on, attrs={}, **kw):
278
raise NotImplementedError
280
def table_cell(self, on, attrs={}, **kw):
278
281
raise NotImplementedError
280
283
# Dynamic stuff / Plugins ############################################
284
287
return macro_obj.execute(name, args)
286
289
def _get_bang_args(self, line):
289
292
name, args = line[2:].split(None, 1)
290
293
except ValueError:
296
def processor(self, processor_name, lines, is_parser = 0):
299
def processor(self, processor_name, lines, is_parser=0):
297
300
""" processor_name MUST be valid!
298
301
writes out the result instead of returning it!
306
309
processor_name, "Parser")
307
310
args = self._get_bang_args(lines[0])
308
311
if args is not None:
310
p = parser('\n'.join(lines), self.request, format_args = args)
313
p = parser('\n'.join(lines), self.request, format_args=args)
315
def dynamic_content(self, parser, callback, arg_list = [], arg_dict = {},
316
returns_content = 1):
318
def dynamic_content(self, parser, callback, arg_list=[], arg_dict={},
317
320
content = parser[callback](*arg_list, **arg_dict)
318
321
if returns_content:
323
326
# Other ##############################################################
328
def div(self, on, **kw):
329
""" open/close a blocklevel division """
332
def span(self, on, **kw):
333
""" open/close a inline span """
325
336
def rawHTML(self, markup):
326
337
""" This allows emitting pre-formatted HTML markup, and should be
327
338
used wisely (i.e. very seldom).
343
354
return self.text(f.getvalue())
345
def escapedText(self, on):
356
def escapedText(self, on, **kw):
346
357
""" This allows emitting text as-is, anything special will
347
358
be escaped (at least in HTML, some text output format
348
359
would possibly do nothing here)