Skip to content

Commit cc35603

Browse files
committed
fix arguments parser
1 parent 7179ba1 commit cc35603

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

exampleVault/Input Fields/Date and Time.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
date1: Tuesday, September 13th 2022
3-
date2: Saturday, May 21st 2022
3+
date2: Friday, May 20th 2022
44
time: 14:12
55
---
66

exampleVault/Input Fields/Editor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
editor: |-
2+
editor: |--
33
test
44
55
**test**

exampleVault/Input Fields/Image Suggester.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
2+
image: Other/Images/img_butterfly.webp
3+
---
4+
---
25
image: Other/Images/img_flower.webp
36
---
47

exampleVault/Input Fields/Suggester.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
fileSuggest: "[[Other/Example Notes/Example Note with Image.md|Example Note with Image]]"
3-
suggest: option 3
3+
suggest: option 1
44
---
55

66
### Simple Suggester

src/parsers/InputFieldDeclarationParser.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,13 @@ export class InputFieldDeclarationParser {
238238
const inputFieldArgument: AbstractInputFieldArgument = InputFieldArgumentFactory.createInputFieldArgument(argument.type);
239239

240240
if (!inputFieldArgument.isAllowed(inputFieldType)) {
241-
throw new MetaBindParsingError(`argument '${argument.type}' is only applicable to ${inputFieldArgument.getAllowedInputFieldsAsString()} input fields`);
241+
throw new MetaBindParsingError(`argument '${argument.type}' is only applicable to '${inputFieldArgument.getAllowedInputFieldsAsString()}' input fields`);
242242
}
243243

244244
if (inputFieldArgument.requiresValue) {
245+
if (!argument.value) {
246+
throw new MetaBindParsingError(`argument '${argument.type}' requires a non empty value`);
247+
}
245248
inputFieldArgument.parseValue(argument.value);
246249
}
247250

@@ -259,14 +262,7 @@ export class InputFieldDeclarationParser {
259262
}
260263

261264
extractInputFieldArgumentValue(argumentString: string): string {
262-
const argumentName = this.extractInputFieldArgumentIdentifier(argumentString);
263-
264-
const argumentValue = ParserUtils.getInBetween(argumentString, this.roundBracesPair) as string;
265-
if (!argumentValue) {
266-
throw new MetaBindParsingError(`argument '${argumentName}' requires a non empty value`);
267-
}
268-
269-
return argumentValue;
265+
return ParserUtils.getInBetween(argumentString, this.roundBracesPair) as string;
270266
}
271267

272268
getInputFieldArgumentType(str: string): InputFieldArgumentType {

0 commit comments

Comments
 (0)