#How to undo show rule for text replacement

11 messages · Page 1 of 1 (latest)

flat sierra
#

I have replaced certain word for links which forward to a list of explanations.
Now i have a table with the same word in it and want to make an exception for this instance.
I could not figure out how to undo a top level show rule, except for placing a #show("") somewhere in the word.
Is there a better way?
Thank you very much

nocturne sleet
#

It's currently just planned, but you could work around by limiting the scope, so that everything but the that table is included.

#

You could also contextualize that replacing show rule.

wooden anchor
#

one way to achieve the same result is to use a single show rule that checks which part of the document you're in, e.g.

#

?r

#show "blob": it => context {
  if query(selector(<mylabel>).before(here())).len() == 0 {
    // Before first <mylabel> => apply rule
    text(red, it)
  } else {
    // After <mylabel> => leave element as is
    it
  }
}

1 blob

#metadata("x")<mylabel>

2 blob

#metadata("y")<mylabel>

3 blob
wooden anchor
#

in your case it might be better to do the same with a state you can toggle, instead of labels:

#

?r

#let s = state("showred", true)
#show "blob": it => context if s.get() { text(red, it) } else { it }

1 blob

#s.update(false)

2 blob

#s.update(true)

3 blob
flat sierra
#

That is a great solution thank you very much