command line switches, basic README

master
Miloš Jovanović 5 years ago
parent d7b78baa2b
commit d0368afaf5

Binary file not shown.

@ -1,27 +0,0 @@
# Best Paper Ever
## Abstract
This paper *deals* with the development of text, as argued by [@harveyParisCapitalModernity2003, p. 32]. Likewise, as he points out, the following text is inappropriate for thsoe not well versed in _Marxist_ theory. See for example the argument
## Introduction
Here I introduce the concept of marijuana and its effects on the human body. [^fn1]
## Conclusion
Anderson's text situates the emergence of the "sick man of Europe" in the per between the Treaty of Kucuk-Kaynarca (1774) and the Treaty of Lausanne (1923) This is a standard interpretation of Ottoman decline which examines it from the perspective of diplomatic history and international relations. Likewise it is a view from outside, with very few Ottoman documents utilized.
The basic skeleton emerges by the following divisions - the weakness of the empire becomes evident by Russian successes in the 1768-1774 war and the general disfunction of a huge political system and a vast empire. This is followed by the emergence of the capitulatory system, where European states began to use Ottoman subjects as proxies for their interests. Followed by the influence of the Napoleonic Wars, Balkan nationalism grew and culminated with the Greek War of Independence. This was was successful for a number of factors, but decidedly because of its joint happenstance with the Mohammed Ali revolt. This was followed by a secondary crisis and the Ottomans became more of a theatre of war for European powers with the Crimean war - Britain vs. Russia basically. The Congress of Berlin attempts to partially resolve the Eastern Crisis of 1875-1878. This is followed by a short attempt to modernize which only really signified the greater penetration and intersection of European influences in the empire, which culminated in the weakness that gave the Balkan states their victory in the Balkan Wars, and lead to the disastrous Peace Settlement that destroyed the Empire and created the Turkish Republic as the most stable political structure in the Middle East.
random text to make two pages Anderson's text situates the emergence of the "sick man of Europe" in the per between the Treaty of Kucuk-Kaynarca (1774) and the Treaty of Lausanne (1923) This is a standard interpretation of Ottoman decline which examines it from the perspective of diplomatic history and international relations. Likewise it is a view from outside, with very few Ottoman documents utilized.
The basic skeleton emerges by the following divisions - the weakness of the empire becomes evident by Russian successes in the 1768-1774 war and the general disfunction of a huge political system and a vast empire. This is followed by the emergence of the capitulatory system, where European states began to use Ottoman subjects as proxies for their interests. [@andersonEasternQuestion177419231966] Followed by the influence of the Napoleonic Wars, Balkan nationalism grew and culminated with the Greek War of Independence. This was was successful for a number of factors, but decidedly because of its joint happenstance with the Mohammed Ali revolt. This was followed by a secondary crisis and the Ottomans became more of a theatre of war for European powers with the Crimean war - Britain vs. Russia basically. [^fn2] The Congress of Berlin attempts to partially resolve the Eastern Crisis of 1875-1878. This is followed by a short attempt to modernize which only really signified the greater penetration and intersection of European influences in the empire, which culminated in the weakness that gave the Balkan states their victory in the Balkan Wars, and lead to the disastrous Peace Settlement that destroyed the Empire and created the Turkish Republic as the most stable political structure in the Middle East.
[^fn1]: As argued by [@todorovaTrapBackwardnessModernity2005]
[^fn2]: [@andersonEasternQuestion177419231966, p. 46]
# Bibliography

@ -1,3 +1,49 @@
# Markdown Academic # Markdown Academic
This is a repository of tools to help in the writing, use, and conversion of markdown files for academics. It is a work in progress. This is a bash script which helps convert markdown files into properly formatted Word files for academics. It is a work in progress.
## Workflow
The script lets you write your document in Markdown, and then convert it to a valid .docx using almost any citation style.
You will need to download [citation-styles](https://github.com/citation-style-language/styles), and specify the one you want to use in the command line switches.
For the converter to know what works you are citing, you will need a .bib library file with the citations. I recommend using Zotero and [BetterBiBTeX](https://retorque.re/zotero-better-bibtex/) to keep track of your books and articles and what not. The extension should autoupdating your citations with unique keys that way.
Finally, you will need a reference file, so markdownacademic will know what your document should look like - what the margins and fonts are, etc. You can often download a reference .docx file from the journal you're writing for. A sample file `reference.docx` is included.
* TODO Why should I do this?
* Uses little memory, write comfortably on a computer from 1984
* Don't need Word to write a proper file that can be submitted to a journal
* Document is a regular text file, will never suffer planned obsolescence
* Track your changes and collaborate using Git
* Quickly change the formatting of your output document
* Quickly change citation style into any style you want
* TODO Vim tips and tricks
## Installation
Put the script in your executable directory (`~/.local/share/bin` on most Linux distributions.
### Dependencies
```
bash
pandoc
```
## Usage
You can print usage by running ``markdownacademic --usage``
```
Usage: markdownacademic -bctih
-b, --bibliography=<filename> Set your BibTex file here
-c, --citationstyle=<filename> Set CSL style
-t, --template=<filename> Set template file (.docx)
-i, --input=<filename> Select markdown file as input
-h, --help Display this help message
Unless specified, output file has the same name as the input file.
```

@ -0,0 +1,64 @@
#!/bin/bash
# depends on pandoc-citeproc, GNU getopts
showHelp () {
cat << EOF
Usage: markdownacademic -bctih
-b, --bibliography=<filename> Set your BibTex file here
-c, --citationstyle=<filename> Set CSL style
-t, --template=<filename> Set template file (.docx)
-i, --input=<filename> Select markdown file as input
-h, --help Display this help message
Unless specified, output file has the same name as the input file.
EOF
}
SHORT=b:c:t:i:o::h
LONG=bibliography:,citationstyle:,template:,input:,output,help
# read the options
OPTS=$(getopt --options $SHORT --long $LONG --name "$0" -- "$@")
if [ $? != 0 ] ; then echo "Failed to parse options...exiting." >&2 ; exit 1 ; fi
eval set -- "$OPTS"
# extract options and their arguments into variables.
while true ; do
case "$1" in
-b | --bibliography )
BIBLIOGRAPHY="$2"
shift 2
;;
-c | --citationstyle )
CITATIONSTYLE="$2"
shift 2
;;
-t | template )
TEMPLATE="$2"
shift 2
;;
-i | input )
FILE="$2"
shift 2
;;
-h | help )
showHelp
exit 0
;;
--) shift ; break;;
*) if [-z "$1" ]; then break; else showHelp ; exit 0; fi;;
esac
done
# Print the variables
#echo $BIBLIOGRAPHY
#echo $CITATIONSTYLE
#echo $TEMPLATE
#echo $FILE
pandoc --verbose -s --filter=/usr/bin/pandoc-citeproc --bibliography="$BIBLIOGRAPHY" --csl=$CITATIONSTYLE --reference-doc="$TEMPLATE" -f markdown -t docx --output="$(basename "$FILE" .md).docx" "$FILE"
echo -e ""
echo -e "\e[0;32mSuccess!\e[0m Output file is \e[0;33m$(basename "$FILE" .md).docx\e[0m"
echo -e ""

Binary file not shown.

@ -1,7 +0,0 @@
#!/bin/bash
# depends on pandoc-citeproc
# needs https://github.com/citation-style-language/styles to be in ~/src/styles
title=$(basename "$@" .md)
echo -e "\n\n# Bibliography" >> "$@"
pandoc -s --filter=/usr/bin/pandoc-citeproc --bibliography ~/Seafile/zotero/My\ Library.bib --csl ~/src/styles/chicago-author-date-16th-edition.csl --reference-doc ~/src/markdownacademic/reference.docx -f markdown -t docx -o "$title".docx "$@"
Loading…
Cancel
Save