Skip to content

Text and regex selectors don't match smart quotes #3693

Closed

Description

@refparo

Description

Selectors "\"", "“", "”", regex("[\"“”]") look like they would match quotes. However, since smart quotes are not parsed as text, they can not match smart quotes.

Reproduction URL

https://typst.app/project/r7oyVGYN6XGbYraxhPGoGP

Operating system

Web app

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Mar 16, 2024
  2. Enivex commented on Mar 16, 2024

    @Enivex
    Collaborator

    Related #86

    Text show rules are pretty brittle in general.

  3. added
    duplicate
    on Mar 16, 2024
  4. reopened this on Mar 16, 2024
  5. added
    styling
    and removed
    duplicate
    on Mar 16, 2024
  6. davystrong commented on Aug 9, 2024

    @davystrong

    Just adding to this, another example is regex("\.\.\."), which seems as if it should match ellipsis, but it doesn't. regex("\.\.") works perfectly.

    I know this isn't what this is intended for, but when I came across show rules and regex selectors I got really excited, as this effectively lets me define my own custom syntax, i.e. like @ for refs. In this context, regex selectors should really operate on the raw input text, not on a processed version. To me this would be brilliant as different people (and different documents) require certain functions a lot. Being able to define my own shorthand in this way seems great. I know it wouldn't be terribly reliable, but that really doesn't matter. If 5% of the time I have to use the full function syntax, that's not a problem.

  7. davystrong commented on Aug 9, 2024

    @davystrong

    Just to add to my previous comment, while I still think it's unintuitive that this regex doesn't work, I have since discovered the incredible power of show: commands, without any filters. Ultimately one can bypass any other limitation by manually processing the whole document. Again, blown away by how configurable and fun Typst is!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugstyling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions