Git Product home page Git Product logo

Comments (1)

kristian-clausal avatar kristian-clausal commented on June 13, 2024 1

We could steal a MAGIC character slot, replace -{}- with it, and then change it back as needed.

In common we have:
https://github.com/tatuylonen/wikitextprocessor/blob/03d2312b6c59ece309c99e5b013d2dfe96473637/wikitextprocessor/common.py#LL8C1-L17C2

The magic characters and the range are just unused Unicode characters that should be safe to sprinkle into strings.

Here we could add a MAGIC_ZH_PLACEHOLDER by shifting MAGIC_FIRST to 0x0x00102040 and giving 0x0010203f to MAGIC_ZH_PLACEHOLDER, cast it as a character in MAGIC_ZH_PLACEHOLDER_CH and do string replacements back and forth between the magic character and -{}- as needed.

(Note to self: replace magic values with MAGIC_BASE_VALUE + N.)

This is what I did when I needed to somehow fix an issue with quote single quote ' apostrophes inside double-quoted HTML attributes when parsing.

from wikitextprocessor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.