Skip to content

Instantly share code, notes, and snippets.

@dubsnipe
Created December 16, 2020 23:23
Show Gist options
  • Save dubsnipe/93e3925fa5dbeab4bfb0419858b7eedc to your computer and use it in GitHub Desktop.
Save dubsnipe/93e3925fa5dbeab4bfb0419858b7eedc to your computer and use it in GitHub Desktop.
github2mediawiki <- function(manifest_url) {
okh_tmp <- tempfile()
download.file(paste0(manifest_url, "?raw=true"), okh_tmp)
manifest <- read_yaml(okh_tmp)
manifest_text <- paste0(
"{{Infobox device\n",
"|image=", manifest$image, "<!-- Please consider uploading image to Appropedia. -->\n",
"|description=", manifest$description, "\n",
"|keywords=", manifest$keywords, "\n",
"|uses=", manifest$`intended-use`, "\n",
"|variant-of=", manifest$`variant-of`, "\n",
"|authors=", manifest$contact, "\n",
"|status=", manifest$`development-stage`, "\n",
"|made=", manifest$made, "\n",
"|replicated=", manifest$`made-independently`, "\n",
"|date-completed=", manifest$`date-created`, "\n",
# "|date-published=", "\n",
"|date-updated=", manifest$`date-updated`, "\n",
# "|sdg=", "\n",
"|documentation-home=", manifest$`documentation-home`, "\n",
"|documentation-language=", "\n",
# "|documentation-is-translation-title=", "\n",
# "|documentation-is-translation-web=", "\n",
# "|documentation-is-translation-manifest=", "\n",
# "|documentation-is-translation-language=", "\n",
"|manifest-language=", manifest$`manifest-language`, "\n",
"|manifest-author-name=", manifest$`manifest-author`, "\n",
"}}\n\n",
manifest$description, "\n\n[[Category:Ported from OKH Manifest]]"
)
writeClipboard(manifest_text)
browseURL(paste0("https://www.appropedia.org/w/index.php?title=", manifest$title, "&action=edit"))
unlink(okh_tmp)
return(manifest_text)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment