jekyll-scientific 0.0.1 → 0.0.2

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-scientific (0.0.1)
4
+ jekyll-scientific (0.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -3,7 +3,20 @@ __J__ekyll __Sc__ientific plugin - JSC
3
3
 
4
4
  A plugin which extends markdown to include features akin to Latex's that make markdown viable for research write-ups.
5
5
 
6
- ## Support
6
+ # How to use it
7
+
8
+ In your Jekyll _config.yaml file add a gems array and add jsc to it as in
9
+ gems : [jsc]
10
+
11
+ On the command line run
12
+
13
+ ``` bash
14
+ gem install jekyll-scientific
15
+ ```
16
+
17
+ That's it, plugin specific config options are included below.
18
+
19
+ ## What it supports Support
7
20
 
8
21
  * Adds proper formula via [MathJax](http://www.mathjax.org/)
9
22
  * Citation support for bib files [bibtex-ruby](https://github.com/inukshuk/bibtex-ruby), and [CSL](https://github.com/citation-style-language/styles)
@@ -13,5 +26,68 @@ A plugin which extends markdown to include features akin to Latex's that make ma
13
26
  * Add [pandoc](http://johnmacfarlane.net/pandoc/) support so that Jekyll site can be completely written in LateX or another format and output to HTML and PDF.
14
27
  See [pandoc-multiple-formats](https://github.com/fauno/jekyll-pandoc-multiple-formats) or [pandoc-plugin](https://github.com/dsanson/jekyll-pandoc-plugin)
15
28
 
16
- * Git hooks to automatically build the jekyll site see [Git global hooks](http://stackoverflow.com/a/8842663/400048) and [Githooks](http://githooks.com/)
29
+ * Unfortunately you can't run custom plugins with GitHub pages (for obv. reasons). So JSC sites need to be built locally and their _site directory pushed to GitHub.
30
+ One the list of things to do is use git hooks to automatically build the jekyll site see [Git global hooks](http://stackoverflow.com/a/8842663/400048) and [Githooks](http://githooks.com/)
31
+
32
+ # Configuration
33
+
34
+ Various config options are available for each plugin included.
35
+
36
+ ## Citations
37
+
38
+ Citations are provided by [jekyll-scholar](https://github.com/inukshuk/jekyll-scholar/).
39
+ Visit the link for detailed covered of available options and usage.
40
+ In summary the following options are available to configure how citations work
41
+
42
+ ``` yaml
43
+ scholar:
44
+ style: apa
45
+ locale: en
46
+
47
+ sort_by: none
48
+ order: ascending
49
+
50
+ source: bibtex #says refereces.bib stored in bibtex folder
51
+ bibliography: references #says a file called bibtex/references.bib is the main bib file
52
+ bibliography_template: "%{reference}"
53
+
54
+ details_dir: bibliography
55
+ details_layout: bibtex.html
56
+ details_link: Details
57
+
58
+ query: "@*"
59
+ ```
60
+ To cite a work from the main bib fileuse the cite tag as in:
61
+ e.g. {% cite kirsch2006distance %} would cite the entry with the given name.
62
+ To append a list of references at the bottom of the page or post use the references tag as in:
63
+ {% bibliography -c %},-c tells it to only include citations used on the current page or post without -c all entries from the bibliography file will be listed
64
+
65
+
66
+ ## LateX math / Formulas
67
+
68
+ Formulas are done using the MathJax library. There are two tags available for adding math.
69
+
70
+ 1. {% m %} and {% em %} pairs are used to add math inline i.e. within a sentence
71
+
72
+ 2. {% math %} and {% endmath %} pairs are used to add math in a centered block as is typical in LateX documents.
73
+
74
+ For e.g.
75
+
76
+ ``` latex
77
+
78
+ {% m %}
79
+ e = mc^2
80
+ {% em %}
81
+
82
+ {% math %}
83
+ \mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
84
+ \mathbf{i} & \mathbf{j} & \mathbf{k} \\
85
+ \frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\
86
+ \frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0
87
+ \end{vmatrix}
88
+ {% endmath %}
89
+
90
+ ```
91
+ ### todo
17
92
 
93
+ Formulas are currently not as configurable as they could be. MathJax has a lot of config options that could be added.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/bin/jsc ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ spec = Gem::Specification.find_by_name('jekyll-scientific')
3
+ shell_path = File.join(spec.gem_dir, 'bin', 'jsc_shell.sh')
4
+ exec("sh #{shell_path} " + ARGV.join( ' ' ))
@@ -0,0 +1,41 @@
1
+ #!/bin/sh
2
+ # get publish message to use
3
+ message=$1
4
+ if [ -z "$1" ]
5
+ then #if argument is empty
6
+ #get the last commit message from this branch and use it as the commit to publish the site
7
+ message=$(git log -n 1 --format="%s %n %n %b")
8
+ fi
9
+ # generate - just to make sure latest changes have been built
10
+ jekyll build --trace
11
+ #push the current branch to remote
12
+ git push
13
+ # get branch name into $branch -http://git-blame.blogspot.co.uk/2013/06/checking-current-branch-programatically.html
14
+ branch=$(git symbolic-ref --short -q HEAD)
15
+ tmp_d="/tmp/jsc"
16
+ #remove /tmp/jsc
17
+ rm -rf ${tmp_d}
18
+ mkdir ${tmp_d}
19
+ cp -r _site/. ${tmp_d}/
20
+ #checkout gh-pages
21
+ git checkout gh-pages
22
+ current_branch=$(git symbolic-ref --short -q HEAD)
23
+ if [[ "$current_branch" == *gh-pages* ]]
24
+ then
25
+ #copy /tmp/jsc/* to current dir, replacing existing files
26
+ cp -rv ${tmp_d}/. ./.
27
+ # commit changes with message from command line or last commit msg
28
+ git add -u
29
+ git add .
30
+ git commit -a -m ${message}
31
+ # push gh-pages branch
32
+ git push
33
+ # checkout $branch
34
+ git checkout ${branch}
35
+ else
36
+ red='\e[0;31m' #red - http://stackoverflow.com/a/5947802/400048
37
+ NC='\e[0m' # No Color
38
+ echo -e "${red}Failed to checkout gh-pages branch, site not published!${NC}"
39
+ fi
40
+ # remove /tmp/jsc
41
+ rm -rf ${tmp_d}
data/bin/jsc_shell.sh ADDED
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ action=$1
3
+ cur_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4
+
5
+ if [ -z "$1" ]
6
+ then #if argument is empty default to publish
7
+ action="publish"
8
+ fi
9
+ shift #effectively get rid of first argument (the action)
10
+ sh ${cur_dir}/jsc_${action}.sh "$@"
Binary file
data/jsc.gemspec CHANGED
@@ -19,4 +19,5 @@ Gem::Specification.new do |s|
19
19
  s.files = `git ls-files`.split("\n")
20
20
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
21
  s.require_paths = ["lib"]
22
+ s.executables << 'jsc'
22
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-scientific
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -63,7 +63,8 @@ description: A group of plugins that make Jekyll sites easier for research publi
63
63
  Includes support for LateX formulas and citations
64
64
  email:
65
65
  - jsc@crlog.info
66
- executables: []
66
+ executables:
67
+ - jsc
67
68
  extensions: []
68
69
  extra_rdoc_files: []
69
70
  files:
@@ -74,6 +75,9 @@ files:
74
75
  - LICENSE
75
76
  - README.md
76
77
  - VERSION
78
+ - bin/jsc
79
+ - bin/jsc_publish.sh
80
+ - bin/jsc_shell.sh
77
81
  - jekyll-scientific-0.0.1.gem
78
82
  - jsc.gemspec
79
83
  - lib/JSCRef.rb