benjypng / logseq-datenlp-plugin

MIT License
74 stars 6 forks source link

Multiple bugs related to Special Characters #51

Closed Zachu closed 5 months ago

Zachu commented 8 months ago

I'm sorry but this report is going to have few different bugs cause I see them all kinda relating to each other.

1.) Setting special char to "NA" literally sets it to "NA". I believe it's supposed to "unset" it, right?

So I've set "Character for Scheduled" to be "NA"

.logseq/settings/logseq-datenlp-plugin.json

{
  "semiAuto": true,
  "insertDateProperty": false,
  "lang": "en",
  "removeTime": true,
  "specialCharHeading": "",
  "dateChar": "@",
  "scheduledChar": "NA",
  "deadlineChar": "^",
  "disabled": false,
  "auto": false,
  "notifications": false,
  "defaultSnooze": 5,
  "useBlockAsAlarmTitle": true,
  "preferredDateFormat": "yyyy-MM-dd"
}

It becomes apparent especially in this example case:

- ## This is some block
  date:: [[2023-10-31]]
  tags:: [[AWS/NAT Gateway]]

Exiting that block will change it to:

- ## This is some block
  date:: [[2023-10-31]]
  tags:: [[AWS/NAT Gateway]]
  SCHEDULED: <2023-10-31 Tue>

2.) Scheduled blocks are rescheduled many times

At least now with these settings revisiting this block makes it to be:

- ## This is some block
  date:: [[2023-10-31]]
  tags:: [[AWS/NAT Gateway]]
  SCHEDULED: <2023-10-31 Tue>
  SCHEDULED: <2023-10-31 Tue>
  SCHEDULED: <2023-10-31 Tue>
  SCHEDULED: <2023-10-31 Tue>

And revisiting it again changes it to:

- ## This is some block
  date:: [[2023-10-31]]
  tags:: [[AWS/NAT Gateway]]
  SCHEDULED: <2023-10-31 Tue>
  SCHEDULED: <2023-10-31 Tue>
  SCHEDULED: <2023-10-31 Tue>
  SCHEDULED: <2023-10-31 Tue>
  SCHEDULED: <2023-10-31 Tue>
  SCHEDULED: <2023-10-31 Tue>
  SCHEDULED: <2023-10-31 Tue>
  SCHEDULED: <2023-10-31 Tue>
  SCHEDULED: <2023-10-31 Tue>
  SCHEDULED: <2023-10-31 Tue>
  SCHEDULED: <2023-10-31 Tue>
  SCHEDULED: <2023-10-31 Tue>
  SCHEDULED: <2023-10-31 Tue>

... and so on always increasing exponentially :sweat_smile:

The same thing can be seen by the default % character with following block:

- ## This is some block % foo
  date:: [[2023-10-31]]

3.) Disabling both Scheduled and Deadline is "overlapping inline parsing characters".

So setting both to "NA" (which I still assume should be disabled) makes the plugin error with the following message:

There are overlapping characters for the inline parsing character. Please re-check your settings

Then the plugin sets the settings back to default: .logseq/settings/logseq-datenlp-plugin.json

{
  "semiAuto": true,
  "insertDateProperty": false,
  "lang": "en",
  "removeTime": true,
  "specialCharHeading": "",
  "dateChar": "@",
  "scheduledChar": "%",
  "deadlineChar": "^",
  "disabled": false,
  "auto": false,
  "notifications": false,
  "defaultSnooze": 5,
  "useBlockAsAlarmTitle": true,
  "preferredDateFormat": "yyyy-MM-dd"
}
Zachu commented 8 months ago

I don't use DEADLINE and SCHEDULED at all and would like to disable parsing of those. Especially when the % character makes editing templates a bit hard since I have for example <% today %> there sometimes :)

Edit:

As a workaround for now I set up the characters for scheduled and deadline to be something I have no reason ever to type :D This is something that can't be done from the UI though but can be changed from the settins file.

.logseq/settings/logseq-datenlp-plugin.json

{
  "semiAuto": true,
  "insertDateProperty": false,
  "lang": "en",
  "removeTime": true,
  "specialCharHeading": "",
  "dateChar": "@",
  "scheduledChar": "ə",
  "deadlineChar": "ð",
  "disabled": false,
  "auto": false,
  "notifications": false,
  "defaultSnooze": 5,
  "useBlockAsAlarmTitle": true,
  "preferredDateFormat": "yyyy-MM-dd"
}
e-zz commented 7 months ago

I don't use DEADLINE and SCHEDULED at all and would like to disable parsing of those. Especially when the % character makes editing templates a bit hard since I have for example <% today %> there sometimes :)

Edit:

As a workaround for now I set up the characters for scheduled and deadline to be something I have no reason ever to type :D This is something that can't be done from the UI though but can be changed from the settins file.

.logseq/settings/logseq-datenlp-plugin.json

{
  "semiAuto": true,
  "insertDateProperty": false,
  "lang": "en",
  "removeTime": true,
  "specialCharHeading": "",
  "dateChar": "@",
  "scheduledChar": "ə",
  "deadlineChar": "ð",
  "disabled": false,
  "auto": false,
  "notifications": false,
  "defaultSnooze": 5,
  "useBlockAsAlarmTitle": true,
  "preferredDateFormat": "yyyy-MM-dd"
}

Thanks for the info. Also, it's possible to use two characters to better avoid false matches.

   "dateChar": "@",
   "scheduledChar": ":^",
   "deadlineChar": ":%",
yoghurtdewdew commented 5 months ago

Hi, will escape the character in code ? I wish to! But I found it didn't.

benjypng commented 5 months ago

@Zachu setting to NA for the scheduled and deadline options should work now.

yoghurtdewdew commented 5 months ago

Hi, will escape the character in code ? I wish to! But I found it didn't.

image image

@hkgnp

benjypng commented 5 months ago

Hi, will escape the character in code ? I wish to! But I found it didn't.

image image @hkgnp

Can you try the latest release?

yoghurtdewdew commented 5 months ago

The latest seemed to work! Thanks for your great work!