Skip to content

Commit

Permalink
fix source button and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellga committed Jun 21, 2024
1 parent c845c80 commit b6f8000
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rdocs"
version = "0.1.45"
version = "0.1.46"
edition = "2021"
repository = "https://github.com/daniellga/rdocs/"

Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand All @@ -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
Expand All @@ -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.
2 changes: 1 addition & 1 deletion rdocs/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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", , "[email protected]", role = c("aut", "cre"))
Description: Generate R documentation in Quarto format based on comments in code files.
Expand Down
45 changes: 28 additions & 17 deletions rdocs/R/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
###
Expand Down Expand Up @@ -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
###
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ fn output_file(hash: HashMap<String, Vec<String>>, 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())
Expand Down

0 comments on commit b6f8000

Please sign in to comment.