MetaEdit
MetaEdit copied to clipboard
Squar Brackets
I don't know if this is an issue or just me not understanding it correctly :
I have a dataview inline field like "[number:: 3]" and in a javascript view i am trying to increment the value by 1
I am using this code :
if (tag_type == "inline") {
let value = await getPropertyValue(tag_name, note.file.path);
console.log(value)
value = value + amount;
console.log(value)
await update(tag_name, value, note.file.path);
}
If the field is written without any bracket like "number:: 3" it works, if i have it written like "[number:: 3]" it doesn't.
I think it is related to how the graphical tool is displaying the values
It seams like is reading the opening bracket in the key and the closing in the value
I have the same problem. If I have the inline dataview value in brackets or parentheses. Also, if the inline dataview field is in a callout, I get the quote symbol too.
This also applies to lists, headers, and probably other characters too.
Editing the value also contains things outside of the square brackets:
It would be great if this is fixed because it's great being able to use this plugin without directly going into the callouts or back to live-preview to edit the value.
Hey, any update on this? Currently facing this exact issue
Hey,
the issue is probably related to the inline file parser and related to Issue #78.
Currently the InlineFileParser only looks for '::'
as the marker for dataview inline fields. However, dataview inline field can take two forms.
- without preceding and subsequent content as
MyDataviewField:: Value
, or - within other content as
[MyDataViewField:: Value]
Note the differences are the brackets[ ... ]
. This is where the issue occurs.
A fix for this would be to check for [
and ]
within the parsed line containing a ::
and limit the key and value parts accordingly (2nd form of dataview fields). However, if no brackets are found, it should be assumed that the 1st form is intended.
Came across what seems to be this issue when tinkering with QuickAdd's example Movie script, which uses inline fields with lists of links:
category:: [[Movies]]
director:: [[Lana Wachowski]], [[Lilly Wachowski]]
genre:: [[Action]], [[Sci-Fi]]
cast:: [[Keanu Reeves]], [[Laurence Fishburne]], [[Carrie-Anne Moss]]
Unfortunately, MetaEdit's getPropertiesInFile
returns
{ "key": "category", "content": "[[Movies", "type": 1 },
{ "key": "director", "content": "[[Lana Wachowski", "type": 1 },
{ "key": "genre", "content": "[[Action", "type": 1 },
{ "key": "cast", "content": "[[Keanu Reeves", "type": 1 },
Possibly related is #84