deactivate

abjad.top.deactivate.deactivate(text, tag, skipped=False)

Deactivates tag in text.

Writes (active) tag into LilyPond input:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> markup = abjad.Markup('Allegro').with_color('red')
>>> abjad.attach(
...     markup,
...     staff[0],
...     tag='RED_MARKUP',
...     )
>>> text = format(staff, 'lilypond')
>>> text = abjad.LilyPondFormatManager.left_shift_tags(text)
>>> print(text)
\new Staff
{
    c'4
    - \markup {     %! RED_MARKUP
        \with-color %! RED_MARKUP
            #red    %! RED_MARKUP
            Allegro %! RED_MARKUP
        }           %! RED_MARKUP
    d'4
    e'4
    f'4
}
>>> abjad.show(staff) 

Deactivates tag:

>>> text = format(staff, 'lilypond')
>>> text, count = abjad.deactivate(text, 'RED_MARKUP')
>>> print(text)
\new Staff
{
    c'4
%%% - \markup {     %! RED_MARKUP
%%%     \with-color %! RED_MARKUP
%%%         #red    %! RED_MARKUP
%%%         Allegro %! RED_MARKUP
%%%     }           %! RED_MARKUP
    d'4
    e'4
    f'4
}
>>> lines = [_.strip('\n') for _ in text.split('\n')]
>>> lilypond_file = abjad.LilyPondFile.new(lines)
>>> abjad.show(lilypond_file) 

Activates tag again:

>>> text, count = abjad.activate(text, 'RED_MARKUP')
>>> print(text)
\new Staff
{
    c'4
    - \markup {     %! RED_MARKUP
        \with-color %! RED_MARKUP
            #red    %! RED_MARKUP
            Allegro %! RED_MARKUP
        }           %! RED_MARKUP
    d'4
    e'4
    f'4
}
>>> lines = [_.strip('\n') for _ in text.split('\n')]
>>> lilypond_file = abjad.LilyPondFile.new(lines)
>>> abjad.show(lilypond_file) 

Deactivates tag again:

>>> text, count = abjad.deactivate(text, 'RED_MARKUP')
>>> print(text)
\new Staff
{
    c'4
%%% - \markup {     %! RED_MARKUP
%%%     \with-color %! RED_MARKUP
%%%         #red    %! RED_MARKUP
%%%         Allegro %! RED_MARKUP
%%%     }           %! RED_MARKUP
    d'4
    e'4
    f'4
}
>>> lines = [_.strip('\n') for _ in text.split('\n')]
>>> lilypond_file = abjad.LilyPondFile.new(lines)
>>> abjad.show(lilypond_file) 

Tags can toggle indefinitely.

Returns text, count pair.

Count gives number of deactivated tags.