scholarmarkdown 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +15 -0
  3. data/Gemfile.lock +88 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +45 -0
  6. data/Rakefile +24 -0
  7. data/VERSION +1 -0
  8. data/bin/generate-scholarmarkdown +19 -0
  9. data/bin/template/.gitignore +9 -0
  10. data/bin/template/Gemfile +36 -0
  11. data/bin/template/Guardfile +15 -0
  12. data/bin/template/README.md +15 -0
  13. data/bin/template/Rules +51 -0
  14. data/bin/template/config.ru +11 -0
  15. data/bin/template/content/abstract.md +15 -0
  16. data/bin/template/content/index.md.erb +21 -0
  17. data/bin/template/content/introduction.md +4 -0
  18. data/bin/template/content/references.bib +10 -0
  19. data/bin/template/content/styles/lncs.scss +1086 -0
  20. data/bin/template/content/styles/print.scss +2 -0
  21. data/bin/template/content/styles/reset.scss +47 -0
  22. data/bin/template/content/styles/screen.scss +364 -0
  23. data/bin/template/content/styles/shared.scss +77 -0
  24. data/bin/template/layouts/default.html.erb +12 -0
  25. data/bin/template/nanoc.yaml +28 -0
  26. data/lib/scholarmarkdown/citationstyles/lncs-custom.csl +159 -0
  27. data/lib/scholarmarkdown/filter/acronym.rb +13 -0
  28. data/lib/scholarmarkdown/filter/citation.rb +18 -0
  29. data/lib/scholarmarkdown/filter/headerids_to_section.rb +7 -0
  30. data/lib/scholarmarkdown/filter/hyphenate_iri.rb +18 -0
  31. data/lib/scholarmarkdown/filter/include_code.rb +10 -0
  32. data/lib/scholarmarkdown/filter/labelify.rb +94 -0
  33. data/lib/scholarmarkdown/filter/references_to_footer.rb +10 -0
  34. data/lib/scholarmarkdown/snippets.rb +28 -0
  35. data/lib/scholarmarkdown.rb +2 -0
  36. data/scholarmarkdown.gemspec +96 -0
  37. metadata +193 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 99d5b736bcf8777363f16fa6f181b68a42a35bd0
4
+ data.tar.gz: faf2eb639b266ba9eb082f16d63e8bc7f7f9b10b
5
+ SHA512:
6
+ metadata.gz: cccbcdcc92710f5b7204862c8c3d49217a0c31055432075aed80da58be2d47e5a6c7c882fb655512a34c61e0756b4a48b7f50bb3519c1964a47e5a33f1bef767
7
+ data.tar.gz: da1129b6bcf6fdeab5980cd94c57ca12597cd85646436ed4231cf3c671bfaeab263fe9df12ed53e7fcf53d35bf8aeccdf9b2fa0a213c0876f312b6603c037efa
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # references
4
+ gem 'i18n'
5
+ gem 'bibtex-ruby'
6
+ gem 'latex-decode'
7
+ gem 'citeproc-ruby', '>= 1.1.6'
8
+ gem 'csl-styles'
9
+ gem 'bibmarkdown', '~> 1.3.2'
10
+
11
+ group :development do
12
+ # management of this gem
13
+ gem "bundler", "~> 1.0"
14
+ gem "juwelier", "~> 2.4.7"
15
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,88 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ addressable (2.5.2)
5
+ public_suffix (>= 2.0.2, < 4.0)
6
+ bibmarkdown (1.3.2)
7
+ citeproc-ruby
8
+ csl-styles
9
+ bibtex-ruby (4.4.6)
10
+ latex-decode (~> 0.0)
11
+ builder (3.2.3)
12
+ citeproc (1.0.9)
13
+ namae (~> 1.0)
14
+ citeproc-ruby (1.1.10)
15
+ citeproc (~> 1.0, >= 1.0.9)
16
+ csl (~> 1.5)
17
+ concurrent-ruby (1.0.5)
18
+ csl (1.5.0)
19
+ namae (~> 1.0)
20
+ csl-styles (1.0.1.8)
21
+ csl (~> 1.0)
22
+ descendants_tracker (0.0.4)
23
+ thread_safe (~> 0.3, >= 0.3.1)
24
+ faraday (0.12.2)
25
+ multipart-post (>= 1.2, < 3)
26
+ git (1.3.0)
27
+ github_api (0.18.2)
28
+ addressable (~> 2.4)
29
+ descendants_tracker (~> 0.0.4)
30
+ faraday (~> 0.8)
31
+ hashie (~> 3.5, >= 3.5.2)
32
+ oauth2 (~> 1.0)
33
+ hashie (3.5.7)
34
+ highline (1.7.10)
35
+ i18n (0.9.5)
36
+ concurrent-ruby (~> 1.0)
37
+ juwelier (2.4.9)
38
+ builder
39
+ bundler
40
+ git
41
+ github_api
42
+ highline
43
+ kamelcase (~> 0)
44
+ nokogiri
45
+ psych
46
+ rake
47
+ rdoc
48
+ semver2
49
+ jwt (1.5.6)
50
+ kamelcase (0.0.2)
51
+ semver2 (~> 3)
52
+ latex-decode (0.3.1)
53
+ mini_portile2 (2.3.0)
54
+ multi_json (1.13.1)
55
+ multi_xml (0.6.0)
56
+ multipart-post (2.0.0)
57
+ namae (1.0.1)
58
+ nokogiri (1.8.2)
59
+ mini_portile2 (~> 2.3.0)
60
+ oauth2 (1.4.0)
61
+ faraday (>= 0.8, < 0.13)
62
+ jwt (~> 1.0)
63
+ multi_json (~> 1.3)
64
+ multi_xml (~> 0.5)
65
+ rack (>= 1.2, < 3)
66
+ psych (3.0.2)
67
+ public_suffix (3.0.2)
68
+ rack (1.5.5)
69
+ rake (12.3.0)
70
+ rdoc (6.0.2)
71
+ semver2 (3.4.2)
72
+ thread_safe (0.3.6)
73
+
74
+ PLATFORMS
75
+ ruby
76
+
77
+ DEPENDENCIES
78
+ bibmarkdown (~> 1.3.2)
79
+ bibtex-ruby
80
+ bundler (~> 1.0)
81
+ citeproc-ruby (>= 1.1.6)
82
+ csl-styles
83
+ i18n
84
+ juwelier (~> 2.4.7)
85
+ latex-decode
86
+
87
+ BUNDLED WITH
88
+ 1.14.6
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright © 2018 Ruben Taelman, Ruben Verborgh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # ScholarMarkdown
2
+ [![scholarmarkdown gem version](https://badge.fury.io/rb/scholarmarkdown.svg)](https://rubygems.org/gems/scholarmarkdown)
3
+
4
+ ScholarMarkdown is Ruby gem for writing scholarly articles in Markdown/HTML. These articles can be viewed in your browser with rich HTML annotations, and they can be printed to PDF into traditional scientific templates via your browser.
5
+
6
+ It provides an executable (`generate-scholarmd`) for initializing a [nanoc](https://nanoc.ws/) project
7
+ to generate HTML and PDF versions of articles.
8
+
9
+ ScholarMarkdown consists of a collection of modules that can be configured in your `Rules` file.
10
+ More information on these modules can be found in the [wiki](https://github.com/rubensworks/ScholarMarkdown/wiki/Modules).
11
+
12
+ ## Quick Start
13
+
14
+ #### 1. Use RubyGems to install this bundle:
15
+
16
+ ```bash
17
+ $ gem install scholarmarkdown
18
+ ```
19
+
20
+ #### 2. Generate your article
21
+
22
+ _This will create a directory `my-awesome-article` containing the basic files for a ScholarMarkdown project._
23
+
24
+ ```bash
25
+ $ generate-scholarmarkdown my-awesome-article
26
+ $ cd my-awesome-article
27
+ $ bundle install
28
+ ```
29
+
30
+ #### 3. Compile your article
31
+
32
+ _This will start a live webserver that will continuously compile your article files upon any change._
33
+
34
+ ```
35
+ $ bundle exec guard
36
+ ```
37
+
38
+ #### 4. View your article
39
+
40
+ Visit `http://localhost:3000/` in your browser to read your article.
41
+
42
+ Preview in print-mode to see it in its traditional scientific format.
43
+
44
+ ## License
45
+ This software is released under the [MIT license](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'juwelier'
15
+ Juwelier::Tasks.new do |gem|
16
+ gem.name = "scholarmarkdown"
17
+ gem.homepage = "http://github.com/rubensworks/ScholarMarkdown"
18
+ gem.license = "MIT"
19
+ gem.summary = "A framework for writing markdown-based scholarly articles."
20
+ gem.email = "rubensworks@gmail.com"
21
+ gem.authors = ["Ruben Taelman"]
22
+ gem.executables = ['generate-scholarmarkdown']
23
+ end
24
+ Juwelier::RubygemsDotOrgTasks.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ # Initialize a ScholarMarkdown article project
3
+
4
+ require 'fileutils'
5
+ templatedir = File.dirname(__FILE__) + '/template'
6
+
7
+ targetdir = ARGV[0]
8
+ if not targetdir
9
+ puts 'No target directory name was given'
10
+ exit(1)
11
+ end
12
+ if File.exists?(targetdir)
13
+ puts 'The target directory already exists'
14
+ exit(1)
15
+ end
16
+
17
+ puts 'Initializing project at ' + targetdir
18
+ Dir.mkdir(targetdir)
19
+ FileUtils.copy_entry(templatedir, targetdir)
@@ -0,0 +1,9 @@
1
+ .DS_Store
2
+ *.pdf
3
+
4
+ .sass-cache
5
+ Gemfile.lock
6
+ tmp
7
+ output
8
+ *.log
9
+ *.diff
@@ -0,0 +1,36 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'nanoc', '~> 4.7'
4
+
5
+ gem 'scholarmarkdown'
6
+
7
+ # text processing
8
+ gem 'kramdown'
9
+ gem 'rubypants'
10
+
11
+ # stylesheets
12
+ gem 'sass'
13
+
14
+ # references
15
+ gem 'i18n'
16
+ gem 'latex-decode'
17
+ gem 'unicode_utils'
18
+ gem 'citeproc-ruby', '>= 1.1.6'
19
+ gem 'csl-styles'
20
+
21
+ group :development do
22
+ # live view
23
+ gem 'guard-nanoc', '~> 2.1.2'
24
+ gem 'guard-process'
25
+ gem 'guard-livereload'
26
+ gem 'serve'
27
+ gem 'thin'
28
+ gem 'rack-livereload'
29
+ gem 'wdm', '>= 0.1.0' if Gem.win_platform?
30
+ gem 'rb-readline'
31
+ end
32
+
33
+ group :test do
34
+ # validation
35
+ gem 'w3c_validators', '~> 1.3.1'
36
+ end
@@ -0,0 +1,15 @@
1
+ guard :nanoc do
2
+ watch 'nanoc.yaml'
3
+ watch 'Rules'
4
+ watch %r{^(content|layouts|lib)/}
5
+ end
6
+
7
+ guard :process, name: 'server', command: 'bundle exec serve' do
8
+ watch 'Gemfile.lock'
9
+ end
10
+
11
+ guard :livereload do
12
+ watch(%r{^output/}) { |m| m[0].sub(%r{^output/}, '') }
13
+ end
14
+
15
+ notification :notifu, :nosound => true
@@ -0,0 +1,15 @@
1
+ # My Scholarly Article
2
+
3
+ ## Build
4
+ ```
5
+ bundle install
6
+ bundle exec nanoc compile
7
+ ```
8
+
9
+ ## Development mode
10
+ ```
11
+ bundle install
12
+ bundle exec guard
13
+ ```
14
+
15
+ View on http://localhost:3000/
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'scholarmarkdown/snippets'
4
+ require 'scholarmarkdown/filter/acronym'
5
+ require 'scholarmarkdown/filter/citation'
6
+ require 'scholarmarkdown/filter/hyphenate_iri'
7
+ require 'scholarmarkdown/filter/include_code'
8
+ require 'scholarmarkdown/filter/labelify'
9
+ require 'scholarmarkdown/filter/references_to_footer'
10
+ require 'scholarmarkdown/filter/headerids_to_section'
11
+
12
+ Encoding.default_external = "UTF-8"
13
+
14
+ compile '/index.*' do
15
+ filter :erb
16
+ filter :scholar_citation, bibfile: items['/references.bib'],
17
+ style: 'lncs-custom'
18
+ filter :kramdown
19
+ filter :scholar_hyphenate_iri
20
+ filter :scholar_include_code
21
+ filter :scholar_labelify
22
+ filter :scholar_references_to_footer
23
+ filter :scholar_headerids_to_section
24
+ filter :rubypants
25
+ layout '/default.*'
26
+ end
27
+
28
+ ignore '/*.md'
29
+ ignore '/*.bib'
30
+ ignore '/*.csv'
31
+
32
+ route '/**/*.{html,md}*' do
33
+ if item.identifier =~ '/index.*'
34
+ '/index.html'
35
+ else
36
+ item.identifier.without_ext + '/index.html'
37
+ end
38
+ end
39
+
40
+ compile '/**/{screen,print}.scss' do
41
+ filter :sass, syntax: :scss,
42
+ style: :compressed
43
+ write item.identifier.without_ext + '.css'
44
+ end
45
+ ignore '/**/*.scss'
46
+
47
+ compile '/**/*' do
48
+ write item.identifier.to_s
49
+ end
50
+
51
+ layout '/**/*', :erb
@@ -0,0 +1,11 @@
1
+ #\ -p 3000
2
+ require 'serve'
3
+ require 'serve/rack'
4
+ require 'rack-livereload'
5
+ use Rack::LiveReload, no_swf: true
6
+
7
+ root = File.dirname(__FILE__) + '/output'
8
+ run Rack::Cascade.new [
9
+ Serve::RackAdapter.new(root),
10
+ Rack::Directory.new(root),
11
+ ]
@@ -0,0 +1,15 @@
1
+ ## Abstract
2
+ <!-- Context -->
3
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
4
+ <!-- Need -->
5
+ Vestibulum finibus dignissim augue, id pellentesque est facilisis non.
6
+ <!-- Task -->
7
+ Donec fringilla dolor non neque iaculis blandit.
8
+ <!-- Object -->
9
+ Praesent aliquet eleifend iaculis.
10
+ <!-- Findings -->
11
+ Quisque pellentesque at odio ac bibendum.
12
+ <!-- Conclusion -->
13
+ Pellentesque imperdiet felis urna, quis facilisis lacus gravida non.
14
+ <!-- Perspectives -->
15
+ Donec quis lectus eget sem tempor tristique pellentesque in dolor.
@@ -0,0 +1,21 @@
1
+ ---
2
+ title: "My Awesome Article"
3
+ ---
4
+ <header markdown="1">
5
+ # <%= @item[:title] %>
6
+
7
+ {:#authors}
8
+ - <%= person 'John Doe', 'http://www.example.org/', 'http://www.example.org/#me' %>
9
+
10
+ {:#affiliations}
11
+ - {:#myaffiliation} Awesome Inc.
12
+
13
+ <%= section 'abstract' %>
14
+ </header>
15
+
16
+ <main>
17
+ <!-- Add sections by specifying their file name, excluding the '.md' suffix. -->
18
+ <%= section 'introduction' %>
19
+ </main>
20
+
21
+ <footer></footer>
@@ -0,0 +1,4 @@
1
+ ## Introduction
2
+ {:#introduction}
3
+
4
+ This is a great article on the [Semantic Web](cite:cites semanticweb), written in Markdown.
@@ -0,0 +1,10 @@
1
+ @article{semanticweb,
2
+ title = {The semantic web},
3
+ author = {Berners-Lee, Tim and Hendler, James and Lassila, Ora and others},
4
+ journal = {Scientific American},
5
+ volume = {284},
6
+ number = {5},
7
+ pages = {28--37},
8
+ year = {2001},
9
+ publisher = {New York, NY, USA:}
10
+ }