hackademic 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/hackademic.gemspec +1 -1
- data/lib/hackademic.rb +78 -61
- data/lib/hackademy/compile.rb +149 -0
- data/lib/hackademy/hackademy.rb +27 -28
- data/lib/hackademy/new.rb +89 -0
- data/templates/Config.yml.tt +11 -0
- data/templates/apa.csl +443 -0
- data/templates/pandoc-word-template.docx +0 -0
- data/templates/xelatex.template +0 -0
- metadata +6 -2
- data/lib/hackademy/setup.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 003e23e04013e7abdb74cedeb8014af0815e3159
|
4
|
+
data.tar.gz: 356a094e0979d0a45cf3bf436bbcdf4df35ec9c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 975a228e6566621d7e64cfb35ce979957a911c6f37eca4f11f8b2842c484b8503861f910f3c13fb088c09a81a2d27404d875b558c8baf45b54a9633ee5b6aaa9
|
7
|
+
data.tar.gz: 1264be8502dcb3465ec2a316995dbca51b523d8ee61900ec2f3ee78181e86f450e5ad11b23d1cc4c2b3bd105fab05d8aad6bd7610e714b4905db4f6539084cd4
|
data/hackademic.gemspec
CHANGED
data/lib/hackademic.rb
CHANGED
@@ -3,14 +3,53 @@ require "yaml"
|
|
3
3
|
require "thor"
|
4
4
|
require 'active_support'
|
5
5
|
require_relative 'hackademy/sync'
|
6
|
+
require_relative 'hackademy/compile'
|
6
7
|
|
7
8
|
class Hackademic < Thor
|
8
9
|
|
9
10
|
include Thor::Actions
|
10
11
|
|
11
|
-
|
12
|
+
HACKADEMIC_DIRECTORY = File.open("#{ENV['HOME']}/.hackademic", "r").read.chomp
|
13
|
+
source_root "#{Pathname.new(__FILE__).dirname}"
|
12
14
|
|
13
15
|
register Sync, :sync, "sync [subcommand]", "Synchronize!"
|
16
|
+
register Hackademy::New, :new, "new [PROJECT]", "Create something new!"
|
17
|
+
|
18
|
+
desc 'compile [FORMAT]', 'Type "hackademic help compile" to see choices'
|
19
|
+
subcommand 'compile', ::Hackademy::Compile
|
20
|
+
|
21
|
+
desc "list", "List the current projects in #{HACKADEMIC_DIRECTORY}"
|
22
|
+
def list
|
23
|
+
say ""
|
24
|
+
say " ❡ hackademic ➤➤➤", :magenta
|
25
|
+
say ""
|
26
|
+
say " Listing projects found in #{HACKADEMIC_DIRECTORY}/Projects/", :cyan
|
27
|
+
say ""
|
28
|
+
say " " + %x[ls -1 #{HACKADEMIC_DIRECTORY}/Projects].gsub!("\n","\n "), :blue
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "update_pandoc", "Update to latest pandoc and pandoc-citeproc"
|
32
|
+
def update_pandoc(args)
|
33
|
+
if !pandoc_is_current
|
34
|
+
run "brew unlink pandoc"
|
35
|
+
run "brew install pandoc"
|
36
|
+
run "brew link pandoc"
|
37
|
+
run "brew unlink pandoc-citeproc"
|
38
|
+
run "brew install pandoc-citeproc"
|
39
|
+
run "brew link pandoc-citeproc"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "install_templates", "Install latest pandoc templates"
|
44
|
+
def install_templates(args)
|
45
|
+
if !Dir.exists?(ENV["HOME"]+"/.pandoc/templates")
|
46
|
+
empty_directory ENV["HOME"]+"/.pandoc"
|
47
|
+
empty_directory ENV["HOME"]+"/.pandoc/templates"
|
48
|
+
end
|
49
|
+
template "../templates/default.asciidoc", ENV["HOME"] + "/.pandoc/templates/default.asciidoc"
|
50
|
+
template "../templates/default.html5", ENV["HOME"] + "/.pandoc/templates/default.html5"
|
51
|
+
template "../templates/default.latex", ENV["HOME"] + "/.pandoc/templates/default.latex"
|
52
|
+
end
|
14
53
|
|
15
54
|
desc "setup [FOLDER]", "Setup a new Hackademic repository at [FOLDER]"
|
16
55
|
def setup(root_directory)
|
@@ -29,6 +68,15 @@ class Hackademic < Thor
|
|
29
68
|
|
30
69
|
empty_directory "#{directory}/Meta"
|
31
70
|
|
71
|
+
if system("which brew")
|
72
|
+
run "brew update"
|
73
|
+
else
|
74
|
+
run 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
|
75
|
+
end
|
76
|
+
|
77
|
+
invoke :update_pandoc
|
78
|
+
invoke :install_templates
|
79
|
+
|
32
80
|
say "⫸⫸⫸ Initializing version control (git) for Notes database:", :yellow
|
33
81
|
empty_directory "#{directory}/Notes"
|
34
82
|
create_file "#{directory}/Notes/SampleNote.md"
|
@@ -47,74 +95,43 @@ class Hackademic < Thor
|
|
47
95
|
|
48
96
|
end
|
49
97
|
|
50
|
-
|
51
|
-
def new(project_name)
|
52
|
-
say "--------------------------------------------------------------", :cyan
|
53
|
-
say "⫸⫸⫸⫸ Setting up project #{project_name}!", :cyan
|
54
|
-
|
55
|
-
project = "#{hackademic_directory}/Projects/#{project_name}"
|
56
|
-
empty_directory(project)
|
57
|
-
|
58
|
-
say "»»»»» Creating *_WORKING_* directory:", :green
|
59
|
-
empty_directory("#{project}/_WORKING_")
|
60
|
-
template '../templates/DRAFT.md.tt', "#{project}/_WORKING_/DRAFT.md"
|
61
|
-
|
62
|
-
say "»»»»» Creating *Archive* directory:", :green
|
63
|
-
empty_directory("#{project}/Archive")
|
64
|
-
create_file "#{project}/Archive/.gitkeep"
|
65
|
-
|
66
|
-
say "»»»»» Creating *To-Process* directory:", :green
|
67
|
-
empty_directory("#{project}/To-Process")
|
68
|
-
create_file "#{project}/To-Process/.gitkeep"
|
69
|
-
|
70
|
-
say "»»»»» Creating *Project Notes* directory:", :green
|
71
|
-
empty_directory("#{project}/Resources/Notes")
|
72
|
-
create_file "#{project}/Resources/Notes/.gitkeep"
|
73
|
-
|
74
|
-
say "»»»»» Creating *Resources* directory:", :green
|
75
|
-
empty_directory("#{project}/Resources")
|
76
|
-
template '../templates/Config.yml.tt', "#{project}/Resources/Config.yml"
|
98
|
+
no_tasks {
|
77
99
|
|
78
|
-
|
79
|
-
|
100
|
+
def pandoc_is_current
|
101
|
+
if system("which pandoc")
|
102
|
+
current = `pandoc --version`[/.*\n/].strip.split(" ").last
|
103
|
+
latest = `brew info pandoc`[/\w+:\s\w+\s[\d+\.]*/].split(" ").last
|
104
|
+
current_status = semantic_version_checker(current, latest)
|
105
|
+
current_status
|
106
|
+
else
|
107
|
+
false
|
108
|
+
end
|
109
|
+
end
|
80
110
|
|
81
|
-
|
82
|
-
|
111
|
+
def semantic_version_checker(current, latest)
|
112
|
+
return true if current == latest
|
83
113
|
|
84
|
-
|
85
|
-
|
114
|
+
latest = latest.split(".")
|
115
|
+
current = current.split(".")
|
86
116
|
|
87
|
-
|
88
|
-
|
89
|
-
|
117
|
+
if current.length < latest.length
|
118
|
+
current = "#{current.join(".")}" + (".0" * (latest.length - current.length))
|
119
|
+
current = current.split(".")
|
120
|
+
end
|
90
121
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
122
|
+
# return true if current.length > latest.length
|
123
|
+
versionator = []
|
124
|
+
current.each_with_index do |v, index|
|
125
|
+
version = v.to_i
|
126
|
+
latest_version = latest[index].to_i
|
96
127
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
128
|
+
return true if version > latest_version
|
129
|
+
versionator << (version >= latest_version)
|
130
|
+
# versionator << (v.to_i >= latest[index].to_i)
|
131
|
+
end
|
132
|
+
versionator.all?{|v| v == true }
|
102
133
|
end
|
103
134
|
|
104
|
-
say "⫸⫸⫸⫸ DONE!", :cyan
|
105
|
-
say "⫸⫸⫸⫸ Project created at #{project}", :cyan
|
106
|
-
say "--------------------------------------------------------------", :cyan
|
107
|
-
end
|
108
|
-
|
109
|
-
def self.source_root
|
110
|
-
File.dirname(__FILE__)
|
111
|
-
end
|
112
|
-
|
113
|
-
no_tasks {
|
114
|
-
|
115
|
-
def hackademic_directory
|
116
|
-
@hackademic_directory ||= File.open("#{ENV['HOME']}/.hackademic", "r").read.chomp
|
117
|
-
end
|
118
135
|
}
|
119
136
|
|
120
137
|
end
|
@@ -0,0 +1,149 @@
|
|
1
|
+
require_relative "hackademy"
|
2
|
+
|
3
|
+
module Hackademy
|
4
|
+
class Compile < Thor
|
5
|
+
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
desc "all", "compile pdf, word doc, and latex file"
|
9
|
+
def all
|
10
|
+
latex
|
11
|
+
docx
|
12
|
+
pdf
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "pdf", "compile a pdf"
|
16
|
+
def pdf
|
17
|
+
check_installation
|
18
|
+
read_draft_file
|
19
|
+
write_master_markdown_file
|
20
|
+
system(pdf_command)
|
21
|
+
say "Writing out PDF file: #{config.output_directory}/#{config.transcluded_draft.gsub(/\..*$/, '')}.pdf"
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "show_pdf_command", "Show the pandoc command for pdf generation"
|
25
|
+
def show_pdf_command
|
26
|
+
say pdf_command, :blue
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "docx", "compile a docx"
|
30
|
+
def docx
|
31
|
+
check_installation
|
32
|
+
read_draft_file
|
33
|
+
write_master_markdown_file
|
34
|
+
%x[pandoc #{config.output_directory}/#{config.transcluded_draft} --from=markdown+#{pandoc_from_options.join("+")} --filter pandoc-citeproc --bibliography=#{config.bibliography} --csl=#{config.citation_style} --reference-docx=#{config.docx_template} -s -o "#{config.output_directory}/#{config.draft_name.gsub(/\..*$/,'')}.docx"]
|
35
|
+
say "Writing out DOCX file: #{config.output_directory}/#{config.draft_name.gsub(/\..*$/, '')}.docx"
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "latex", "compile a latex document"
|
39
|
+
def latex
|
40
|
+
check_installation
|
41
|
+
read_draft_file
|
42
|
+
write_master_markdown_file
|
43
|
+
%x[pandoc #{config.output_directory}/#{config.transcluded_draft} --from=markdown+#{pandoc_from_options.join("+")} --filter pandoc-citeproc --bibliography=#{config.bibliography} --csl=#{config.citation_style} --latex-engine=xelatex --template=#{config.latex_template} -s -o "#{latex_file}"]
|
44
|
+
say "Writing out LaTeX file: #{config.output_directory}/#{config.draft_name.gsub(/\..*$/, '')}.tex"
|
45
|
+
end
|
46
|
+
|
47
|
+
no_commands {
|
48
|
+
|
49
|
+
def latex_file
|
50
|
+
"#{config.output_directory}/#{config.draft_name.gsub(/\..*$/,'')}.tex"
|
51
|
+
end
|
52
|
+
|
53
|
+
def pdf_command
|
54
|
+
# %{pandoc \
|
55
|
+
# --bibliography=#{config.bibliography} \
|
56
|
+
# --csl=#{config.citation_style} \
|
57
|
+
# --template=#{config.latex_template} \
|
58
|
+
# --latex-engine=xelatex \
|
59
|
+
# -s -o "#{config.output_directory}/#{config.draft_name.gsub(/\..*$/,'')}.pdf" \
|
60
|
+
# #{config.output_directory}/#{config.transcluded_draft}
|
61
|
+
# }.gsub(/\s+/, ' ')
|
62
|
+
%{pandoc \
|
63
|
+
-t html5 \
|
64
|
+
--bibliography=#{config.bibliography} \
|
65
|
+
--csl=#{config.citation_style} \
|
66
|
+
-s \
|
67
|
+
-o "#{config.output_directory}/#{config.draft_name.gsub(/\..*$/,'')}.pdf" \
|
68
|
+
#{config.output_directory}/#{config.transcluded_draft}
|
69
|
+
}.gsub(/\s+/, ' ')
|
70
|
+
end
|
71
|
+
|
72
|
+
# TODO: Move to Hackademy::Setup
|
73
|
+
def check_installation
|
74
|
+
check_versions_directory
|
75
|
+
check_latex_installation
|
76
|
+
# check pandoc installation
|
77
|
+
# check python3 installation (panzer dependency)
|
78
|
+
# check panzer installation
|
79
|
+
end
|
80
|
+
|
81
|
+
def check_latex_installation
|
82
|
+
# TODO: Make sure user has latex/xetex/etc.
|
83
|
+
end
|
84
|
+
|
85
|
+
def check_versions_directory
|
86
|
+
begin
|
87
|
+
if !Dir.open('versions')
|
88
|
+
File.mkdir("versions")
|
89
|
+
# %x[mkdir versions]
|
90
|
+
end
|
91
|
+
rescue => exception
|
92
|
+
FileUtils.mkdir("versions") unless Dir.exists?('versions')
|
93
|
+
puts exception
|
94
|
+
say "Something went wrong. Make sure versions isn't a plan old file!", :red
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def transclude(file)
|
99
|
+
file = "#{config.drafts_dir}/#{file}" unless file[Regexp.compile("^#{config.drafts_dir}")]
|
100
|
+
if File.exists?(file)
|
101
|
+
contents = File.open(file, 'r').read
|
102
|
+
contents.scan(/{{(.*)}}/).flatten.each do |f|
|
103
|
+
original_f = f
|
104
|
+
f = f[config.drafts_dir] ? f.gsub(config.drafts_dir, '') : "#{config.drafts_dir}/#{f}"
|
105
|
+
Hackademic.new.say "...Including #{f}...", :cyan
|
106
|
+
if File.exists?(f)
|
107
|
+
content = File.open(f).read + "\n"
|
108
|
+
@draft = @draft.gsub("{{#{original_f}}}", content)
|
109
|
+
transclude(f)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def read_draft_file
|
116
|
+
@draft = File.open("#{config.drafts_dir}/#{config.draft_name}", "r").read
|
117
|
+
say "...Generating the *TRANSCLUDED* source...", :blue
|
118
|
+
transclude(config.draft_name)
|
119
|
+
# @draft.gsub!("__VERSION__", "v#{version}") if @draft[/__VERSION__/]
|
120
|
+
# @draft.gsub!("__DATETIME__", timestamp) if @draft[/__DATETIME__/]
|
121
|
+
end
|
122
|
+
|
123
|
+
def write_master_markdown_file
|
124
|
+
File.open("#{config.output_directory}/#{config.transcluded_draft}", "w") {|f| f << @draft.to_s }
|
125
|
+
end
|
126
|
+
|
127
|
+
def pandoc_from_options
|
128
|
+
%w[
|
129
|
+
yaml_metadata_block
|
130
|
+
raw_html
|
131
|
+
fenced_code_blocks
|
132
|
+
auto_identifiers
|
133
|
+
backtick_code_blocks
|
134
|
+
pipe_tables
|
135
|
+
markdown_in_html_blocks
|
136
|
+
grid_tables
|
137
|
+
multiline_tables
|
138
|
+
simple_tables
|
139
|
+
header_attributes
|
140
|
+
implicit_header_references
|
141
|
+
]
|
142
|
+
end
|
143
|
+
|
144
|
+
def config; Hackademy.config; end
|
145
|
+
}
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
data/lib/hackademy/hackademy.rb
CHANGED
@@ -1,33 +1,32 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative 'new'
|
2
2
|
|
3
3
|
module Hackademy
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
# end
|
5
|
+
def self.config;
|
6
|
+
@config ||= Config.new
|
7
|
+
end
|
8
|
+
|
9
|
+
class Config
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
if File.exists?("Resources/Config.yml")
|
13
|
+
raw_config = File.read("Resources/Config.yml")
|
14
|
+
erb_config = ERB.new(raw_config).result
|
15
|
+
settings = YAML.load(erb_config)["hackademic"]
|
16
|
+
if settings
|
17
|
+
settings.each { |name, value|
|
18
|
+
instance_variable_set("@#{name}", ENV[name.upcase] || value)
|
19
|
+
self.class.class_eval { attr_reader name.intern }
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def method_missing(method)
|
25
|
+
""
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
32
31
|
|
33
32
|
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module Hackademy
|
4
|
+
|
5
|
+
class New < Thor
|
6
|
+
|
7
|
+
include Thor::Actions
|
8
|
+
|
9
|
+
source_root "#{Pathname.new(__FILE__).dirname}/templates"
|
10
|
+
|
11
|
+
desc "project [PROJECTNAME]", "Setup a new Hackademic project called [PROJECTNAME]"
|
12
|
+
def project(project_name)
|
13
|
+
say "--------------------------------------------------------------", :cyan
|
14
|
+
say "⫸⫸⫸⫸ Setting up project #{project_name}!", :cyan
|
15
|
+
|
16
|
+
project = "#{hackademic_directory}/Projects/#{project_name}"
|
17
|
+
empty_directory(project)
|
18
|
+
|
19
|
+
templates = "#{Pathname.new(__FILE__).dirname}/templates"
|
20
|
+
|
21
|
+
say "»»»»» Creating *_WORKING_* directory:", :green
|
22
|
+
empty_directory("#{project}/_WORKING_")
|
23
|
+
template "../../templates/DRAFT.md.tt", "#{project}/_WORKING_/DRAFT.md"
|
24
|
+
|
25
|
+
say "»»»»» Creating *Archive* directory:", :green
|
26
|
+
empty_directory("#{project}/Archive")
|
27
|
+
create_file "#{project}/Archive/.gitkeep"
|
28
|
+
|
29
|
+
say "»»»»» Creating *To-Process* directory:", :green
|
30
|
+
empty_directory("#{project}/To-Process")
|
31
|
+
create_file "#{project}/To-Process/.gitkeep"
|
32
|
+
|
33
|
+
say "»»»»» Creating *Project Notes* directory:", :green
|
34
|
+
empty_directory("#{project}/Resources/Notes")
|
35
|
+
create_file "#{project}/Resources/Notes/.gitkeep"
|
36
|
+
|
37
|
+
say "»»»»» Creating *Resources* directory:", :green
|
38
|
+
empty_directory("#{project}/Resources")
|
39
|
+
template '../../templates/Config.yml.tt', "#{project}/Resources/Config.yml"
|
40
|
+
|
41
|
+
empty_directory("#{project}/Resources/Figures")
|
42
|
+
create_file "#{project}/Resources/Figures/.gitkeep"
|
43
|
+
|
44
|
+
empty_directory("#{project}/Resources/Data")
|
45
|
+
create_file "#{project}/Resources/Data/.gitkeep"
|
46
|
+
|
47
|
+
empty_directory("#{project}/Resources/templates")
|
48
|
+
template '../../templates/pandoc-word-template.docx', "#{project}/Resources/templates/pandoc-word-template.docx"
|
49
|
+
template '../../templates/xelatex.template', "#{project}/Resources/xelatex.template"
|
50
|
+
|
51
|
+
empty_directory("#{project}/Resources/csl")
|
52
|
+
template '../../templates/apa.csl', "#{project}/Resources/csl/apa.csl"
|
53
|
+
|
54
|
+
say "»»»»» Creating *Versions* directory:", :green
|
55
|
+
empty_directory("#{project}/Versions")
|
56
|
+
create_file "#{project}/Versions/.gitkeep"
|
57
|
+
|
58
|
+
say "»»»»» Creating final files:", :green
|
59
|
+
@project_name = project_name
|
60
|
+
template "../../templates/README.md.tt", "#{project}/README.md"
|
61
|
+
template '../../templates/CHANGELOG.md.tt', "#{project}/CHANGELOG.md"
|
62
|
+
template '../../templates/TODO.txt.tt', "#{project}/TODO.txt"
|
63
|
+
|
64
|
+
say "»»»»» Initializing version control (git) for project...", :green
|
65
|
+
inside "#{project}" do
|
66
|
+
run "git init .", {:capture => true}
|
67
|
+
run "git add .", {:capture => true}
|
68
|
+
run "git commit -m 'Initial commit of #{project_name}'", {:capture => true}
|
69
|
+
end
|
70
|
+
|
71
|
+
say "⫸⫸⫸⫸ DONE!", :cyan
|
72
|
+
say "⫸⫸⫸⫸ Project created at #{project}", :cyan
|
73
|
+
say "--------------------------------------------------------------", :cyan
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.source_root
|
77
|
+
File.dirname(__FILE__)
|
78
|
+
end
|
79
|
+
|
80
|
+
no_tasks {
|
81
|
+
|
82
|
+
def hackademic_directory
|
83
|
+
@hackademic_directory ||= File.open("#{ENV['HOME']}/.hackademic", "r").read.chomp
|
84
|
+
end
|
85
|
+
}
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
data/templates/Config.yml.tt
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
hackademic:
|
3
|
+
bibliography: Resources/References.bib
|
4
|
+
drafts_dir: "_WORKING_"
|
5
|
+
draft_name: DRAFT.md
|
6
|
+
transcluded_draft: DRAFT-COMPLETE.md
|
7
|
+
output_directory: Versions
|
8
|
+
citation_style: Resources/csl/american-sociological-association.csl
|
9
|
+
docx_template: Resource/templates/pandoc-word-template.docx
|
10
|
+
latex_template: Resources/templates/xelatex.template
|
11
|
+
support_directory: Resources
|
data/templates/apa.csl
ADDED
@@ -0,0 +1,443 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never">
|
3
|
+
<!-- This style was edited with the Visual CSL Editor (http://steveridout.com/csl/visualEditor/) -->
|
4
|
+
<info>
|
5
|
+
<title>American Psychological Association 6th Edition</title>
|
6
|
+
<id>http://www.zotero.org/styles/apa</id>
|
7
|
+
<link href="http://www.zotero.org/styles/apa" rel="self"/>
|
8
|
+
<link href="http://owl.english.purdue.edu/owl/resource/560/01/" rel="documentation"/>
|
9
|
+
<author>
|
10
|
+
<name>Simon Kornblith</name>
|
11
|
+
<email>simon@simonster.com</email>
|
12
|
+
</author>
|
13
|
+
<contributor>
|
14
|
+
<name>Bruce D'Arcus</name>
|
15
|
+
</contributor>
|
16
|
+
<contributor>
|
17
|
+
<name>Curtis M. Humphrey</name>
|
18
|
+
</contributor>
|
19
|
+
<contributor>
|
20
|
+
<name>Richard Karnesky</name>
|
21
|
+
<email>karnesky+zotero@gmail.com</email>
|
22
|
+
<uri>http://arc.nucapt.northwestern.edu/Richard_Karnesky</uri>
|
23
|
+
</contributor>
|
24
|
+
<contributor>
|
25
|
+
<name>Sebastian Karcher</name>
|
26
|
+
</contributor>
|
27
|
+
<category citation-format="author-date"/>
|
28
|
+
<category field="psychology"/>
|
29
|
+
<category field="generic-base"/>
|
30
|
+
<updated>2013-02-26T04:33:40+00:00</updated>
|
31
|
+
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
|
32
|
+
</info>
|
33
|
+
<locale xml:lang="en">
|
34
|
+
<terms>
|
35
|
+
<term name="editortranslator" form="short">
|
36
|
+
<single>ed. & trans.</single>
|
37
|
+
<multiple>eds. & trans.</multiple>
|
38
|
+
</term>
|
39
|
+
<term name="translator" form="short">
|
40
|
+
<single>trans.</single>
|
41
|
+
<multiple>trans.</multiple>
|
42
|
+
</term>
|
43
|
+
</terms>
|
44
|
+
</locale>
|
45
|
+
<macro name="container-contributors">
|
46
|
+
<choose>
|
47
|
+
<if type="chapter paper-conference" match="any">
|
48
|
+
<names variable="editor translator" delimiter=", " suffix=", ">
|
49
|
+
<name and="symbol" initialize-with=". " delimiter=", "/>
|
50
|
+
<label form="short" prefix=" (" text-case="title" suffix=")"/>
|
51
|
+
</names>
|
52
|
+
</if>
|
53
|
+
</choose>
|
54
|
+
</macro>
|
55
|
+
<macro name="secondary-contributors">
|
56
|
+
<choose>
|
57
|
+
<if type="chapter paper-conference" match="none">
|
58
|
+
<names variable="translator editor" delimiter=", " prefix=" (" suffix=")">
|
59
|
+
<name and="symbol" initialize-with=". " delimiter=", "/>
|
60
|
+
<label form="short" prefix=", " text-case="title" suffix=""/>
|
61
|
+
</names>
|
62
|
+
</if>
|
63
|
+
</choose>
|
64
|
+
</macro>
|
65
|
+
<macro name="author">
|
66
|
+
<names variable="author">
|
67
|
+
<name name-as-sort-order="all" and="symbol" sort-separator=", " initialize-with=". " delimiter=", " delimiter-precedes-last="always"/>
|
68
|
+
<label form="short" prefix=" (" suffix=")" text-case="capitalize-first"/>
|
69
|
+
<substitute>
|
70
|
+
<names variable="editor"/>
|
71
|
+
<names variable="translator"/>
|
72
|
+
<choose>
|
73
|
+
<if type="report">
|
74
|
+
<text variable="publisher"/>
|
75
|
+
<text macro="title"/>
|
76
|
+
</if>
|
77
|
+
<else>
|
78
|
+
<text macro="title"/>
|
79
|
+
</else>
|
80
|
+
</choose>
|
81
|
+
</substitute>
|
82
|
+
</names>
|
83
|
+
</macro>
|
84
|
+
<macro name="author-short">
|
85
|
+
<names variable="author">
|
86
|
+
<name form="short" and="symbol" delimiter=", " initialize-with=". "/>
|
87
|
+
<substitute>
|
88
|
+
<names variable="editor"/>
|
89
|
+
<names variable="translator"/>
|
90
|
+
<choose>
|
91
|
+
<if type="report">
|
92
|
+
<text variable="publisher"/>
|
93
|
+
<text variable="title" form="short" font-style="italic"/>
|
94
|
+
</if>
|
95
|
+
<else-if type="bill book graphic legal_case legislation motion_picture song" match="any">
|
96
|
+
<text variable="title" form="short" font-style="italic"/>
|
97
|
+
</else-if>
|
98
|
+
<else>
|
99
|
+
<text variable="title" form="short" quotes="true"/>
|
100
|
+
</else>
|
101
|
+
</choose>
|
102
|
+
</substitute>
|
103
|
+
</names>
|
104
|
+
</macro>
|
105
|
+
<macro name="access">
|
106
|
+
<choose>
|
107
|
+
<if type="thesis">
|
108
|
+
<choose>
|
109
|
+
<if variable="archive" match="any">
|
110
|
+
<group>
|
111
|
+
<text term="retrieved" text-case="capitalize-first" suffix=" "/>
|
112
|
+
<text term="from" suffix=" "/>
|
113
|
+
<text variable="archive" suffix="."/>
|
114
|
+
<text variable="archive_location" prefix=" (" suffix=")"/>
|
115
|
+
</group>
|
116
|
+
</if>
|
117
|
+
<else>
|
118
|
+
<group>
|
119
|
+
<text term="retrieved" text-case="capitalize-first" suffix=" "/>
|
120
|
+
<text term="from" suffix=" "/>
|
121
|
+
<text variable="URL"/>
|
122
|
+
</group>
|
123
|
+
</else>
|
124
|
+
</choose>
|
125
|
+
</if>
|
126
|
+
<else>
|
127
|
+
<choose>
|
128
|
+
<if variable="DOI">
|
129
|
+
<text variable="DOI" prefix="doi:"/>
|
130
|
+
</if>
|
131
|
+
<else>
|
132
|
+
<choose>
|
133
|
+
<if type="webpage">
|
134
|
+
<group delimiter=" ">
|
135
|
+
<text term="retrieved" text-case="capitalize-first" suffix=" "/>
|
136
|
+
<group>
|
137
|
+
<date variable="accessed" form="text" suffix=", "/>
|
138
|
+
</group>
|
139
|
+
<text term="from"/>
|
140
|
+
<text variable="URL"/>
|
141
|
+
</group>
|
142
|
+
</if>
|
143
|
+
<else>
|
144
|
+
<group>
|
145
|
+
<text term="retrieved" text-case="capitalize-first" suffix=" "/>
|
146
|
+
<text term="from" suffix=" "/>
|
147
|
+
<text variable="URL"/>
|
148
|
+
</group>
|
149
|
+
</else>
|
150
|
+
</choose>
|
151
|
+
</else>
|
152
|
+
</choose>
|
153
|
+
</else>
|
154
|
+
</choose>
|
155
|
+
</macro>
|
156
|
+
<macro name="title">
|
157
|
+
<choose>
|
158
|
+
<if type="report thesis" match="any">
|
159
|
+
<text variable="title" font-style="italic"/>
|
160
|
+
<group prefix=" (" suffix=")" delimiter=" ">
|
161
|
+
<text variable="genre"/>
|
162
|
+
<text variable="number" prefix="No. "/>
|
163
|
+
</group>
|
164
|
+
</if>
|
165
|
+
<else-if type="book graphic motion_picture report song manuscript speech" match="any">
|
166
|
+
<text variable="title" font-style="italic"/>
|
167
|
+
</else-if>
|
168
|
+
<else>
|
169
|
+
<text variable="title"/>
|
170
|
+
</else>
|
171
|
+
</choose>
|
172
|
+
</macro>
|
173
|
+
<macro name="publisher">
|
174
|
+
<choose>
|
175
|
+
<if type="report" match="any">
|
176
|
+
<group delimiter=": ">
|
177
|
+
<text variable="publisher-place"/>
|
178
|
+
<text variable="publisher"/>
|
179
|
+
</group>
|
180
|
+
</if>
|
181
|
+
<else-if type="thesis" match="any">
|
182
|
+
<group delimiter=", ">
|
183
|
+
<text variable="publisher"/>
|
184
|
+
<text variable="publisher-place"/>
|
185
|
+
</group>
|
186
|
+
</else-if>
|
187
|
+
<else>
|
188
|
+
<group delimiter=", ">
|
189
|
+
<choose>
|
190
|
+
<if variable="event" match="none">
|
191
|
+
<text variable="genre"/>
|
192
|
+
</if>
|
193
|
+
</choose>
|
194
|
+
<choose>
|
195
|
+
<if type="article-journal article-magazine" match="none">
|
196
|
+
<group delimiter=": ">
|
197
|
+
<text variable="publisher-place"/>
|
198
|
+
<text variable="publisher"/>
|
199
|
+
</group>
|
200
|
+
</if>
|
201
|
+
</choose>
|
202
|
+
</group>
|
203
|
+
</else>
|
204
|
+
</choose>
|
205
|
+
</macro>
|
206
|
+
<macro name="event">
|
207
|
+
<choose>
|
208
|
+
<if variable="event">
|
209
|
+
<choose>
|
210
|
+
<if variable="genre" match="none">
|
211
|
+
<text term="presented at" text-case="capitalize-first" suffix=" "/>
|
212
|
+
<text variable="event"/>
|
213
|
+
</if>
|
214
|
+
<else>
|
215
|
+
<group delimiter=" ">
|
216
|
+
<text variable="genre" text-case="capitalize-first"/>
|
217
|
+
<text term="presented at"/>
|
218
|
+
<text variable="event"/>
|
219
|
+
</group>
|
220
|
+
</else>
|
221
|
+
</choose>
|
222
|
+
</if>
|
223
|
+
</choose>
|
224
|
+
</macro>
|
225
|
+
<macro name="issued">
|
226
|
+
<choose>
|
227
|
+
<if type="bill legal_case legislation" match="none">
|
228
|
+
<choose>
|
229
|
+
<if variable="issued">
|
230
|
+
<group prefix=" (" suffix=")">
|
231
|
+
<date variable="issued">
|
232
|
+
<date-part name="year"/>
|
233
|
+
</date>
|
234
|
+
<text variable="year-suffix"/>
|
235
|
+
<choose>
|
236
|
+
<if type="article-journal bill book chapter graphic legal_case legislation motion_picture paper-conference report song" match="none">
|
237
|
+
<date variable="issued">
|
238
|
+
<date-part prefix=", " name="month"/>
|
239
|
+
<date-part prefix=" " name="day"/>
|
240
|
+
</date>
|
241
|
+
</if>
|
242
|
+
</choose>
|
243
|
+
</group>
|
244
|
+
</if>
|
245
|
+
<else>
|
246
|
+
<group prefix=" (" suffix=")">
|
247
|
+
<text term="no date" form="short"/>
|
248
|
+
<text variable="year-suffix" prefix="-"/>
|
249
|
+
</group>
|
250
|
+
</else>
|
251
|
+
</choose>
|
252
|
+
</if>
|
253
|
+
</choose>
|
254
|
+
</macro>
|
255
|
+
<macro name="issued-sort">
|
256
|
+
<choose>
|
257
|
+
<if type="article-journal bill book chapter graphic legal_case legislation motion_picture paper-conference report song" match="none">
|
258
|
+
<date variable="issued">
|
259
|
+
<date-part name="year"/>
|
260
|
+
<date-part name="month"/>
|
261
|
+
<date-part name="day"/>
|
262
|
+
</date>
|
263
|
+
</if>
|
264
|
+
<else>
|
265
|
+
<date variable="issued">
|
266
|
+
<date-part name="year"/>
|
267
|
+
</date>
|
268
|
+
</else>
|
269
|
+
</choose>
|
270
|
+
</macro>
|
271
|
+
<macro name="issued-year">
|
272
|
+
<choose>
|
273
|
+
<if variable="issued">
|
274
|
+
<date variable="issued">
|
275
|
+
<date-part name="year"/>
|
276
|
+
</date>
|
277
|
+
<text variable="year-suffix"/>
|
278
|
+
</if>
|
279
|
+
<else>
|
280
|
+
<text term="no date" form="short"/>
|
281
|
+
<text variable="year-suffix" prefix="-"/>
|
282
|
+
</else>
|
283
|
+
</choose>
|
284
|
+
</macro>
|
285
|
+
<macro name="edition">
|
286
|
+
<choose>
|
287
|
+
<if is-numeric="edition">
|
288
|
+
<group delimiter=" ">
|
289
|
+
<number variable="edition" form="ordinal"/>
|
290
|
+
<text term="edition" form="short"/>
|
291
|
+
</group>
|
292
|
+
</if>
|
293
|
+
<else>
|
294
|
+
<text variable="edition" suffix="."/>
|
295
|
+
</else>
|
296
|
+
</choose>
|
297
|
+
</macro>
|
298
|
+
<macro name="locators">
|
299
|
+
<choose>
|
300
|
+
<if type="article-journal article-magazine" match="any">
|
301
|
+
<group prefix=", " delimiter=", ">
|
302
|
+
<group>
|
303
|
+
<text variable="volume" font-style="italic"/>
|
304
|
+
<text variable="issue" prefix="(" suffix=")"/>
|
305
|
+
</group>
|
306
|
+
<text variable="page"/>
|
307
|
+
</group>
|
308
|
+
</if>
|
309
|
+
<else-if type="article-newspaper">
|
310
|
+
<group delimiter=" " prefix=", ">
|
311
|
+
<label variable="page" form="short"/>
|
312
|
+
<text variable="page"/>
|
313
|
+
</group>
|
314
|
+
</else-if>
|
315
|
+
<else-if type="book graphic motion_picture report song chapter paper-conference" match="any">
|
316
|
+
<group prefix=" (" suffix=")" delimiter=", ">
|
317
|
+
<text macro="edition"/>
|
318
|
+
<group>
|
319
|
+
<text term="volume" form="short" plural="true" text-case="capitalize-first" suffix=" "/>
|
320
|
+
<number variable="number-of-volumes" form="numeric" prefix="1-"/>
|
321
|
+
</group>
|
322
|
+
<group>
|
323
|
+
<text term="volume" form="short" text-case="capitalize-first" suffix=" "/>
|
324
|
+
<number variable="volume" form="numeric"/>
|
325
|
+
</group>
|
326
|
+
<group>
|
327
|
+
<label variable="page" form="short" suffix=" "/>
|
328
|
+
<text variable="page"/>
|
329
|
+
</group>
|
330
|
+
</group>
|
331
|
+
</else-if>
|
332
|
+
<else-if type="legal_case">
|
333
|
+
<group prefix=" (" suffix=")" delimiter=" ">
|
334
|
+
<text variable="authority"/>
|
335
|
+
<date variable="issued" form="text"/>
|
336
|
+
</group>
|
337
|
+
</else-if>
|
338
|
+
<else-if type="bill legislation" match="any">
|
339
|
+
<date variable="issued" prefix=" (" suffix=")">
|
340
|
+
<date-part name="year"/>
|
341
|
+
</date>
|
342
|
+
</else-if>
|
343
|
+
</choose>
|
344
|
+
</macro>
|
345
|
+
<macro name="citation-locator">
|
346
|
+
<group>
|
347
|
+
<choose>
|
348
|
+
<if locator="chapter">
|
349
|
+
<label variable="locator" form="long" text-case="capitalize-first"/>
|
350
|
+
</if>
|
351
|
+
<else>
|
352
|
+
<label variable="locator" form="short"/>
|
353
|
+
</else>
|
354
|
+
</choose>
|
355
|
+
<text variable="locator" prefix=" "/>
|
356
|
+
</group>
|
357
|
+
</macro>
|
358
|
+
<macro name="container">
|
359
|
+
<group>
|
360
|
+
<choose>
|
361
|
+
<if type="chapter paper-conference entry-encyclopedia" match="any">
|
362
|
+
<text term="in" text-case="capitalize-first" suffix=" "/>
|
363
|
+
</if>
|
364
|
+
</choose>
|
365
|
+
<text macro="container-contributors"/>
|
366
|
+
<text macro="secondary-contributors"/>
|
367
|
+
<text macro="container-title"/>
|
368
|
+
</group>
|
369
|
+
</macro>
|
370
|
+
<macro name="container-title">
|
371
|
+
<choose>
|
372
|
+
<if type="bill legal_case legislation" match="none">
|
373
|
+
<text variable="container-title" font-style="italic"/>
|
374
|
+
</if>
|
375
|
+
<else>
|
376
|
+
<group delimiter=" " prefix=", ">
|
377
|
+
<choose>
|
378
|
+
<if variable="container-title">
|
379
|
+
<text variable="volume"/>
|
380
|
+
<text variable="container-title"/>
|
381
|
+
<group delimiter=" ">
|
382
|
+
<!--change to label variable="section" as that becomes available -->
|
383
|
+
<text term="section" form="symbol"/>
|
384
|
+
<text variable="section"/>
|
385
|
+
</group>
|
386
|
+
<text variable="page"/>
|
387
|
+
</if>
|
388
|
+
<else>
|
389
|
+
<choose>
|
390
|
+
<if type="legal_case">
|
391
|
+
<text variable="number" prefix="No. "/>
|
392
|
+
</if>
|
393
|
+
<else>
|
394
|
+
<text variable="number" prefix="Pub. L. No. "/>
|
395
|
+
<group delimiter=" ">
|
396
|
+
<!--change to label variable="section" as that becomes available -->
|
397
|
+
<text term="section" form="symbol"/>
|
398
|
+
<text variable="section"/>
|
399
|
+
</group>
|
400
|
+
</else>
|
401
|
+
</choose>
|
402
|
+
</else>
|
403
|
+
</choose>
|
404
|
+
</group>
|
405
|
+
</else>
|
406
|
+
</choose>
|
407
|
+
</macro>
|
408
|
+
<citation et-al-min="6" et-al-use-first="1" et-al-subsequent-min="3" et-al-subsequent-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="true" disambiguate-add-givenname="true" collapse="year" givenname-disambiguation-rule="primary-name">
|
409
|
+
<sort>
|
410
|
+
<key macro="author"/>
|
411
|
+
<key macro="issued-sort"/>
|
412
|
+
</sort>
|
413
|
+
<layout prefix="(" suffix=")" delimiter="; ">
|
414
|
+
<group delimiter=", ">
|
415
|
+
<text macro="author-short"/>
|
416
|
+
<text macro="issued-year"/>
|
417
|
+
<text macro="citation-locator"/>
|
418
|
+
</group>
|
419
|
+
</layout>
|
420
|
+
</citation>
|
421
|
+
<bibliography hanging-indent="true" et-al-min="8" et-al-use-first="6" et-al-use-last="true" entry-spacing="0" line-spacing="2">
|
422
|
+
<sort>
|
423
|
+
<key macro="author"/>
|
424
|
+
<key macro="issued-sort" sort="ascending"/>
|
425
|
+
</sort>
|
426
|
+
<layout>
|
427
|
+
<group suffix=".">
|
428
|
+
<group delimiter=". ">
|
429
|
+
<text macro="author"/>
|
430
|
+
<text macro="issued"/>
|
431
|
+
<text macro="title" prefix=" "/>
|
432
|
+
<text macro="container"/>
|
433
|
+
</group>
|
434
|
+
<text macro="locators"/>
|
435
|
+
<group delimiter=", " prefix=". ">
|
436
|
+
<text macro="event"/>
|
437
|
+
<text macro="publisher"/>
|
438
|
+
</group>
|
439
|
+
</group>
|
440
|
+
<text macro="access" prefix=" "/>
|
441
|
+
</layout>
|
442
|
+
</bibliography>
|
443
|
+
</style>
|
Binary file
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hackademic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Petty
|
@@ -23,14 +23,18 @@ files:
|
|
23
23
|
- bin/hackademic
|
24
24
|
- hackademic.gemspec
|
25
25
|
- lib/hackademic.rb
|
26
|
+
- lib/hackademy/compile.rb
|
26
27
|
- lib/hackademy/hackademy.rb
|
27
|
-
- lib/hackademy/
|
28
|
+
- lib/hackademy/new.rb
|
28
29
|
- lib/hackademy/sync.rb
|
29
30
|
- templates/CHANGELOG.md.tt
|
30
31
|
- templates/Config.yml.tt
|
31
32
|
- templates/DRAFT.md.tt
|
32
33
|
- templates/README.md.tt
|
33
34
|
- templates/TODO.txt.tt
|
35
|
+
- templates/apa.csl
|
36
|
+
- templates/pandoc-word-template.docx
|
37
|
+
- templates/xelatex.template
|
34
38
|
homepage: http://github.com/kizmeta/hackademic
|
35
39
|
licenses:
|
36
40
|
- MIT
|
data/lib/hackademy/setup.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
module Hackademy
|
2
|
-
class Setup < Thor
|
3
|
-
|
4
|
-
namespace :setup
|
5
|
-
|
6
|
-
include Thor::Actions
|
7
|
-
|
8
|
-
# desc "set_environment_path!", "setup shell $PATH variable to allow running \"hackademic\" commands"
|
9
|
-
# def set_environment_path!
|
10
|
-
# answer = ask("Set your environment $PATH to include bin? This is important and allows you to just run \"hackademic\" commands more easily.\nSetup? [Y/n]", :green)
|
11
|
-
# if !answer
|
12
|
-
# say "Updating your shell to find writing commands...", :green
|
13
|
-
# config_files = ["#{ENV['HOME']}/.zshrc", "#{ENV['HOME']}/.bash_profile"]
|
14
|
-
# config_files.each do |config_file|
|
15
|
-
# append_to_file config_file, "export PATH=.bin:$PATH\n"
|
16
|
-
# end
|
17
|
-
# say "Updated shell config files!"
|
18
|
-
# else
|
19
|
-
# say "Skipping $PATH setup..."
|
20
|
-
# end
|
21
|
-
# end
|
22
|
-
|
23
|
-
# desc "install_git_hooks!", "install a git hook to auto-compile master draft before committing to repository"
|
24
|
-
# def install_git_hooks!
|
25
|
-
# if !no?("Install the git pre-commit hook?\nThis automatically compiles a fresh pdf upon commits. [y/N]", :green)
|
26
|
-
# say "Installing git pre-commit..."
|
27
|
-
# copy_file ".config/git/pre-commit", ".git/hooks/pre-commit"
|
28
|
-
# say "Done!"
|
29
|
-
# else
|
30
|
-
# say "Skipping git hooks..."
|
31
|
-
# end
|
32
|
-
# say "--------------------------------------------------------------", :blue
|
33
|
-
# end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|