Skip to content

Commit

Permalink
add author
Browse files Browse the repository at this point in the history
  • Loading branch information
arkadianriver committed Apr 14, 2016
1 parent c162acf commit fde7e9a
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions compose.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@

Gem.win_platform? ? (system "cls") : (system "clear")

# for getting the name of your editor at the end
# for getting the name of your editor and extension
require 'yaml'
cfgfile = YAML.load_file('_config.yml')

# getting the default author (first in authors file if exist)
authfile = "./_data/authors.yml"
if (File.exist?(authfile))
author = YAML.load_file(authfile).keys[0]
end

# for print stmt buffers
STDOUT.sync = true

#
# Let's start the long interview process
# interview
#

puts <<-eoh
Expand Down Expand Up @@ -134,6 +140,13 @@
excerpt = gets
excerpt.strip!

if type == 't'
print "\nPost author [" + author + "]: "
theauth = gets
theauth.strip!
if theauth == '' then theauth = author end
end

puts <<-eoc
If you want an image in the banner, put the image in the /images folder
Expand Down Expand Up @@ -168,8 +181,8 @@
tslug.downcase!

t = Time.new
tstamp = t.strftime("%Y-%d-%m %H:%M:%S")
dstamp = t.strftime("%Y-%d-%m")
tstamp = t.strftime("%Y-%m-%d %H:%M:%S")
dstamp = t.strftime("%Y-%m-%d")

ext = cfgfile['compose']['extension'] ? cfgfile['compose']['extension'] : 'md'

Expand All @@ -188,6 +201,7 @@
f.puts "---"
f.puts "title: " + title
f.puts "excerpt: " + excerpt
unless (theauth.to_s == '') then f.puts "author: " + theauth end
if (featured) then f.puts "tags: featured" end
if (priority) then f.puts "priority: " + priority end
if (perma) then f.puts "permalink: " + perma end
Expand Down

0 comments on commit fde7e9a

Please sign in to comment.