New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jsxgettext

Package Overview
Dependencies
Maintainers
7
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsxgettext - npm Package Compare versions

Comparing version 0.6.3 to 0.7.0

test/inputs/example.jade

38

lib/parsers/jade.js

@@ -34,24 +34,42 @@ "use strict";

/* jshint -W040 */
return extractGettext(this[key]);
return extractGettext(this[key].val);
}
function isEmpty(obj) {
return obj.length;
var buf = [], lineN, lineAdjust = -1;
function append(text) {
/* jshint -W040 */
var ctx = this;
if (ctx && ctx.bump) {
lineN += 1;
}
if (text.length) {
buf[lineN] = [buf[lineN], text, ';'].join('');
}
}
var buf = [], lineN, tmp;
do {
token = lexer.next();
lineN = token.line - 1;
lineN = token.line + lineAdjust;
switch (token.type) {
case 'attrs':
tmp = Object.keys(token.attrs).map(extractFromObj, token.attrs).filter(isEmpty);
if (tmp.length)
buf[lineN] = tmp.join(';') + ';';
Object.keys(token.attrs)
.map(extractFromObj, token.attrs)
.forEach(append);
break;
case 'text':
case 'code':
tmp = extractGettext(token.val);
if (tmp.length) buf[lineN] = tmp + ';';
append(extractGettext(token.val));
break;
case 'pipeless-text':
token.val
.map(extractGettext)
.forEach(append, { bump: true });
lineAdjust += token.val.length;
break;
case 'comment':
if (/^\s*L10n:/.test(token.val)) {
append(['/*', token.val, '*/'].join(''));
}
break;
}

@@ -58,0 +76,0 @@ } while (token.type !== 'eos');

@@ -6,2 +6,3 @@ {

"Arpad Borsos <arpad.borsos@googlemail.com> (http://swatinem.de/)",
"Damian Krzeminski <pirxpilot@code42day.com> (http://pirxpilot.me/)",
"Doug Beck <doug@douglasbeck.com> (http://douglasbeck.com/)",

@@ -25,3 +26,3 @@ "Chia-liang Kao <clkao@clkao.org> (http://www.clkao.org/)",

"name": "jsxgettext",
"version": "0.6.3",
"version": "0.7.0",
"license": "MPL-2.0",

@@ -48,3 +49,3 @@ "description": "Extracts gettext strings from JavaScript, EJS, Jade, Jinja and Handlebars files.",

"commander": "2.5.0",
"jade": "0.30.0",
"jade": "^1.0.0",
"escape-string-regexp": "1.0.1"

@@ -51,0 +52,0 @@ },

@@ -9,19 +9,17 @@ "use strict";

var utils = require('../utils');
exports['test parsing'] = function (assert, cb) {
// check that files with leading hash parse
var inputFilename = path.join(__dirname, '..', 'inputs', 'second_attribute.jade');
var inputFilename = path.join(__dirname, '..', 'inputs', 'example.jade');
fs.readFile(inputFilename, "utf8", function (err, source) {
var opts = {keyword: ['gettext', '_']},
sources = {'inputs/second_attribute.jade': source},
sources = {'inputs/example.jade': source},
result = jsxgettext.generate.apply(jsxgettext, jade(sources, opts));
assert.equal(typeof result, 'string', 'result is a string');
assert.ok(result.length > 1, 'result is not empty');
assert.ok(result.indexOf('msgid "bar"') > -1, 'bar is found');
assert.ok(result.indexOf('msgid "same-lime"') > -1, 'same-lime is found');
assert.ok(result.indexOf('msgid "in text"') > -1, 'in text is found');
assert.ok(result.indexOf('msgid "foobar"') > -1, 'foobar is found');
assert.ok(result.indexOf('msgid "underscored"') > -1, 'underscored is found');
cb();
assert.ok(result.length > 0, 'result is not empty');
var outputFilename = path.join(__dirname, '..', 'outputs', 'jade.pot');
utils.compareResultWithFile(result, outputFilename, assert, cb);
});

@@ -28,0 +26,0 @@ };

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc