Class: Rabbit::Parser::Wiki::RabbitOutput::BlockPlugin
- Inherits:
-
Object
- Object
- Rabbit::Parser::Wiki::RabbitOutput::BlockPlugin
show all
- Includes:
- Element, GetText
- Defined in:
- lib/rabbit/parser/wiki/output.rb
Constant Summary
Constants included
from GetText
GetText::DOMAIN
Instance Method Summary
collapse
Methods included from GetText
N_, _, bindtextdomain, locale=
Constructor Details
Returns a new instance of BlockPlugin.
424
425
426
|
# File 'lib/rabbit/parser/wiki/output.rb', line 424
def initialize(output)
@output = output
end
|
Instance Method Details
#blockdiag(source, props = {}) ⇒ Object
#coderay(lang, source) ⇒ Object
496
497
498
499
|
# File 'lib/rabbit/parser/wiki/output.rb', line 496
def coderay(lang, source)
logger = @output.canvas.logger
Ext::CodeRay.highlight(lang, source, logger)
end
|
#emacs(source, mode_line = nil) ⇒ Object
501
502
503
504
|
# File 'lib/rabbit/parser/wiki/output.rb', line 501
def emacs(source, mode_line=nil)
logger = @output.canvas.logger
Ext::Emacs.highlight(source, logger, mode_line)
end
|
#enscript(lang, source) ⇒ Object
449
450
451
452
453
454
455
456
|
# File 'lib/rabbit/parser/wiki/output.rb', line 449
def enscript(lang, source)
logger = @output.canvas.logger
if Ext::Enscript.check_availability(lang, logger)
Ext::Enscript.highlight(lang, source, logger)
else
nil
end
end
|
#image(source, props = {}) ⇒ Object
Also known as:
img
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
|
# File 'lib/rabbit/parser/wiki/output.rb', line 428
def image(source, props={})
if props[:align].to_s == "right"
body = @output.current_body
if body["background-image"]
raise ParseError,
_("multiple {{image, 'XXX.png', :align => :right}} " + \
"isn't supported.")
end
body["background-image"] = source
props.each do |name, value|
name = name.to_s.gsub(/_/, '-')
value = value.to_s if name == "align"
body["background-image-#{name}"] = value
end
:no_element
else
Ext::Image.make_image(@output.canvas, source, props)
end
end
|
#LaTeX(source, props = {}) ⇒ Object
Also known as:
latex
#mimeTeX(source, props = {}) ⇒ Object
Also known as:
mimetex
#tag(name, value = nil) ⇒ Object
506
507
508
509
510
511
512
|
# File 'lib/rabbit/parser/wiki/output.rb', line 506
def tag(name, value=nil)
if value
CustomTag.new(name, @output.text(value))
else
CustomTag.new(name)
end
end
|