Coder Social home page Coder Social logo

possible parsing issue about ansi-to-html HOT 6 CLOSED

rburns avatar rburns commented on August 22, 2024
possible parsing issue

from ansi-to-html.

Comments (6)

rburns avatar rburns commented on August 22, 2024

It seems to be the '[m' sequences which confuse it. If I remove those something approaching correct comes out. From what I can find on the web the correct sequences involving 'm' look like this: ESC[#(;#)m. ie there should be at least a number preceeding the 'm' , and possibly a ';#' in addition. as in the other sequences in the string. (eg [1;31m) http://bluesock.org/~willg/dev/ansi.html

from ansi-to-html.

j-5-s avatar j-5-s commented on August 22, 2024

interesting. so this would be considered a bug in git then? This is being generated from git diff --color-words.

from ansi-to-html.

rburns avatar rburns commented on August 22, 2024

the [m appears to be a color reset, which should be possible to handle. I'll have a look.

https://github.com/git/git/blob/018bc80d140aff02f61e3a5100dd1367311d38ff/color.h

from ansi-to-html.

j-5-s avatar j-5-s commented on August 22, 2024

nice. no rush on my end. I have managed to solve my issues by just parsing the ansi with regex. I appreciate the quick responses though.

from ansi-to-html.

rburns avatar rburns commented on August 22, 2024

It turns out '[m' was being handled correctly, what was causing the error were two sequences together eg [m[1;32m. The parser was mangling the second sequence. I've committed a fix for that. can you test it out?

From looking around, my best guess is that [0m is actually the reset code. Though if git produces [m it's at least common.

from ansi-to-html.

j-5-s avatar j-5-s commented on August 22, 2024

Does not seem to fix it. The ansi from git is:

months remainingESC�[1;31mtimesESC�[mESC�[1;32mmultiplied byESC�[m $10

and that turns into

months remaining <b><span style="color:#A00">times</span></b>2mmultiplied by $10

Again, I'm probably not going to be using it though since i solved my issues with regex since its only a few common ansi characters im looking for.

from ansi-to-html.

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.