diff options
-rw-r--r-- | controllers/cartridges.rb | 2 | ||||
-rw-r--r-- | logic/cartridge/parser.rb | 6 | ||||
-rw-r--r-- | ports/dsl/nano-bots/cartridges.rb | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/controllers/cartridges.rb b/controllers/cartridges.rb index 7215a99..ca1e8f0 100644 --- a/controllers/cartridges.rb +++ b/controllers/cartridges.rb @@ -27,7 +27,7 @@ module NanoBot cartridges = [] files.values.uniq.map do |file| - cartridge = load_cartridge(file[:path]).merge( + cartridge = load(file[:path]).merge( { system: { id: file[:path].to_s.sub( diff --git a/logic/cartridge/parser.rb b/logic/cartridge/parser.rb index 440c929..308ca36 100644 --- a/logic/cartridge/parser.rb +++ b/logic/cartridge/parser.rb @@ -10,7 +10,7 @@ module NanoBot module Cartridge module Parser def self.parse(raw, format:) - normalized = format.to_s.downcase.gsub('.', '') + normalized = format.to_s.downcase.gsub('.', '').strip if %w[yml yaml].include?(normalized) yaml(raw) @@ -32,7 +32,9 @@ module NanoBot end class Renderer < Redcarpet::Render::Base - def block_code(code, _language) + def block_code(code, language) + return nil unless %w[yml yaml].include?(language.to_s.downcase.strip) + "\n#{code}\n" end end diff --git a/ports/dsl/nano-bots/cartridges.rb b/ports/dsl/nano-bots/cartridges.rb index 7c0f05b..40ad14d 100644 --- a/ports/dsl/nano-bots/cartridges.rb +++ b/ports/dsl/nano-bots/cartridges.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative '../../controllers/cartridges' +require_relative '../../../controllers/cartridges' module NanoBot module Cartridges |