{"id":23473001,"url":"https://github.com/caltechlibrary/codemeta-pandoc-examples","last_synced_at":"2026-03-20T01:30:23.753Z","repository":{"id":166819470,"uuid":"642403364","full_name":"caltechlibrary/codemeta-pandoc-examples","owner":"caltechlibrary","description":"This repository describes how to generate a CITATION.cff, about.md and installer.sh from a codemeta.json file using Pandoc.","archived":true,"fork":false,"pushed_at":"2025-04-11T19:19:06.000Z","size":212,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-13T05:49:49.634Z","etag":null,"topics":["citation-cff","codemeta","installer-automation","installer-script","pandoc","pandoc-templates"],"latest_commit_sha":null,"homepage":"https://caltechlibrary.github.io/codemeta-pandoc-examples","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caltechlibrary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":"codemeta.json","zenodo":null}},"created_at":"2023-05-18T13:42:36.000Z","updated_at":"2025-04-11T19:19:19.000Z","dependencies_parsed_at":"2025-04-11T19:02:12.698Z","dependency_job_id":null,"html_url":"https://github.com/caltechlibrary/codemeta-pandoc-examples","commit_stats":null,"previous_names":["caltechlibrary/curl-installer-sh-example","caltechlibrary/curl-installer-sh"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caltechlibrary%2Fcodemeta-pandoc-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caltechlibrary%2Fcodemeta-pandoc-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caltechlibrary%2Fcodemeta-pandoc-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caltechlibrary%2Fcodemeta-pandoc-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caltechlibrary","download_url":"https://codeload.github.com/caltechlibrary/codemeta-pandoc-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670501,"owners_count":21142901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["citation-cff","codemeta","installer-automation","installer-script","pandoc","pandoc-templates"],"created_at":"2024-12-24T17:14:41.240Z","updated_at":"2026-03-20T01:30:23.675Z","avatar_url":"https://github.com/caltechlibrary.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Codemeta + Pandoc Examples\n\nThis has been replaced by [https://github.com/SciCodes/somef-core](https://github.com/caltechlibrary/CMTools)\n\nIn this repository you see three examples of using Pandoc, Pandoc templates and codemeta.json to create an [about page](about.md), a [CITATION.cff](CITATION.cff) and an [installer.sh](https://caltechlibrary.github.io/irdmtools/installer.sh) file.\n\n## Generating a CITATION.cff\n\nThe codemeta.json file can be use to generate a CITATION.cff file using the Pandoc template [codemeta-cff.tmpl](codemeta-cff.tmpl).\n\n~~~shell\n    echo '' | pandoc -s --metadata title='Citation' \\\n                        --metadata-file codemeta.json \\\n                        --template codemeta-cff.tmpl \\\n                        \u003eCITATION.cff\n~~~\n\n## Generating an about page\n\nLike [CITATION.cff](CITATION.cff) we can generate a standard about page,\n[about.md](about.md) from our codemeta.json using the Pandoc template [codemeta-about.tmpl](codemeta-about.tmpl).\n\n~~~shell\n    echo '' | pandoc -s --metadata title='About' \\\n                        --metadata-file codemeta.json \\\n                        --template codemeta-about.tmpl \\\n                        \u003eabout.md\n~~~\n\n## Generating version.sql\n\nIf you're building a Postgres+PostgREST application it is nice to have\nan end point the shows the name and version of the web application you\nare building. This can be done with the [codemeta-version-sql.tmpl](codemeta-version-sql.tmpl) Pandoc template.\n\n~~~shell\n    echo '' | pandoc -s metadata title='Version Info' \\\n                     --metadata-file codemeta.json \\\n                     --template codemete-version-sql.tmpl \\\n                     \u003eversion.sql\n~~~\n\n\n## Generating an installer.sh\n\nThe nice thing about the Pandoc approach is you can also use it as\na shell script generator. Today (2023) many software tools[1] developers\nuse have installation instructions like\n\n~~~shell\n    curl https://caltechlibrary.github.io/datatools/installer.sh | sh\n~~~\n\nWith a single POSIX shell installer script you easily install your\ntools on macOS and Linux.\n\nThe codemeta.json file provides much of what is needed to generate the\ninstaller script from [codemeta-installer.tmpl](codemeta-installer.tmpl).\nThere are three addition Pandoc metadata variables needed not explicitly found in the codemeta.json. The installer script expects to use a Zip file as an q\u003cF5\u003e0Additionally you need to name the zip archive of the content to be installed needs to be predictably named.\n\nTo have Pandoc generate a workable installer script requires to parts.\nFirst the name of your installation zip files need to be predictable. \n\nSecondly the codemeta-installer.tmpl file needs to know some metadata inorder for the generated script to be runable.\n\nThe [codemeta.json] file provides much of the information\nneeded to render our **installer.sh**. Our template, \ndoes make some specific assumptions\n\n- You've installation files are in a zip archive\n- There hosted under the GitHub in the releases directory for your repository\n- The name of the zip file is in the form of `\u003cPACKAGE\u003e-v\u003cVERSION\u003e-\u003cOS_NAME\u003e-\u003cARCHITECTURE\u003e.zip`\n- The version number in the codemeta.json file does NOT have a leading 'v'\n- curl is available on the machine where you want to install the software and it has a network connection\n\nPACKAGE\n: This would be the name of your Git repository, e.g. datatools\n\nVERSION\n: This would be the version number without the leading \"v\", e.g. \"0.0.1\"\n\nOS_NAME\n: would be \"macOS\", \"Linux\" or \"Windows\"\n\nMACHINE-TYPE\n: This would be what is reported by the command `uname -m`\n\nRendering the **installer.sh** file can be done with the following Pandoc command.\n\n~~~\necho '' | pandoc -s --metadata title='Installer' \\\n            --metadata-file codemeta.json \\\n            --template installer.sh\n~~~\n\nIf you host this installer script can then be uploaded to your website. The\ncurl command would be of the form\n\n~~~\n    curl \u003cURL_TO_SITE\u003e/installer.sh | sh\n~~~\n\n\n[1]: Examples Rust with [Rustup](https://rustup.rs/) and Haskell's [GHCup](https://www.haskell.org/ghcup/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaltechlibrary%2Fcodemeta-pandoc-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaltechlibrary%2Fcodemeta-pandoc-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaltechlibrary%2Fcodemeta-pandoc-examples/lists"}