Sha256: 3788200c5a95b65876d2742108c60f1e08859234fb9cc03c9e1c9b5c15101ea6
Contents?: true
Size: 1 KB
Versions: 3
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true require "reverse_adoc/converters/figure" module Stepmod module Utils module Converters class Figure < ReverseAdoc::Converters::Figure def self.pattern(state, id) if state[:schema_and_entity].nil? raise StandardError.new("[figure]: no state given, #{id}") end schema = state[:schema_and_entity].split(".").first "figure-#{schema}-#{id}" end def convert(node, state = {}) # If we want to skip this node return "" if state[:no_notes_examples] # Set ID to "figure-id" in case of conflicts node["id"] = if node["id"] self.class.pattern(state, node["id"]) else self.class.pattern(state, node["number"]) end super(node, state) end end # This replaces the converter ReverseAdoc::Converters.register :figure, Figure.new end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
stepmod-utils-0.6.1 | lib/stepmod/utils/converters/figure.rb |
stepmod-utils-0.6.0 | lib/stepmod/utils/converters/figure.rb |
stepmod-utils-0.5.0 | lib/stepmod/utils/converters/figure.rb |