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

Improvements to standalone header #1903

Merged
merged 8 commits into from
Jul 24, 2024
Merged

Improvements to standalone header #1903

merged 8 commits into from
Jul 24, 2024

Conversation

krlmlr
Copy link
Member

@krlmlr krlmlr commented Oct 22, 2023

  • Use correct host and ref in URL
  • Add "generated by" code

ref_string <- ref %||% "HEAD"
host_string <- host %||% "https://github.com"
source_comment <-
glue("# Source: {host_string}/{repo_spec}/blob/{ref_string}/{path}")
Copy link
Member

@jennybc jennybc Jul 24, 2024

Choose a reason for hiding this comment

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

It works better in Positron to not surround this with <>, i.e. the automatic hyperlink detection copes better with this form.


path_string <- path_ext_remove(sub("^standalone-", "", basename(path)))
ref_string <- if (is.null(ref)) "" else glue(', ref = "{ref}"')
host_string <- if (is.null(host) || host == "https://github.com") "" else glue(', host = "{host}"')
Copy link
Member

@jennybc jennybc Jul 24, 2024

Choose a reason for hiding this comment

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

Only include host if it's something other than github.com. Only include ref if the user explicitly did so.

@jennybc
Copy link
Member

jennybc commented Jul 24, 2024

Thanks!

@jennybc jennybc merged commit acac3f9 into main Jul 24, 2024
14 checks passed
@jennybc jennybc deleted the f-standalone-code branch July 24, 2024 18:10
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.

2 participants