-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
[BUG] Support typographic quotes when working with schedules #119
Comments
Thanks for reporting! I think the best approach would be to sanitize user input by substituting typographic quotes to plain vanilla double quotes before using the regular expression here as there possibly are more than one way smart quotes work depending on the language/keyboard layout. |
Wouldn't suffice to modify this regex similarly as it's already done for matching space characters? |
I need to check how the smart quotes feature works on MacOS, because there are quite a few options for quotation marks in different languages, see summary here. If MacOS supports them all, then modifying the regex would probably make it too cumbersome. |
Fair enough 😅 I don't know anything about Clojure but let me know if I can help in any way. |
I think this is the most extensible and readable way to tackle the problem:
--- a/src/dienstplan/commands.clj
+++ b/src/dienstplan/commands.clj
@@ -396,7 +396,8 @@ Caveats:
(defn parse-args-schedule-cmd
[command-parsed]
(let [args (get-command-args command-parsed)
- matcher (re-matcher regex-schedule args)
+ args' (string/replace args #"[“”«»„‟‹›❝❞]" "\"")
+ matcher (re-matcher regex-schedule args')
result (when (.matches matcher)
{:subcommand (.group matcher "subcommand")
:executable (.group matcher "executable")
I'm happy to accept a pull request for this. |
Describe the bug
The "Use smart quotes and dashes" feature in macOS is an option that automatically converts straight quotation marks (" ") and apostrophes (') into "smart" or typographic quotes. This feature is enabled by default and applies across all applications.
Unfortunately the code doesn't recognise these quotes as valid and complains with the following error:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Recognise and accept typographic quotes as valid.
Workaround
Disable "Use smart quotes and dashes" feature in
Keyboard
->Text Input
settings.Screenshots
*Application setup
The text was updated successfully, but these errors were encountered: