Closed JohannesNE closed 2 years ago
Maybe it’s easier to do it in VSCode with search and replace and a regex. If you search "{1,3}(.*?)"{1,3}
and replace it with “$1”
, VSCode will change the "" (between one and three) into “”, keeping what is between them the same. This way we can replace all the "" with “”. It still needs a manual check, of course, but it’s not a gargantuan job.
I can do this if you want. I was also thinking about writing a CONTRIBUTING.md, so that newcomers know how to add new quotes correctly.
Regarding the R script, I skimmed through the documentation and I found this. I tried to implement it and I came up with this:
litclock <- mutate(litclock,
quote = str_replace_all(quote, '"{1,3}(.*?)"{1,3}', "“\\1”"),
quote_time = str_replace_all(quote_time, '"{1,3}(.*?)"{1,3}', "“\\1”")
)
This way, if there are "" (between one and three) in the CSV they become “” in JSON. It seems to work, but i’m not 100% sure since I never used R.
Thanks, that could definitely work, and it may be the safest solution. to simply not use "
, since they mess up the parsing if they are not correctly matched.
I would, however, prefer that the quotes are parsed as markdown text (as it is now) to automatically use “ and ” appropriately.
I think I found a solution here https://github.com/JohannesNE/literature-clock/pull/40
I think I found a solution here #40
Yeah this is great! Much simpler than what I thought. It also solved a problem with double quotes not appearing in dialogues sometimes. Kudos!
If the .csv file has an entry that starts and ends with a quote, these need to be escaped by double quotes (
""
). I.e.This is quite difficult to both read and write, and should not be necessary since all entries in the .csv should simply be interpreted as strings.
I'm just not yet sure how to do this in R.