Using global variables in frontmatter? #243
Replies: 7 comments 1 reply
-
Just to be certain, if you run `(log "${workMac}")` does the UUID show
up without anything extraneous?
I'm going to have to refresh myself on the conditional logic in
frontmatter. I know `if uuid is ${workMac}` should work in a logic
statement within a Bunch, and it _should_ work the same in front matter,
but I'll have to dig and see if there's some reason it wouldn't.
…On 8 Aug 2022, at 15:29, Rosemary Orchard wrote:
I have a number of global variables - things like the UUID of various
Macs, etc. I've been trying to use these in the frontmatter with
`ignore` and `ignore if`, and while the bunches aren't showing up,
they're not showing up on any machines! I've tried:
```yaml
ignore: workMac
```
And
```yaml
ignore if: ${workMac}
```
(Both ways with and without the if in the ignore if.)
Unfortunately, I've hit the end of the obvious things to try that I
can think of. Something that may be important: I'm using these in
folder and tag frontmatter, but I seem to have the same problem
directly in Bunches.
Might it be because the global variables are set from a bunch in a
folder? That's the only thing I've got left to try! (And shall do so
shortly, asking questions is always a useful troubleshooting
exercise!)
--
Reply to this email directly or view it on GitHub:
#243
You are receiving this because you are subscribed to this thread.
Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Turns out I wasn't processing variables at all before frontmatter handling, as usually variables wouldn't be assigned yet (I neglected to consider global variables). Beta 161 is out now and corrects this issue, handling known global variables before processing any conditions in frontmatter. Note that the global variable has to be set before the Bunch in question loads, it won't register a value within the Bunch prior to parsing the frontmatter. Hope that solves it, but let me know! |
Beta Was this translation helpful? Give feedback.
-
Oh, btw, tested with |
Beta Was this translation helpful? Give feedback.
-
Yup! Definitely working. The variables are set regularly through a scheduled bunch.
I did wonder if it were something like that, but it would make sense that variables wouldn’t be considered. Thank you for adding it!
Agreed, I tried without as a test—it makes sense to use them. I appreciate the new feature! 😁 |
Beta Was this translation helpful? Give feedback.
-
I just wanted to follow up on this, and say that recently I have noticed that these do not work in folder/tag front matter (anymore, I am sure they did). I now also have the added wrinkle of using a personal machine as a work machine (at times). So here's the big picture: I have a
Then in
The following
I'm not sure what to try next, but figured it was about time to ask for help! 😁 |
Beta Was this translation helpful? Give feedback.
-
Aha, I tracked it down! Because I had If I use
and the The good news is I can fix the problem for myself by remembering that all the bunches tagged podcast are already hidden by their folder. |
Beta Was this translation helpful? Give feedback.
-
Well, this got complicated. I'm not immediately wrapping my head around
why this isn't working or why your solution does. I'll have to dig in,
test, and figure out the pattern to understand.
…On 20 Feb 2023, at 5:49, Rosemary Orchard wrote:
Aha, I tracked it down!
Because I had `ignore if: ${isWorkMac}` (I tried that as well as the
ignore mentioned above) in my ***@***.***` file, _and_ in my
`Podcasting/folder.frontmatter` (where some but not _all_ bunches are
tagged with `podcast`, the folder front matter was being ignored.
If I use
```
ignore: `if ${isWorkMac} is true`
```
and the `ignore if: ${isWorkMac}` in another, then there are no
problems and it all works as expected.
The good news is I can fix the problem for myself by remembering that
all the bunches tagged podcast are already hidden by their folder.
--
Reply to this email directly or view it on GitHub:
#243 (comment)
You are receiving this because you commented.
Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I have a number of global variables - things like the UUID of various Macs, etc. I've been trying to use these in the frontmatter with
ignore
andignore if
, and while the bunches aren't showing up, they're not showing up on any machines! I've tried:And
(Both ways with and without the if in the ignore if.)
Unfortunately, I've hit the end of the obvious things to try that I can think of. Something that may be important: I'm using these in folder and tag frontmatter, but I seem to have the same problem directly in Bunches.
Might it be because the global variables are set from a bunch in a folder? That's the only thing I've got left to try! (And shall do so shortly, asking questions is always a useful troubleshooting exercise!)
Edit: sadly moving my bunch that sets variables to the main folder, and then running it manually, did not magically solve this automation conundrum. Darn
Beta Was this translation helpful? Give feedback.
All reactions