Skip to content

Commit fb4feb1

Browse files
blackjidparkr
authored andcommitted
move type and layout values to contants
1 parent 315a726 commit fb4feb1

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

lib/jekyll/commands/draft.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ def self.init_with_program(prog)
1919
def self.process(args = [], options = {})
2020
raise ArgumentError.new('You must specify a name.') if args.empty?
2121

22+
<<<<<<< HEAD
2223
type = options["type"] || "md"
2324
layout = options["layout"] || "post"
25+
=======
26+
type = options["type"].nil? ? Jekyll::Compose::DEFAULT_TYPE : options["type"]
27+
layout = options["layout"].nil? ? Jekyll::Compose::DEFAULT_LAYOUT : options["layout"]
28+
>>>>>>> move type and layout values to contants
2429

2530
title = args.shift
2631
name = title.gsub(' ', '-').downcase
@@ -38,7 +43,7 @@ def self.process(args = [], options = {})
3843
# Internal: Gets the filename of the draft to be created
3944
#
4045
# Returns the filename of the draft, as a String
41-
def self.draft_name(name, ext='md')
46+
def self.draft_name(name, ext=Jekyll::Compose::DEFAULT_TYPE)
4247
"_drafts/#{name}.#{ext}"
4348
end
4449

lib/jekyll/commands/post.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def self.init_with_program(prog)
2020
def self.process(args = [], options = {})
2121
raise ArgumentError.new('You must specify a name.') if args.empty?
2222

23-
type = options["type"].nil? ? "md" : options["type"]
24-
layout = options["layout"].nil? ? "post" : options["layout"]
23+
type = options["type"].nil? ? Jekyll::Compose::DEFAULT_TYPE : options["type"]
24+
layout = options["layout"].nil? ? Jekyll::Compose::DEFAULT_LAYOUT : options["layout"]
2525

2626
date = options["date"].nil? ? Time.now : DateTime.parse(options["date"])
2727

lib/jekyll/compose.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
require "jekyll/compose/version"
2+
3+
module Jekyll
4+
module Compose
5+
DEFAULT_TYPE = "md"
6+
DEFAULT_LAYOUT = "post"
7+
end
8+
end
9+
10+
require "jekyll/commands/draft"
11+
require "jekyll/commands/post"
12+
require "jekyll/commands/publish"

0 commit comments

Comments
 (0)