Module: Webgen::Tag::Tikz
- Defined in:
- lib/webgen/tag/tikz.rb
Overview
This tag allows you to create and use complex graphics using the PGF/TikZ library of LaTeX. It uses Webgen::ContentProcessor::Tikz for doing the hard work.
Class Method Summary collapse
-
.call(tag, body, context) ⇒ Object
Create a graphic (i.e. an HTML img tag) from the commands in the body of the tag.
Class Method Details
.call(tag, body, context) ⇒ Object
Create a graphic (i.e. an HTML img tag) from the commands in the body of the tag.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/webgen/tag/tikz.rb', line 13 def self.call(tag, body, context) path = Webgen::Path.append(context.ref_node.parent.alcn, context[:config]['tag.tikz.path']) path = Webgen::Path.new(path) (path, context) node = context.website.ext.path_handler.create_secondary_nodes(path, body, context.ref_node.alcn).first attrs = {'alt' => ''}.merge(context[:config]['tag.tikz.img_attr']).collect do |name, value| "#{name.to_s}=\"#{value}\"" end.sort.unshift('').join(' ') "<img src=\"#{context.dest_node.route_to(node)}\"#{attrs} />" end |