From a588f9744b38c2ebbaaec586f87b37a1e3022e86 Mon Sep 17 00:00:00 2001 From: Tomeriko96 Date: Fri, 12 Jan 2024 13:12:23 +0100 Subject: [PATCH] feat: organize reference page --- .Rbuildignore | 1 + README.md | 5 ++++ _pkgdown.yml | 24 +++++++++++++++++++ .../data_reference_index_missing.R | 20 ++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 helperfunctions/data_reference_index_missing.R diff --git a/.Rbuildignore b/.Rbuildignore index 4de8e5f..9f17337 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -7,6 +7,7 @@ ^.*.pdf$ ^cran-comments\.md$ ^CRAN-SUBMISSION$ +^helperfunctions$ ^\.github$ ^_pkgdown\.yml$ ^docs$ diff --git a/README.md b/README.md index c5bebd0..308201d 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,11 @@ Currently, the package has functions to communicate with the following services: - Linguee API +# Features +To see which functions are available, please refer to the reference page of the `polyglotr` package. The [reference](https://Tomeriko96.github.io/polyglotr/reference/index.html) page provides a comprehensive list of functions available in the package, organized by category. + +Additionally, the package includes vignettes that provide more detailed information on how to use the functions in the package. + # Installation To install the package: diff --git a/_pkgdown.yml b/_pkgdown.yml index 1b0a9b9..2df7e90 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -2,3 +2,27 @@ url: https://tomeriko96.github.io/polyglotr/ template: bootstrap: 5 +reference: + - title: Google Translation Methods + desc: Methods using Google Translation services + contents: + - batch_translate + - create_translation_table + - google_get_supported_languages + - google_is_valid_language_code + - google_supported_languages + - google_translate + - language_detect + - translate_file + + - title: Linguee Methods + desc: Methods using Linguee services + contents: + - linguee_external_sources + - linguee_translation_examples + - linguee_word_translation + + - title: MyMemory Methods + desc: Methods using MyMemory Translation services + contents: + - mymemory_translate diff --git a/helperfunctions/data_reference_index_missing.R b/helperfunctions/data_reference_index_missing.R new file mode 100644 index 0000000..65db087 --- /dev/null +++ b/helperfunctions/data_reference_index_missing.R @@ -0,0 +1,20 @@ +library(purrr) +data_reference_index_missing <- function(pkg = ".", depth = 1L) { + pkg <- pkgdown:::as_pkgdown(pkg) + + meta <- pkg$meta[["reference"]] %||% pkgdown:::default_reference_index(pkg) + if (length(meta) == 0) { + return(list()) + } + + # Cross-reference complete list of topics vs. topics found in index page + all_topics <- meta %>% + map(~ pkgdown:::select_topics(.$contents, pkg$topics)) %>% + reduce(union) + in_index <- seq_along(pkg$topics$name) %in% all_topics + + missing <- !in_index & !pkg$topics$internal + pkg$topics$name[missing] +} + +data_reference_index_missing()