Created
December 16, 2020 23:23
-
-
Save dubsnipe/93e3925fa5dbeab4bfb0419858b7eedc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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