require 'strings2conf/version'
require 'json'
require 'erb'
include ERB::Util
module Strings2conf
class Util
DEFAULT_CODE_BLOCK_PARAMETERS = {
linenumbers: true,
theme: 'RDark',
}.freeze
def self.code_block(code, params = {})
ac_params = DEFAULT_CODE_BLOCK_PARAMETERS
.merge(params)
.map { |name, value|
" #{t}
" }.join(',')} ] "
else
''
end
defaults = if instance.key?('defaults') and instance['defaults'].key?(name)
" (defaults to: #{h instance['defaults'][name]}
) "
else
''
end
<<~HTML
#{name}
#{types}#{defaults}#{h param['text']}