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

Support for conditional directives #983

Open
5 of 7 tasks
martijnversluis opened this issue Aug 25, 2023 · 0 comments
Open
5 of 7 tasks

Support for conditional directives #983

martijnversluis opened this issue Aug 25, 2023 · 0 comments

Comments

@martijnversluis
Copy link
Owner

martijnversluis commented Aug 25, 2023

Conditional directives

All directives can be equipped with a selector by appending a selector name to the name of the directive, separated by a dash (hyphen) -. If the selector fails, the directive is skipped.

For example:

{define-ukulele Dm base-fret 1 frets 2 2 1 0}
{define-guitar  Dm base-fret 1 frets x 0 3 2 3 1}

This will define the appropriate Dm chord for either ukulele or guitar.

Selection can be reversed by appending a ! to the selector.

How selectors are defined depends on the ChordPro processing tool. The ChordPro program uses the config values for instrument.type and user.name.

See https://www.chordpro.org/chordpro/chordpro-directives/#conditional-directives

  • parse selector on Tag
  • store selector on Line and Paragraph
  • allow testing the condition
  • allow ! for reversing the selector
  • render sections conditionally based on selector
  • set metadata conditionally based on selector
  • return chord definitions conditionally
martijnversluis added a commit that referenced this issue Dec 9, 2024
The tag selector is stored on the tag, the current line and evaluated for a paragraph.

See https://www.chordpro.org/chordpro/chordpro-directives/#conditional-directives

Related to #983
martijnversluis added a commit that referenced this issue Dec 9, 2024
The tag selector is stored on the tag, the current line and evaluated for a paragraph.

See https://www.chordpro.org/chordpro/chordpro-directives/#conditional-directives

Related to #983
@martijnversluis martijnversluis moved this from Backlog to In Progress in ChordSheetJS project board Dec 10, 2024
martijnversluis added a commit that referenced this issue Dec 14, 2024
martijnversluis added a commit that referenced this issue Dec 14, 2024
martijnversluis added a commit that referenced this issue Dec 14, 2024
martijnversluis added a commit that referenced this issue Dec 14, 2024
martijnversluis added a commit that referenced this issue Dec 15, 2024
martijnversluis added a commit that referenced this issue Dec 15, 2024
@martijnversluis martijnversluis moved this from In Progress to Backlog in ChordSheetJS project board Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant