On 02/02/2012 06:09 PM, Federico Bruni wrote:
Hi,
I'm trying to find a smarter way to highlight some strings:
All the "\strings" inside \markup{ ... } should have a different colour
of \strings occurences in other parts of the input.
How can I achieve that in a smart way (i.e. without using a list of all
the \strings which can occur inside a \markup{} block)?
I want to preserve all the other highlighting definitions. Maybe
state|environment is not the right tool? Because in Doc 7.9 it says:
"When entering a state/environment, however, the definitions given
outside the state/environment are not matched. "
Let's do an example:
\markup {
\override #'(box-padding . 1.0) \override #'(baseline-skip . 2.7) \box
\center-column {
\small \line { Sheet music from \with-url
#"http://www.MutopiaProject.org"
\line { \teeny www. \hspace #-0.5 MutopiaProject \hspace #-0.5 \teeny
.org \hspace #0.5 }
}
}
}
I want to match only: \override \box \center-column \small \line
\with-url \teeny \hspace
The following environment:
environment markup delim '\\markup\s*\{' "}" multiline nested begin
environment markup delim "{" "}" multiline nested begin
markup_command = '\\[[:alpha:]-]+'
end
end
can see the relevant block and highlight the \strings correctly, but at
the same time it breaks something, in particular some elements lose
their highlighting (as documentations says):
1) \markup
2) {}
3) #......
So I guess that state|environment is not the solution here. Or I'm
missing something?
these elements lose highlighting since they are in a new environment as
you said, but you can put in the environment the definitions that you
want to be valid; instead of repeating them you might want to use
variables, for instance the definition for #... can be put in a variable
and have the definition outside the environment and inside...
for instance
vardef SCHEME_VALUE = '##(t|f)', '#{1,2}\'?[[:alnum:]\.:+-]+'
scheme_value = $SCHEME_VALUE
environment markup delim '\\markup\s*\{' "}" multiline nested begin
environment markup delim "{" "}" multiline nested begin
scheme_value = $SCHEME_VALUE
markup_command = '\\[[:alpha:]-]+'
end
end
though, from what I understand, what you said, it should be
environment markup delim '\\markup\s*\{' "}" multiline nested begin
scheme_value = $SCHEME_VALUE
markup_command = '\\[[:alpha:]-]+'
environment markup delim "{" "}" multiline nested begin
scheme_value = $SCHEME_VALUE
markup_command = '\\[[:alpha:]-]+'
end
end