Skip to content

Commit

Permalink
update talks and publications scripts, data, and notebook for markdow…
Browse files Browse the repository at this point in the history
…n generator
  • Loading branch information
staeiou committed Mar 28, 2017
1 parent 879053a commit 4528221
Show file tree
Hide file tree
Showing 5 changed files with 330 additions and 2,329 deletions.
26 changes: 17 additions & 9 deletions markdown_generator/publications.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"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 that fits your format.\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"
]
Expand All @@ -24,7 +24,9 @@
"\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]`"
"- `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)."
]
},
{
Expand Down Expand Up @@ -211,7 +213,7 @@
"source": [
"## Creating the markdown files\n",
"\n",
"This is where the heavy lifting is done. This loops through all the rows in the TSV dataframe, then starts to concatentate a big string (```md```) that contains the markdown for each type. It does the YAML metadata first, then does the description for the individual page. If you don't want something to appear (like the \"Recommended citation\")"
"This is where the heavy lifting is done. This loops through all the rows in the TSV dataframe, then starts to concatentate a big string (```md```) that contains the markdown for each type. It does the YAML metadata first, then does the description for the individual page."
]
},
{
Expand Down Expand Up @@ -254,12 +256,12 @@
" md += \"\\n---\"\n",
" \n",
" ## Markdown description for individual page\n",
" \n",
" if len(str(item.paper_url)) > 5:\n",
" md += \"\\n\\n<a href='\" + item.paper_url + \"'>Download paper here</a>\\n\" \n",
" \n",
" if len(str(item.excerpt)) > 5:\n",
" md += \"\\n\" + html_escape(item.excerpt) + \"\\n\"\n",
" \n",
" if len(str(item.paper_url)) > 5:\n",
" md += \"\\n[Download paper here](\" + item.paper_url + \")\\n\" \n",
" \n",
" md += \"\\nRecommended citation: \" + item.citation\n",
" \n",
Expand All @@ -269,6 +271,13 @@
" f.write(md)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"These files are in the publications directory, one directory below where we're working from."
]
},
{
"cell_type": "code",
"execution_count": 6,
Expand Down Expand Up @@ -314,11 +323,10 @@
"paperurl: 'http://academicpages.github.io/files/paper1.pdf'\r\n",
"citation: 'Your Name, You. (2009). &quot;Paper Title Number 1.&quot; <i>Journal 1</i>. 1(1).'\r\n",
"---\r\n",
"\r\n",
"<a href='http://academicpages.github.io/files/paper1.pdf'>Download paper here</a>\r\n",
"\r\n",
"This paper is about the number 1. The number 2 is left for future work.\r\n",
"\r\n",
"[Download paper here](http://academicpages.github.io/files/paper1.pdf)\r\n",
"\r\n",
"Recommended citation: Your Name, You. (2009). \"Paper Title Number 1.\" <i>Journal 1</i>. 1(1)."
]
}
Expand Down

0 comments on commit 4528221

Please sign in to comment.