{ "cells": [ { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "# Publications markdown generator for academicpages\n", "\n", "Takes a TSV of publications with metadata and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook ([see more info here](http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/what_is_jupyter.html)). The core python code is also in `publications.py`. Run either from the `markdown_generator` folder after replacing `publications.tsv` with one containing your data.\n", "\n", "TODO: Make this work with BibTex and other databases of citations, rather than Stuart's non-standard TSV format and citation style.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Data format\n", "\n", "The TSV needs to have the following columns: pub_date, title, venue, excerpt, citation, site_url, and paper_url, with a header at the top. \n", "\n", "- `excerpt` and `paper_url` can be blank, but the others must have values. \n", "- `pub_date` must be formatted as YYYY-MM-DD.\n", "- `url_slug` will be the descriptive part of the .md file and the permalink URL for the page about the paper. The .md file will be `YYYY-MM-DD-[url_slug].md` and the permalink will be `https://[yourdomain]/publications/YYYY-MM-DD-[url_slug]`\n", "\n", "This is how the raw file looks (it doesn't look pretty, use a spreadsheet or other program to edit and create)." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "pub_date\ttitle\tvenue\texcerpt\tcitation\turl_slug\tpaper_url\r\n", "2009-10-01\tPaper Title Number 1\tJournal 1\tThis paper is about the number 1. The number 2 is left for future work.\tYour Name, You. (2009). \"Paper Title Number 1.\" Journal 1. 1(1).\tpaper-title-number-1\thttp://academicpages.github.io/files/paper1.pdf\r\n", "2010-10-01\tPaper Title Number 2\tJournal 1\tThis paper is about the number 2. The number 3 is left for future work.\tYour Name, You. (2010). \"Paper Title Number 2.\" Journal 1. 1(2).\tpaper-title-number-2\thttp://academicpages.github.io/files/paper2.pdf\r\n", "2015-10-01\tPaper Title Number 3\tJournal 1\tThis paper is about the number 3. The number 4 is left for future work.\tYour Name, You. (2015). \"Paper Title Number 3.\" Journal 1. 1(3).\tpaper-title-number-3\thttp://academicpages.github.io/files/paper3.pdf" ] } ], "source": [ "!cat publications.tsv" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Import pandas\n", "\n", "We are using the very handy pandas library for dataframes." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true, "deletable": true, "editable": true }, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Import TSV\n", "\n", "Pandas makes this easy with the read_csv function. We are using a TSV, so we specify the separator as a tab, or `\\t`.\n", "\n", "I found it important to put this data in a tab-separated values format, because there are a lot of commas in this kind of data and comma-separated values can get messed up. However, you can modify the import statement, as pandas also has read_excel(), read_json(), and others." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "
\n", " | pub_date | \n", "title | \n", "venue | \n", "excerpt | \n", "citation | \n", "url_slug | \n", "paper_url | \n", "
---|---|---|---|---|---|---|---|
0 | \n", "2009-10-01 | \n", "Paper Title Number 1 | \n", "Journal 1 | \n", "This paper is about the number 1. The number 2... | \n", "Your Name, You. (2009). \"Paper Title Number 1.... | \n", "paper-title-number-1 | \n", "http://academicpages.github.io/files/paper1.pdf | \n", "
1 | \n", "2010-10-01 | \n", "Paper Title Number 2 | \n", "Journal 1 | \n", "This paper is about the number 2. The number 3... | \n", "Your Name, You. (2010). \"Paper Title Number 2.... | \n", "paper-title-number-2 | \n", "http://academicpages.github.io/files/paper2.pdf | \n", "
2 | \n", "2015-10-01 | \n", "Paper Title Number 3 | \n", "Journal 1 | \n", "This paper is about the number 3. The number 4... | \n", "Your Name, You. (2015). \"Paper Title Number 3.... | \n", "paper-title-number-3 | \n", "http://academicpages.github.io/files/paper3.pdf | \n", "