Class: Rabbit::Parser::Wiki::RabbitOutput::BlockPlugin
- Inherits:
-
Object
- Object
- Rabbit::Parser::Wiki::RabbitOutput::BlockPlugin
- Defined in:
- lib/rabbit/parser/wiki/output.rb
Constant Summary
Constants included from GetText
Instance Method Summary collapse
- #aafigure(source, props = {}) ⇒ Object
- #blockdiag(source, props = {}) ⇒ Object
- #coderay(lang, source) ⇒ Object
- #emacs(source, mode_line = nil) ⇒ Object
- #enscript(lang, source) ⇒ Object
- #image(source, props = {}) ⇒ Object (also: #img)
-
#initialize(output) ⇒ BlockPlugin
constructor
A new instance of BlockPlugin.
- #LaTeX(source, props = {}) ⇒ Object (also: #latex)
- #mimeTeX(source, props = {}) ⇒ Object (also: #mimetex)
- #rouge(lang, source) ⇒ Object
- #tag(name, value = nil) ⇒ Object
Methods included from GetText
Constructor Details
#initialize(output) ⇒ BlockPlugin
Returns a new instance of BlockPlugin.
456 457 458 |
# File 'lib/rabbit/parser/wiki/output.rb', line 456 def initialize(output) @output = output end |
Instance Method Details
#aafigure(source, props = {}) ⇒ Object
510 511 512 513 514 515 516 517 |
# File 'lib/rabbit/parser/wiki/output.rb', line 510 def aafigure(source, props={}) args = [@output.canvas, source] Ext::Image.make_image_from_file(*args) do |src_file| props = Utils.stringify_hash_key(props) args = [src_file.path, props, @output.canvas] [Ext::AAFigure.make_image(*args), props] end end |
#blockdiag(source, props = {}) ⇒ Object
519 520 521 522 523 524 525 526 |
# File 'lib/rabbit/parser/wiki/output.rb', line 519 def blockdiag(source, props={}) args = [@output.canvas, source] Ext::Image.make_image_from_file(*args) do |src_file| props = Utils.stringify_hash_key(props) args = [src_file.path, props, @output.canvas] [Ext::BlockDiag.make_image(*args), props] end end |
#coderay(lang, source) ⇒ Object
528 529 530 531 |
# File 'lib/rabbit/parser/wiki/output.rb', line 528 def coderay(lang, source) logger = @output.canvas.logger Ext::CodeRay.highlight(lang, source, logger) end |
#emacs(source, mode_line = nil) ⇒ Object
533 534 535 536 |
# File 'lib/rabbit/parser/wiki/output.rb', line 533 def emacs(source, mode_line=nil) logger = @output.canvas.logger Ext::Emacs.highlight(source, logger, mode_line) end |
#enscript(lang, source) ⇒ Object
481 482 483 484 485 486 487 488 |
# File 'lib/rabbit/parser/wiki/output.rb', line 481 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
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
# File 'lib/rabbit/parser/wiki/output.rb', line 460 def image(source, props={}) if props[:align].to_s == "right" body = @output.current_body if body["background-image"] raise ParseError, _("multiple {{image(..., :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
490 491 492 493 494 495 496 497 |
# File 'lib/rabbit/parser/wiki/output.rb', line 490 def LaTeX(source, props={}) args = [@output.canvas, source] Ext::Image.make_image_from_file(*args) do |src_file| props = Utils.stringify_hash_key(props) args = [src_file.path, props, @output.canvas] [Ext::TeX.make_image_by_LaTeX(*args), props] end end |
#mimeTeX(source, props = {}) ⇒ Object Also known as: mimetex
500 501 502 503 504 505 506 507 |
# File 'lib/rabbit/parser/wiki/output.rb', line 500 def mimeTeX(source, props={}) args = [@output.canvas, source] Ext::Image.make_image_from_file(*args) do |src_file| props = Utils.stringify_hash_key(props) args = [src_file.path, props, @output.canvas] [Ext::TeX.make_image_by_mimeTeX(*args), props] end end |