Skip to content

Commit

Permalink
Merge pull request #16 from JoFrhwld/software-page
Browse files Browse the repository at this point in the history
Software page
  • Loading branch information
JoFrhwld authored Dec 15, 2023
2 parents 2992acf + 0e424e5 commit 38f8922
Show file tree
Hide file tree
Showing 23 changed files with 3,783 additions and 97 deletions.
8 changes: 8 additions & 0 deletions _extensions/jofrhwld/codeblocklabel/_extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: Codeblocklabel
author: Josef Fruehwald
version: 1.0.0
quarto-required: ">=1.3.0"
contributes:
filters:
- codeblocklabel.lua

10 changes: 10 additions & 0 deletions _extensions/jofrhwld/codeblocklabel/codeblocklabel.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.langname {
margin-bottom: 0%;
padding-bottom: 0%;
font-style: italic;
font-size:smaller;
}

.sourceCode[id]{
margin-top: 0%;
}
30 changes: 30 additions & 0 deletions _extensions/jofrhwld/codeblocklabel/codeblocklabel.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

-- function Div(el)
-- if el.content[1].t == "CodeBlock" then
-- return pandoc.Para("CodeBlock!")
-- end
-- end

quarto.doc.add_html_dependency({
name = 'codenamelabel',
stylesheets = {'codeblocklabel.css'}
})

function CodeBlock(block)
local newblock = block
if (FORMAT:match "html") and
(block.classes[1]) then
local langname = block.classes[1]
out = {pandoc.Div(
pandoc.RawInline("html",
"<pre class='langname'>"..block.classes[1].."</pre>"
),
pandoc.Attr("", {"langname"}, {})
),
newblock
}
else
out = newblock
end
return out
end
22 changes: 20 additions & 2 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ project:
- teaching
#- papers
render:
- "*.qmd"
- "*qmd"
- "*ipynb"
- "!papers/*/*qmd"
- "!teaching/courses/2022_lin517/src"
- "!*/skeleton"
- "!**/*_files/"

filters:
- codeblocklabel

website:
google-analytics:
tracking-id: "G-C00S3NPL7B"
Expand All @@ -22,8 +27,20 @@ website:
text: Home
- href: research/index.qmd
text: Research
- href: software/index.qmd
text: Software
- href: teaching/index.qmd
text: Teaching
right:
- href: https://jofrhwld.github.io/blog/
text: Blog
icon: newspaper
- href: https://bsky.app/profile/jofrhwld.bsky.social
icon: clouds
text: bsky
- href: https://github.com/JoFrhwld
icon: github

format:
html:
theme:
Expand All @@ -36,6 +53,7 @@ format:
- styles/dark.scss
- styles/styles.scss
toc: true


editor: visual

151 changes: 76 additions & 75 deletions make_qmd.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,33 @@
"metadata": {},
"source": [
"---\n",
"execute: false\n",
"title: \"Make research pages\"\n",
"execution:\n",
" eval: false\n",
"---"
]
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#| eval: false\n",
"! pip install pyzotero\n",
"! pip install git+https://github.com/JoFrhwld/zotero2qmd.git"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`zoetero2qmd` is a quick and dirty package I wrote to convert the output from `pyzotero` to compatible data structures for quarto headers."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -23,24 +43,30 @@
"from pathlib import Path"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you are reusing this code, you'll need to get your own API key: [pyzotero getting started](https://pyzotero.readthedocs.io/en/latest/#getting-started-short-version)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"keypath = Path(\".zotero\")\n",
"with keypath.open() as keyfile:\n",
" key_text = keyfile.readline().strip()"
" key_text = keyfile.readline().strip()\n",
"zot = zotero.Zotero(library_id='7642731', library_type='user', api_key=key_text) "
]
},
{
"cell_type": "code",
"execution_count": 3,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"zot = zotero.Zotero(library_id='7642731', library_type='user', api_key=key_text)"
"The `zotero.Zotero.publications()` method pulls down all citations you've added to \"My Publications\"."
]
},
{
Expand All @@ -53,48 +79,52 @@
]
},
{
"cell_type": "code",
"execution_count": 5,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"filtered_pubs = filter_pubs(pubs)"
"Everything that isn't a talk is going into one big pile for now. I'll figure out what to do with talks later. Also, I don't know why I started using \"main\" to refer to the publication info."
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"filtered_pubs = filter_pubs(pubs)\n",
"all_mains = [item2main(x) for x in filtered_pubs]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Each dictionary can be yaml dumped into valid quarto headings."
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'params': {'key': 'M3E7A7LS', 'notes': ''},\n",
" 'author': [{'name': {'given': 'Ingrid', 'family': 'Rosenfelder'}},\n",
" {'name': {'given': 'Josef', 'family': 'Fruehwald'}},\n",
" {'name': {'given': 'Keelan', 'family': 'Evanini'}},\n",
" {'name': {'given': 'Jiahong', 'family': 'Yuan'}}],\n",
" 'title': 'FAVE (Forced Alignment and Vowel Extraction) Program Suite.',\n",
" 'date': '2011',\n",
"{'params': {'key': 'BNWT43F9', 'notes': 'DOI: 10.5281/ZENODO.10212099'},\n",
" 'author': [{'name': {'given': 'Josef', 'family': 'Fruehwald'}},\n",
" {'name': {'given': 'Santiago', 'family': 'Barreda'}}],\n",
" 'title': 'fasttrackpy',\n",
" 'date': '2023-11-28',\n",
" 'date-format': 'YYYY',\n",
" 'description': 'v0.0.0',\n",
" 'abstract': '',\n",
" 'description': 'v0.3.0',\n",
" 'abstract': 'This is a python implementation of the FastTrack method.',\n",
" 'citation': {'type': 'software',\n",
" 'issued': '2011',\n",
" 'url': 'http://fave.ling.upenn.edu/',\n",
" 'version': 'v0.0.0'}}"
" 'issued': '2023-11-28',\n",
" 'url': 'https://fasttrackiverse.github.io/fasttrackpy/',\n",
" 'version': 'v0.3.0'}}"
]
},
"execution_count": 7,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -103,9 +133,16 @@
"all_mains[0]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"It took a bit of work to generate mostly legible but unique file names. I decided to append the Zotero `key` value to each."
]
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -122,65 +159,36 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"all_stems = make_file_names(all_mains)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"cell_type": "markdown",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Rosenfelder_2011_M3E7A7LS',\n",
" 'Rosenfelder_2015_K57PJ2RE',\n",
" 'Rosenfelder_2022_TRXWWXD2',\n",
" 'Fruehwald_2023_GY5I9QMZ',\n",
" 'Fruehwald_2019_URYFVWHE',\n",
" 'Tanner_2020_GH2LZM4Y',\n",
" 'Purse_2022_LIGPGR5R',\n",
" 'Mielke_2019_U5C56KNR',\n",
" 'Labov_2013_QZP9CAP8',\n",
" 'Fruehwald_2013_W28LR5KT',\n",
" 'Fruehwald_2011_LPQN5R3M',\n",
" 'Fruehwald_2022_H347UNLS',\n",
" 'Fruehwald_2017_ETG527QQ',\n",
" 'Fruehwald_2012_7HNEQZ7H',\n",
" 'Fruehwald_2008_IZLBZKZV',\n",
" 'Fruehwald_2007_MG8DFJEK',\n",
" 'Boyd_2021_733Q4MMI',\n",
" 'Fruehwald_2016_TCTQU8FS',\n",
" 'Wieling_2016_FU9RXCUV',\n",
" 'Sneller_2019_8ERVHBSG',\n",
" 'Fruehwald_2015_TJI9T9W6',\n",
" 'Fruehwald_2017_258NF56V',\n",
" 'Fruehwald_2016_34D4IRNY',\n",
" 'Fruehwald_2013_H3BZPAT7']"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"all_stems"
"I started dumping everything into \"papers\"... so now I'm stuck with it."
]
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"out_path = Path(\"research\",\"papers\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"I only want to write new files, since I may manually edit the results here and there."
]
},
{
"cell_type": "code",
"execution_count": 10,
Expand All @@ -194,13 +202,6 @@
" qmd_string = \"---\\n\"+yaml.dump(item)+\"\\n---\"\n",
" out_file.write_text(qmd_string)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Loading

0 comments on commit 38f8922

Please sign in to comment.