Giter Club home page Giter Club logo

Comments (6)

catcombo avatar catcombo commented on June 26, 2024

I vote for the second rule only. The first one needs much more attention to implement and to maintain:

  1. Create mapping of all available characters and it's subscript/superscript counterparts. Need to keep the mapping up to date as the new unicode sub/super-script characters are added.
  2. After conversion with str.translate need to compare it char by char with the original string to confirm the 100% conversion. At the moment, I don't know how to implement this efficiently.

from jira2markdown.

zyv avatar zyv commented on June 26, 2024

In as far as mapping is concerned, I have linked a good one and we can assume nothing changes in the future in the relevant code planes.

As to comparison, I though that's actually quite easy:

FROM = "..."
TO = "..."

translated = content.translate(str.maketrans(FROM, TO))

if all(src != dst for src, dst in zip(content, translated)):
    return content
else:
    return f"<sup>{content}</sup>"

We have enough cores to not to care about efficiency :)

from jira2markdown.

catcombo avatar catcombo commented on June 26, 2024

Ok, I am ready to exchange efficiency for beautiful and elegant code :)

from jira2markdown.

zyv avatar zyv commented on June 26, 2024

👍

from jira2markdown.

catcombo avatar catcombo commented on June 26, 2024

I can't help thinking this solution will lead me to the unpredictable bugs. I would prefer to implement the simplest solution so that you can extend it as you see fit.

from jira2markdown.

zyv avatar zyv commented on June 26, 2024

Fine, I can live with that, thanks!

from jira2markdown.

Related Issues (15)

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.