Class: JekyllRemotePlantUMLPlugin::Block
- Inherits:
-
Liquid::Block
- Object
- Liquid::Block
- JekyllRemotePlantUMLPlugin::Block
- Includes:
- Utils::Common, Utils::Encode, Utils::PlantUML
- Defined in:
- lib/jekyll_remote_plantuml_plugin/jekyll_remote_plantuml_plugin.rb
Constant Summary collapse
- FORMATS =
%w[png svg].freeze
- CONFIG_OPTIONS =
%i[ provider format save_images_locally cache_dir div_class div_style img_class img_style img_id img_width img_height img_alt ].freeze
- TAG_OPTIONS =
CONFIG_OPTIONS.dup.tap do |h| %i[provider save_images_locally cache_dir].each do |k| h.delete(k) end end.freeze
- DEFAULT_CONFIG_OPTIONS =
{ provider: "http://www.plantuml.com/plantuml", format: "svg", save_images_locally: false, cache_dir: "plantuml", div_class: "plantuml", img_class: "plantuml" }.freeze
- PARAMS_SYNTAX =
/ ([\w-]+)\s*=\s* (?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w.-]+)) /x.freeze
Instance Method Summary collapse
-
#initialize(tag_name, markup, _) ⇒ Block
constructor
A new instance of Block.
- #render(context) ⇒ Object
Methods included from Utils::Encode
#append3bytes, #encode, #encode64, #encode6bit
Methods included from Utils::PlantUML
#expand_path, #generate_url, #join_paths
Methods included from Utils::Common
Constructor Details
#initialize(tag_name, markup, _) ⇒ Block
Returns a new instance of Block.
37 38 39 40 |
# File 'lib/jekyll_remote_plantuml_plugin/jekyll_remote_plantuml_plugin.rb', line 37 def initialize(tag_name, markup, _) super @markup = markup.strip end |
Instance Method Details
#render(context) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/jekyll_remote_plantuml_plugin/jekyll_remote_plantuml_plugin.rb', line 42 def render(context) content = super(context).strip = (context) check_format([:format]) url = generate_url([:provider], encode(content), [:format]) img_src_attr = [:save_images_locally] ? img_local_src(context, content, url, ) : url prepare_html(img_src_attr, ) end |