From b6f8000a69b9ce26ce55e3cc1c56e34293c86e52 Mon Sep 17 00:00:00 2001 From: Daniel Gurgel Date: Fri, 21 Jun 2024 07:38:36 -0300 Subject: [PATCH] fix source button and docs --- Cargo.toml | 2 +- README.md | 16 ++++++++-------- rdocs/DESCRIPTION | 2 +- rdocs/R/main.R | 45 ++++++++++++++++++++++++++++----------------- src/main.rs | 2 +- 5 files changed, 39 insertions(+), 28 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c1bc002..0d1a888 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rdocs" -version = "0.1.45" +version = "0.1.46" edition = "2021" repository = "https://github.com/daniellga/rdocs/" diff --git a/README.md b/README.md index b06143a..74f1972 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,13 @@ the code at all, use `run_examples = FALSE`, which is the default. /// HFft /// ## fft /// -/// `fft() -> HArray` \ +/// `fft() -> HArray` /// -/// Computes the fast fourier transform of the `HArray`. \ +/// Computes the fast fourier transform of the `HArray`. /// /// #### Returns /// -/// An `HArray`. \ +/// An `HArray`. /// /// #### Examples /// @@ -57,11 +57,11 @@ fn fft(harray: &HArray) -> HArray { /// HFft /// ## fft_mut /// -/// `fft_mut()` \ +/// `fft_mut()` +/// +/// Computes the fast fourier transform of the `HArray`. +/// The operation is done in-place. /// -/// Computes the fast fourier transform of the `HArray`. \ -/// The operation is done in-place. \ - /// #### Examples /// /// ```r @@ -78,7 +78,7 @@ fn fft_mut(harray: &mut HArray) { ``` ```r -rdocs::generate_docs("./testscript.R") +rdocs::generate_docs("./testscript.rs") ``` The website will be generated on the current working directory. diff --git a/rdocs/DESCRIPTION b/rdocs/DESCRIPTION index 1494a08..ce773b6 100644 --- a/rdocs/DESCRIPTION +++ b/rdocs/DESCRIPTION @@ -1,6 +1,6 @@ Package: rdocs Title: Create Quarto documentation for R files from comments -Version: 0.1.45 +Version: 0.1.46 Authors@R: person("Daniel", "Gurgel", , "daniellga@gmail.com", role = c("aut", "cre")) Description: Generate R documentation in Quarto format based on comments in code files. diff --git a/rdocs/R/main.R b/rdocs/R/main.R index dc20f16..197614e 100644 --- a/rdocs/R/main.R +++ b/rdocs/R/main.R @@ -30,10 +30,11 @@ get_download_url <- function() { ### Functions ### ## download_rdocs ### -### `download_rdocs()` \ +### `download_rdocs()` ### -### Forces the update of the cached binary. \ -### Use this when the package version has been updated and a new updated release is available. \ +### Forces the update of the cached binary. +### +### Use this when the package version has been updated and a new updated release is available. ### ### #### Examples ### @@ -68,31 +69,41 @@ download_rdocs <- function() { ### Functions ### ## generate_docs ### -### `generate_docs(files, folder_name = "docs", gh_url = "", run_examples = FALSE)` \ +### `generate_docs(files, folder_name = "docs", gh_url = "", run_examples = FALSE)` +### +### Generate a quarto website from lines starting with `###` or `///` that are right above function declarations. +### +### The website folder is created in the current working directory. ### -### Generate a quarto website from lines starting with `###` or `///` that are right above function declarations. \ -### The website folder is created in the current working directory. \ ### The first line of the block is important, since the name of the variable will be used to group functions into the ### same one-worded section. This is useful, for example, when working using an OOP approach. For now, to avoid any -### bugs, it is important that all grouped functions are on the same file. \ -### The user is free to create its headings, line breaks and make use of all other markdown utilities. \ +### bugs, it is important that all grouped functions are on the same file. +### +### The user is free to create its headings, line breaks and make use of all other markdown utilities. +### ### All R code identified by r code markdown blocks will be evaluated in a separate R session. If you don't want a certain part of the ### code to be run, it will be needed to comment it or avoid the code block representation. If you don't want to evaluate -### the code at all, use `run_examples = FALSE`, which is the default. \ +### the code at all, use `run_examples = FALSE`, which is the default. ### ### #### Arguments ### -### * `files` \ +### * `files` +### ### The files that will be used to create the `.qmd` documentation. -### * `folder_name` \ -### Name of the folder which will store the website. \ -### * `gh_url` \ +### +### * `folder_name` +### +### Name of the folder which will store the website. +### +### * `gh_url` +### ### A github url indicating where the documented files will be stored. It will create a link to the source code for each -### function. The default value will not create such links. \ -### * `run_examples` \ -### If `TRUE`, All R code identified in an R code block will be evaluated in a separate R session. If you don't want a certain part -### of the code to be run, it will be needed to comment it or avoid the r code representation in markdown. \ +### function. The default value will not create such links. +### +### * `run_examples` ### +### If `TRUE`, All R code identified in an R code block will be evaluated in a separate R session. If you don't want a certain part +### of the code to be run, it will be needed to comment it or avoid the r code representation in markdown. ### ### #### Examples ### diff --git a/src/main.rs b/src/main.rs index a990645..78a4bab 100644 --- a/src/main.rs +++ b/src/main.rs @@ -187,7 +187,7 @@ fn output_file(hash: HashMap>, folder_name_hidden: &str) { // Construct the final output text. let output_text = [text, value.join("\n")].join("\n\n"); - // Write the output text to the output file. + // Write the output text into the output file. let mut output_file = File::create(&docs_file_path).expect("Could not create output_file."); output_file .write_all(output_text.as_bytes())