-
Notifications
You must be signed in to change notification settings - Fork 3
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
make protect math exit early for money #122
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much
@@ -1,6 +1,6 @@ | |||
Package: tinkr | |||
Title: Cast '(R)Markdown' Files to 'XML' and Back Again | |||
Version: 0.2.0.9000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think you might enjoy {fledge} since you're so good at incrementing version numbers!
@@ -38,6 +38,8 @@ | |||
#96, fix: #111, @zkamvar) | |||
* Documents with no trailing newline will no longer throw a warning (issue: #65; | |||
fix: #114, @zkamvar) | |||
* Documents with dollar signs but no math will no longer fail with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey I really like your tracking both issue and fix!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
@@ -1,3 +1,12 @@ | |||
test_that("(#121) single dollar lines dont throw errors", { | |||
expected <- "I've only got $2 in the bank. Feels bad, man.\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add the same example to the README? saying that you can use dollars as currency without any problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added it, but I've added a caveat that there will be a problem if there is a mix.
This is great! Thanks @zkamvar ! 🙏 |
@@ -28,3 +28,22 @@ you must be sure to either use punctuation after the trailing dollar sign OR for | |||
math$head(15) # malformed | |||
math$protect_math() #error | |||
``` | |||
4. **use of `$` as currency will still work**, but there is a caveat that mixing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the two *?
I'd break this sentence in two. Saying it works, saying "nevertheless, if there's broken math ()..."
this inline math broken across lines will cause problems: | ||
```{r, split, error = TRUE} | ||
# this will be mal-formed | ||
bad <- "It's 5:45 and I've got $5.45 in my pocket.\nThe __area of a circle__ is $A =\n \\pi r^2$, where\n$\\pi$ is irrational when it hasn't had its coffee." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice example 😸
Thank you!! |
This adds a catch that will make the
$protect_math()
method exit early withoutan error if there is unbalanced math without any trailing dollar signs, which
will indicate text with dollar amounts (like grants).
Note that this is still vulnerable if dollars are mixed with math that is broken
across lines.
This will fix #121