7 Commits

Author SHA1 Message Date
Ruben Vermeersch
e2bdad57be Release v1.1.3 2022-01-19 15:37:38 +01:00
Ruben Vermeersch
2e7e5b6be8 Merge pull request #44 from iddan-flycode/patch-1
Make obsolete public
2022-01-19 15:37:10 +01:00
Iddan Aaronsohn
61363b872b Make obsolete public
Currently, it is impossible in TypeScript to tell if an item is obsolete or not.
2022-01-19 16:14:10 +02:00
Ruben Vermeersch
8d2b93c6c7 Fix build 2021-12-01 10:11:17 +01:00
dependabot[bot]
acb555b562 Bump grunt from 1.0.4 to 1.3.0
Bumps [grunt](https://github.com/gruntjs/grunt) from 1.0.4 to 1.3.0.
- [Release notes](https://github.com/gruntjs/grunt/releases)
- [Changelog](https://github.com/gruntjs/grunt/blob/main/CHANGELOG)
- [Commits](https://github.com/gruntjs/grunt/compare/v1.0.4...v1.3.0)

---
updated-dependencies:
- dependency-name: grunt
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-01 09:08:09 +00:00
Ruben Vermeersch
88364bc5e1 Release v1.1.2 2021-12-01 10:06:48 +01:00
Remko Tronçon
685be92923 Support multiple spaces after msgid 2021-12-01 09:48:44 +01:00
10 changed files with 5884 additions and 8 deletions

View File

@@ -53,7 +53,7 @@ module.exports = (grunt) ->
bump:
options:
files: ['package.json', 'bower.json']
files: ['package.json', 'package-lock.json', 'bower.json']
commitFiles: ['-a']
pushTo: 'origin'

View File

@@ -1,6 +1,6 @@
{
"name": "pofile",
"version": "1.1.1",
"version": "1.1.3",
"authors": [
"Ruben Vermeersch <ruben@rocketeer.be>"
],

2
dist/pofile.js vendored
View File

@@ -83,7 +83,7 @@ PO.parse = function (data) {
var headers = [];
//everything until the first 'msgid ""' is considered header
while (sections[0] && (headers.length === 0 || headers[headers.length - 1].indexOf('msgid ""') < 0)) {
if (sections[0].match(/msgid "[^"]/)) {
if (sections[0].match(/msgid\s+"[^"]/)) {
//found first real string, adding a dummy header item
headers.push('msgid ""');
} else {

2
dist/pofile.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -80,7 +80,7 @@ PO.parse = function (data) {
var headers = [];
//everything until the first 'msgid ""' is considered header
while (sections[0] && (headers.length === 0 || headers[headers.length - 1].indexOf('msgid ""') < 0)) {
if (sections[0].match(/msgid "[^"]/)) {
if (sections[0].match(/msgid\s+"[^"]/)) {
//found first real string, adding a dummy header item
headers.push('msgid ""');
} else {

5847
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{
"name": "pofile",
"description": "Parse and serialize Gettext PO files.",
"version": "1.1.1",
"version": "1.1.3",
"author": {
"name": "Ruben Vermeersch",
"email": "ruben@savanne.be",
@@ -37,7 +37,8 @@
},
"devDependencies": {
"browserify": "~14.0.0",
"grunt": "~1.0.1",
"coffeescript": "^2.6.1",
"grunt": "~1.3.0",
"grunt-browserify": "~5.0.0",
"grunt-bump": "0.8.0",
"grunt-contrib-clean": "~1.0.0",

2
pofile.d.ts vendored
View File

@@ -21,8 +21,8 @@ declare class Item {
public comments: string[];
public extractedComments: string[];
public flags: Record<string, boolean | undefined>;
public obsolete: boolean;
private nplurals: number;
private obsolete: boolean;
public toString(): string;
}

View File

@@ -0,0 +1,8 @@
# some comment
msgid "First id, no header"
msgstr ""
msgid "A second string"
msgstr ""

View File

@@ -70,4 +70,24 @@ describe('PO files with no headers', function () {
assert.equal(po.items.length, 2);
});
});
describe('advanced example with extra spaces', function () {
var po;
before(function (done) {
PO.load(__dirname + '/fixtures/no_header_extra_spaces.po', function (err, result) {
assert.equal(err, null);
po = result;
done();
});
});
it('Parses the po file', function () {
assert.notEqual(po, null);
});
it('Finds all items', function () {
assert.equal(po.items.length, 2);
});
});
});