Code Monkey home page Code Monkey logo

Comments (4)

aurels avatar aurels commented on September 13, 2024

Hi Woody,

Thanks for reporting that ;-) It's a quite special case : Markdown inside HAML :-p

We are using this monstrous regex to extract GetText strings from HAML/SLIM :
https://github.com/aurels/translation-gem/blob/master/lib/translation_io/extractor.rb

We support this syntax for GetText (without parentheses) : _ "Hello" and that's what's clashing with Markdown's underscore. As you noticed.

We don't see a proper solution to that because it's a mix of two languages in the same file. Do you ?

from rails.

woahdae avatar woahdae commented on September 13, 2024

I'll have to think about it. My editor, for example, applies markdown styling (and CSS, JavaScript, etc) for those content blocks inside HAML. Maybe the "language inside a language" is not impossible, but just prohibitively expensive.

Worth noting that even plain HTML or ERB files can include inline styles and javascript, and ex. React and friends are moving towards packaging functionality rather than languages (lending itself to multiple languages in the same file).

from rails.

MichaelHoste avatar MichaelHoste commented on September 13, 2024

Hi Woody,

The monstrous regexp we use is in fact a hack we need to use because of a limitation of Gettext. It should be able to parse everything correctly but in some case (RB files generated by HAML, per exemple), it is not able to find gettext expressions inside of interpolations (something like "#{_('hello')}"). And, bad news for us, it's exactly how RB files are generated from HAML.

We can continue to optimize our "hack" but there always will be some limitation. I guess the only solution is to update Gettext with another parser like it's suggested here: ruby-gettext/gettext#42 and here: ruby-gettext/gettext#4

But it's not something trivial like you could guess :p

from rails.

woahdae avatar woahdae commented on September 13, 2024

OK! Thanks for considering it.

from rails.

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.