diff --git a/_extensions/seedcase-theme/_extension.yml b/_extensions/seedcase-theme/_extension.yml index f1c2213..dd0a017 100644 --- a/_extensions/seedcase-theme/_extension.yml +++ b/_extensions/seedcase-theme/_extension.yml @@ -1,12 +1,11 @@ title: seedcase-theme author: Luke W. Johnston -version: 1.0.0 +version: 1.0.1 quarto-required: ">=1.2.0" contributes: formats: common: shortcodes: - - debruine/glossary - quarto-ext/fontawesome html: from: markdown+emoji @@ -15,11 +14,6 @@ contributes: toc-depth: 3 project: - glossary: - path: glossary.yml - popup: none - show: true - project: type: website execute-dir: project diff --git a/_extensions/seedcase-theme/_extensions/debruine/glossary/_extension.yml b/_extensions/seedcase-theme/_extensions/debruine/glossary/_extension.yml deleted file mode 100644 index 5e7ea7e..0000000 --- a/_extensions/seedcase-theme/_extensions/debruine/glossary/_extension.yml +++ /dev/null @@ -1,7 +0,0 @@ -title: Glossary -author: Lisa DeBruine -version: 1.0.0 -quarto-required: ">=1.2.0" -contributes: - shortcodes: - - glossary.lua diff --git a/_extensions/seedcase-theme/_extensions/debruine/glossary/glossary.css b/_extensions/seedcase-theme/_extensions/debruine/glossary/glossary.css deleted file mode 100644 index 38f978c..0000000 --- a/_extensions/seedcase-theme/_extensions/debruine/glossary/glossary.css +++ /dev/null @@ -1,56 +0,0 @@ -.glossary { - color: purple; - text-decoration: underline; - cursor: help; - position: relative; - border: none; - padding: 0; -} - -/* only needed for popup = "click" */ -/* popup-definition */ -.glossary .def { - display: none; - position: absolute; - z-index: 1; - width: 200px; - bottom: 100%; - left: 50%; - margin-left: -100px; - background-color: #333; - color: white; - padding: 5px; - border-radius: 6px; -} -/* show on click */ -.glossary:active .def { - display: inline-block; -} -/* triangle arrow */ -.glossary:active .def::after { - content: ' '; - position: absolute; - top: 100%; - left: 50%; - margin-left: -5px; - border-width: 5px; - border-style: solid; - border-color: #333 transparent transparent transparent; -} - -/* glossary table styles */ -.glossary_table td { - vertical-align: top; -} - -.glossary_table td:first-child { - padding-right: 1em; -} - -.glossary_table tr { - border-bottom: 1px solid #ddd; -} - -.glossary_table tr:nth-child(even) { - background-color: #99999933; -} diff --git a/_extensions/seedcase-theme/_extensions/debruine/glossary/glossary.lua b/_extensions/seedcase-theme/_extensions/debruine/glossary/glossary.lua deleted file mode 100644 index 0130e72..0000000 --- a/_extensions/seedcase-theme/_extensions/debruine/glossary/glossary.lua +++ /dev/null @@ -1,174 +0,0 @@ --- Glossary.lua --- Author: Lisa DeBruine - --- Global glossary table -globalGlossaryTable = {} - --- Helper Functions - -local function addHTMLDeps() - -- add the HTML requirements for the library used - quarto.doc.add_html_dependency({ - name = 'glossary', - stylesheets = {'glossary.css'} - }) -end - -local function kwExists(kwargs, keyword) - for key, value in pairs(kwargs) do - if key == keyword then - return true - end - end - return false -end - --- Function to sort a Lua table by keys -function sortByKeys(tbl) - local sortedKeys = {} - - -- Extract keys from the table and store them in the 'sortedKeys' array - for key, _ in pairs(tbl) do - table.insert(sortedKeys, key) - end - - -- Sort the keys alphabetically - table.sort(sortedKeys) - - -- Create a new table with the sorted keys - local sortedTable = {} - for _, key in pairs(sortedKeys) do - sortedTable[key] = tbl[key] - end - - return sortedTable -end - -local function read_metadata_file(fname) - local metafile = io.open(fname, 'r') - local content = metafile:read("*a") - metafile:close() - local metadata = pandoc.read(content, "markdown").meta - return metadata -end - -local function readGlossary(path) - local f = io.open(path, "r") - if not f then - io.stderr:write("Cannot open file " .. path) - else - local lines = f:read("*all") - f:close() - return(lines) - end -end - ----Merge user provided options with defaults ----@param userOptions table -local function mergeOptions(userOptions, meta) - local defaultOptions = { - path = "glossary.yml", - popup = "hover", - show = true, - add_to_table = true - } - - -- override with meta values first - if meta.glossary ~= nil then - for k, v in pairs(meta.glossary) do - local value = pandoc.utils.stringify(v) - if value == 'true' then value = true end - if value == 'false' then value = false end - defaultOptions[k] = value - end - end - - -- then override with function keyword values - if userOptions ~= nil then - for k, v in pairs(userOptions) do - local value = pandoc.utils.stringify(v) - if value == 'true' then value = true end - if value == 'false' then value = false end - defaultOptions[k] = value - end - end - - return defaultOptions -end - - --- Main Glossary Function Shortcode - -return { - -["glossary"] = function(args, kwargs, meta) - - -- this will only run for HTML documents - if not quarto.doc.isFormat("html:js") then - return pandoc.Null() - end - - addHTMLDeps() - - -- create glossary table - if kwExists(kwargs, "table") then - local gt = "\n" - gt = gt .. "\n" - - local sortedTable = sortByKeys(globalGlossaryTable) - - for key, value in pairs(sortedTable) do - gt = gt .. "\n" - end - gt = gt .. "
Term Definition
" .. key - gt = gt .. "" .. value .. "
" - - return pandoc.RawBlock('html', gt) - end - - -- or set up in-text term - local options = mergeOptions(kwargs, meta) - - local display = pandoc.utils.stringify(args[1]) - local term = string.lower(display) - - if kwExists(kwargs, "display") then - display = pandoc.utils.stringify(kwargs.display) - end - - -- get definition - local def = "" - if kwExists(kwargs, "def") then - def = pandoc.utils.stringify(kwargs.def) - else - local metafile = io.open(options.path, 'r') - local content = "---\n" .. metafile:read("*a") .. "\n---\n" - metafile:close() - local glossary = pandoc.read(content, "markdown").meta - for key, value in pairs(glossary) do - glossary[string.lower(key)] = value - end - -- quarto.log.output() - if kwExists(glossary, term) then - def = pandoc.utils.stringify(glossary[term]) - end - end - - -- add to global table - if options.add_to_table then - globalGlossaryTable[term] = def - end - - if options.popup == "hover" then - glosstext = "" - elseif options.popup == "click" then - glosstext = "" - elseif options.popup == "none" then - glosstext = "" - end - - return pandoc.RawInline("html", glosstext) - -end - -} diff --git a/_extensions/seedcase-theme/glossary.json b/_extensions/seedcase-theme/glossary.json new file mode 100644 index 0000000..bb1c61d --- /dev/null +++ b/_extensions/seedcase-theme/glossary.json @@ -0,0 +1,18 @@ +[ + { + "item": "data", + "description": "Data can mean any piece of information that someone would like to use to answer questions. What is considered data (and metadata) is highly dependent on people and what they intend to do with information that is collected. In the context of Seedcase Sprout, data is any information collected for the purposes of doing analyses on them to answer questions. An example might be data collected from people participating in a study on health and disease." + }, + { + "item": "data package", + "description": "A \"container\" for data that describes a coherent collection of data. It consists of two parts: data resources and properties." + }, + { + "item": "data resource", + "description": "A single piece of data, such as a table or data file, and its properties, included in a data package. It contains the actual data, documented following the Data Package standard." + }, + { + "item": "properties", + "description": "Metadata that describes the entire data package and each of the data resources within it. At the package level, the properties include the package name and description, contributors, licenses, and more. At the resource level, they describe attributes such as the resource name, description, schema, and data fields. All properties are stored in `datapackage.json` in the root directory of the package." + } +] diff --git a/_extensions/seedcase-theme/glossary.yml b/_extensions/seedcase-theme/glossary.yml deleted file mode 100644 index f39c92e..0000000 --- a/_extensions/seedcase-theme/glossary.yml +++ /dev/null @@ -1,20 +0,0 @@ -data: | - Data can mean any piece of information that someone would like to use - to answer questions. What is considered data (and metadata) is highly dependent - on people and what they intend to do with information that is collected. - In the context of Seedcase Sprout, data is any information collected for the - purposes of doing analyses on them to answer questions. An example might be - data collected from people participating in a study on health and disease. -data package: | - A "container" for data that describes a coherent collection of data. It consists - of two parts: data resources and properties. -data resource: | - A single piece of data, such as a table or data file, and its properties, included - in a data package. It contains the actual data, documented following the Data Package - standard. -properties: | - Metadata that describes the entire data package and each of the data resources - within it. At the package level, the properties include the package name and - description, contributors, licenses, and more. At the resource level, they describe - attributes such as the resource name, description, schema, and data fields. - All properties are stored in `datapackage.json` in the root directory of the package. diff --git a/index.qmd b/index.qmd index 4c789cc..4735405 100644 --- a/index.qmd +++ b/index.qmd @@ -56,10 +56,6 @@ def hello_world(): print("Hello, world!") ``` -{{< glossary data >}} {{< glossary properties >}} - -{{< glossary table=true >}} - ## Simple mermaid diagram ::: column-page