fava icon indicating copy to clipboard operation
fava copied to clipboard

Inconsistent parsing of narration field with respect to generating tags

Open mondjef opened this issue 1 year ago • 5 comments

In my csv importer, if I import the following record: 02/18/2023,RETAILER #89 TORONTO ON,92.78,

I get the following entry..

2023-02-18 * "RETAILER #89 TORONTO, ON"
  Expenses:Someaccount
  Assets:BankAccount                       -92.78 CAD

Which is ok...however if I import the same record and add a tag (or make any other edit) to the narration field during the fava import process things change. For example if I add the tag '#test' I now get the following:

2023-02-18 * "RETAILER NEPEAN ON" #89 #test
  Expenses:Someaccount
  Assets:BankAccount                       -92.78 CAD

What I would like is that the #89 (store number/identifier) to not be parsed as a tag but I get that the fava process does not know what is a real tag versus one that should be not considered a tag. I had thought maybe I could circumvent this by simply escaping the # but this is not a great way to do it. Using \ results in \ in my beancount file which then has downstream consequences and I also noticed that inserting a single space after the # also prevents it being parsed as a tag but again it does leave the narrative intact as read from csv which is what I would like.

I think the fava process that parses this string should only parse and collect tags starting from the end of the string and stop when it encounters a non-tag token. This would prevent the issues I am noticing and would also make consistent regardless if the narrative text was modified or not.

mondjef avatar Feb 26 '23 21:02 mondjef