Add const Repubmark::FORMATS
This commit is contained in:
parent
be5ce87dab
commit
8a6d2ca90e
3 changed files with 11 additions and 9 deletions
|
@ -8,10 +8,10 @@ require 'bundler/setup'
|
|||
|
||||
require 'repubmark'
|
||||
|
||||
FORMATS = %w[word_count html gemtext].freeze
|
||||
|
||||
format = String(ARGV[0]).freeze
|
||||
raise "Invalid format: #{format.inspect}" unless FORMATS.include? format
|
||||
format = String(ARGV[0]).to_sym
|
||||
unless Repubmark::FORMATS.include? format
|
||||
raise "Invalid format: #{format.inspect}"
|
||||
end
|
||||
|
||||
template = $stdin.read.freeze
|
||||
|
||||
|
@ -37,9 +37,9 @@ context.instance_eval template, __FILE__, __LINE__
|
|||
|
||||
output =
|
||||
case format
|
||||
when 'word_count' then $article.word_count
|
||||
when 'html' then $article.to_html
|
||||
when 'gemtext' then $article.to_gemtext
|
||||
when :word_count then $article.word_count
|
||||
when :html then $article.to_html
|
||||
when :gemtext then $article.to_gemtext
|
||||
end.to_s.strip
|
||||
|
||||
puts output unless output.empty?
|
||||
|
|
|
@ -54,3 +54,7 @@ require_relative 'repubmark/elems/section'
|
|||
require_relative 'repubmark/elems/special'
|
||||
require_relative 'repubmark/elems/text'
|
||||
require_relative 'repubmark/elems/link'
|
||||
|
||||
module Repubmark
|
||||
FORMATS = %i[gemtext html].freeze
|
||||
end
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
module Repubmark
|
||||
module Elems
|
||||
class CustomLogue < Base
|
||||
FORMATS = %i[html gemtext].freeze
|
||||
|
||||
parents :Article
|
||||
|
||||
def initialize(parent)
|
||||
|
|
Loading…
Reference in a new issue