Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from Rd_content/Rd_doc → Rd #125

Closed
wants to merge 3 commits into from

Conversation

flying-sheep
Copy link
Contributor

also adds test and renames parse_rd to parse_topic

fixes #109

}

# Recursively set classes of Rd objects
set_classes <- function(rd) {
if (is.list(rd)) {
new_rd <- lapply(rd, set_classes)
new_rd <- structure(lapply(rd, set_classes), class = class(rd))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could replace this entire block with

rd[] <- lapply(rd, set_classes)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do

@hadley
Copy link
Member

hadley commented Aug 25, 2016

Otherwise looks good (although you need a merge/rebase)

@flying-sheep
Copy link
Contributor Author

oh this was fast! i just rebased

set_class(new_rd)
} else {
set_class(rd)
rd[] <- lapply(rd, set_classes)
}
Copy link
Contributor Author

@flying-sheep flying-sheep Aug 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does that look good? (i added set_class(rd) as return line)

@flying-sheep
Copy link
Contributor Author

but we have to add more tests first: i think i’ll have to think about this more…

@hadley
Copy link
Member

hadley commented Aug 25, 2016

See #118 - I was thinking that a baseline set of regression tests would be to run staticdocs on itself and check into /docs

@flying-sheep
Copy link
Contributor Author

flying-sheep commented Aug 25, 2016

yes.

my basic idea ATM is to only rely on all the added classes internally. everything exposed to the user (e.g. exported print and to_html methods) accepts plain Rds just as returned from utils::parse_Rd.

this removes the ability to print subsets of Rds to the console, though.

I.e. user-facing methods return something like this, but also accept plain Rds and make sure internal functions get something like this:

Rd, list
|- COMMENT, character
|- arguments, list
|  |- ...
|- ...

alternatively i take back most changes, and just ensure that full Rds are converted to Rd_doc and have no Rd_content class, while all tags retain their Rd_content class.

this would be in line with your initial vision, but we’d need to make sure all user-facing methods are implemented for Rd as well (by simply converting Rd to Rd_doc).

I.e. pretty much your current structure, only less buggy:

Rd_doc, Rd, list
|- Rd_content, COMMENT, character
|- Rd_content, arguments, list
|  |- ...
|- ...

what do your think?

@hadley
Copy link
Member

hadley commented Sep 27, 2016

Thanks for these ideas — I'm implementing at the moment as part of an almost complete rewrite of the html translation system

@flying-sheep
Copy link
Contributor Author

OK, great! Then we can close this, right?

@hadley hadley closed this Sep 27, 2016
@javh javh mentioned this pull request Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

classes are broken, gh-pages, too
2 participants