|
9 | 9 | "source": [
|
10 | 10 | "# Publications markdown generator for academicpages\n",
|
11 | 11 | "\n",
|
12 |
| - "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", |
| 12 | + "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", |
13 | 13 | "\n",
|
14 | 14 | "TODO: Make this work with BibTex and other databases of citations, rather than Stuart's non-standard TSV format and citation style.\n"
|
15 | 15 | ]
|
|
24 | 24 | "\n",
|
25 | 25 | "- `excerpt` and `paper_url` can be blank, but the others must have values. \n",
|
26 | 26 | "- `pub_date` must be formatted as YYYY-MM-DD.\n",
|
27 |
| - "- `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]`" |
| 27 | + "- `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", |
| 28 | + "\n", |
| 29 | + "This is how the raw file looks (it doesn't look pretty, use a spreadsheet or other program to edit and create)." |
28 | 30 | ]
|
29 | 31 | },
|
30 | 32 | {
|
|
211 | 213 | "source": [
|
212 | 214 | "## Creating the markdown files\n",
|
213 | 215 | "\n",
|
214 |
| - "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\")" |
| 216 | + "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." |
215 | 217 | ]
|
216 | 218 | },
|
217 | 219 | {
|
|
254 | 256 | " md += \"\\n---\"\n",
|
255 | 257 | " \n",
|
256 | 258 | " ## Markdown description for individual page\n",
|
257 |
| - " \n", |
258 |
| - " if len(str(item.paper_url)) > 5:\n", |
259 |
| - " md += \"\\n\\n<a href='\" + item.paper_url + \"'>Download paper here</a>\\n\" \n", |
260 | 259 | " \n",
|
261 | 260 | " if len(str(item.excerpt)) > 5:\n",
|
262 | 261 | " md += \"\\n\" + html_escape(item.excerpt) + \"\\n\"\n",
|
| 262 | + " \n", |
| 263 | + " if len(str(item.paper_url)) > 5:\n", |
| 264 | + " md += \"\\n[Download paper here](\" + item.paper_url + \")\\n\" \n", |
263 | 265 | " \n",
|
264 | 266 | " md += \"\\nRecommended citation: \" + item.citation\n",
|
265 | 267 | " \n",
|
|
269 | 271 | " f.write(md)"
|
270 | 272 | ]
|
271 | 273 | },
|
| 274 | + { |
| 275 | + "cell_type": "markdown", |
| 276 | + "metadata": {}, |
| 277 | + "source": [ |
| 278 | + "These files are in the publications directory, one directory below where we're working from." |
| 279 | + ] |
| 280 | + }, |
272 | 281 | {
|
273 | 282 | "cell_type": "code",
|
274 | 283 | "execution_count": 6,
|
|
314 | 323 | "paperurl: 'http://academicpages.github.io/files/paper1.pdf'\r\n",
|
315 | 324 | "citation: 'Your Name, You. (2009). "Paper Title Number 1." <i>Journal 1</i>. 1(1).'\r\n",
|
316 | 325 | "---\r\n",
|
317 |
| - "\r\n", |
318 |
| - "<a href='http://academicpages.github.io/files/paper1.pdf'>Download paper here</a>\r\n", |
319 |
| - "\r\n", |
320 | 326 | "This paper is about the number 1. The number 2 is left for future work.\r\n",
|
321 | 327 | "\r\n",
|
| 328 | + "[Download paper here](http://academicpages.github.io/files/paper1.pdf)\r\n", |
| 329 | + "\r\n", |
322 | 330 | "Recommended citation: Your Name, You. (2009). \"Paper Title Number 1.\" <i>Journal 1</i>. 1(1)."
|
323 | 331 | ]
|
324 | 332 | }
|
|
0 commit comments