bitjson / s18n

Semantic localization for html.
MIT License
23 stars 10 forks source link

CLI map fails with syntax error #10

Closed kaicarver closed 8 years ago

kaicarver commented 8 years ago

Running the second CLI command listed in the doc example fails with a syntax error.

kai@bluesteel ~/github/web
$ s18n extract > en.json

kai@bluesteel ~/github/web
$ head -3 en.json
{ '43334488': '<ul>\n<li><a href="http://yowureport.com/?p=6498">Yowureport - Hackerspaces & Makerspaces</a></li>\n<li><a href="/AssociationAnnouncement.jpg">Association announcement in 都會時報 (2014/08/01)</a></li>\n</ul>\n\n\n<div class="page-header" id="sponsors">\n  <h1>Supporters of the Taipei Hackerspace</h1>\n</div>',
  '48292469': '圓環(南京) (to East)',
  '66376152': 'Github Organization / Repository',

kai@bluesteel ~/github/web
$ s18n map en.json > fr.json
undefined:1
{ '43334488': '<ul>\n<li><a href="http://yowureport.com/?p=6498">Yowureport - Hackerspaces & Makerspaces</a></li>\n<li><a href="/AssociationAnnouncement.jpg">Association announcement in 都會時報 (2014/08/01)</a></li>\n</ul>\n\n\n<div class="page-header" id="sponsors">\n  <h1>Supporters of the Taipei Hackerspace</h1>\n</div>',
  ^

SyntaxError: Unexpected token '
    at Object.parse (native)
    at Object.<anonymous> (C:\Users\Kai\AppData\Roaming\npm\node_modules\s18n\bin\s18n-map:61:19)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
    at node.js:968:3
bitjson commented 8 years ago

Thanks for the report. I'm going to take a look at the CLI as soon as possible and try to get some test coverage over it. (#2)

bitjson commented 8 years ago

Hey @kaicarver, thanks for the bug reports! This should be solved in the latest release. The issue was with the CLI's extract command outputting an object rather than JSON.