Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting to restrict what macros can appear in a macro container #95

Open
MinusGix opened this issue Feb 12, 2022 · 1 comment
Open

Setting to restrict what macros can appear in a macro container #95

MinusGix opened this issue Feb 12, 2022 · 1 comment
Labels
enhancement New feature or request sugarcube-2 Relating to the SugarCube-2 Story Format

Comments

@MinusGix
Copy link
Collaborator

This is not overly common of a feature to want, but at times people have macros that should not do specific things inside them. One way to facilitate this would be to let the user specify a list of blacklisted child macros. It then scans over the tree to see if it appears inside of the macro.
An example usecase for this would be <<link>> when you specify a passage, and then disallowing using macros like <<goto>>. However this isn't trivial to implement, since it is dependent on which variant exists, and I don't believe the parsing information is paired with that in the right manner for it.
A basic version of this feature could be implemented, but the version that would be needed for <<link>> is rather complex.

@MinusGix MinusGix added enhancement New feature or request sugarcube-2 Relating to the SugarCube-2 Story Format labels Feb 12, 2022
@BawdyInkSlinger
Copy link

BawdyInkSlinger commented May 4, 2022

My goal with this comment is to suss out the config file UX for this. I have a macro that is pretty much a copy of link/button. Here is its config:

    act:
      name: act
      container: true
      parameters:
        - "text |+ passage"

Could we do this? (I'm not sure if yaml allows this, I think json could):

    act:
      name: act
      container: true
      parameters:
        - "text &+ passage"
          children:
            - "not(goto)"
        - "text"

I'm just spitballing here, but if this is reasonable, implementing not may be a feature in it of itself.

Alternatively:

    act:
      name: act
      container: true
      parameters:
        - "text &+ passage"
          forbidden_children:
            - "goto"
        - "text"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request sugarcube-2 Relating to the SugarCube-2 Story Format
Projects
None yet
Development

No branches or pull requests

2 participants