Giter Site home page Giter Site logo

Comments (11)

mojavelinux avatar mojavelinux commented on July 24, 2024

Yes, this is a known issue we're going to have to tackle. In an effort to get a minimum viable implementation, we mapped the regular expressions in Ruby to simplistic ones in JavaScript. The regexp engine in JavaScript is quite primitive...even more so than the Ruby 1.8.7 engine the Asciidoctor regexps adhere to.

You can see the mapping from Ruby regexp to JavaScript regexp here:

https://github.com/asciidoctor/asciidoctor/blob/master/lib/asciidoctor.rb#L344

...there are some other places as well, but these are the majority of them.

The following article describes what we're going to need to do to get proper support for non-English languages.

http://mathiasbynens.be/notes/javascript-unicode

from asciidoctor.js.

Johnsik avatar Johnsik commented on July 24, 2024

It's greate plan!
But as a interim solution I propose change from "%H:%M:%S %Z" to "%H:%M:%S" in asciidoctor.js:2740
It's works and no any problem with Win7 Rus.

from asciidoctor.js.

mojavelinux avatar mojavelinux commented on July 24, 2024

Yep, we can put that in. However, it needs to go upstream into Asciidoctor
core since Asciidoctor.js is now 100% generated.

from asciidoctor.js.

Johnsik avatar Johnsik commented on July 24, 2024

May be better to change opal.js instead?
To return empty zone name.

from asciidoctor.js.

mojavelinux avatar mojavelinux commented on July 24, 2024

Could you paste a datetime string as it appears in win7 russian so I have an example to work with?

from asciidoctor.js.

mojavelinux avatar mojavelinux commented on July 24, 2024

I took a slightly different approach, but essentially the same implementation. I drop the timezone if it fails to resolve using a try/catch block.

from asciidoctor.js.

mojavelinux avatar mojavelinux commented on July 24, 2024

I'm still interested in the test date so I can sort out how to make a test for this case. I'm actually curious whether Ruby has a problem with this as well...but I haven't been able to figure out how to get Ruby to emit a timezone in Russian.

from asciidoctor.js.

Johnsik avatar Johnsik commented on July 24, 2024

try/catch is good idea.

Thu Mar 06 2014 12:52:51 GMT+0400 (Московское время (зима))

from asciidoctor.js.

mojavelinux avatar mojavelinux commented on July 24, 2024

For the record, here's an example:

Чт июл  7 08:06:41 МСК 2016

In order to reproduce, the JavaScript implementation has to produce this result when calling new Date().toString() since the conversion happens in the internals of the Time class.

from asciidoctor.js.

mojavelinux avatar mojavelinux commented on July 24, 2024

Opal should probably use toLocaleDateString() (and/or toLocaleTimeString()) instead of toString() so that it gets a consistent result to parse. After all, this is all internal state.

from asciidoctor.js.

mojavelinux avatar mojavelinux commented on July 24, 2024

Actually, that turns out to be not all that reliable. Whatever the solution, I think Opal should not be assuming that toString() is going to be in the en-US locale.

from asciidoctor.js.

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.