@larsgw/formica 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/lib/resources/parse-text.js +2 -2
- package/package.json +1 -1
- package/src/resources/parse-text.ts +2 -2
- package/test/resources.js +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [0.4.3](https://github.com/identification-resources/formica/compare/v0.4.2...v0.4.3) (2023-09-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **resource:** fix regression in taxon parsing ([098477b](https://github.com/identification-resources/formica/commit/098477b5914324a3c15ec885617d4cf30996f30d))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
## [0.4.2](https://github.com/identification-resources/formica/compare/v0.4.1...v0.4.2) (2023-09-30)
|
|
2
11
|
|
|
3
12
|
|
|
@@ -122,9 +122,9 @@ var NAME_PATTERN = new RegExp('^' +
|
|
|
122
122
|
* $1 genus+subgenus (+ trailing space): (?:([A-Z]\S+) (?:\(([A-Z]\S+?)\) )?)?
|
|
123
123
|
* $1.1 genus: ([A-Z]\S+)
|
|
124
124
|
* $1.2 subgenus: (?:\(([A-Z]\S+?)\) )?
|
|
125
|
-
* $2 species: ((?:x )?[a-
|
|
125
|
+
* $2 species: ((?:x )?[a-z]\S+)
|
|
126
126
|
*/
|
|
127
|
-
var BINAME_PATTERN = /^(?:([A-Z]\S+) (?:\(([A-Z]\S+?)\) )?)?((?:x )?[a-
|
|
127
|
+
var BINAME_PATTERN = /^(?:([A-Z]\S+) (?:\(([A-Z]\S+?)\) )?)?((?:x )?[a-z]\S+)(?= |$)/;
|
|
128
128
|
function compareRanks(a, b) {
|
|
129
129
|
return RANKS.indexOf(a) - RANKS.indexOf(b);
|
|
130
130
|
}
|
package/package.json
CHANGED
|
@@ -120,9 +120,9 @@ const NAME_PATTERN = new RegExp(
|
|
|
120
120
|
* $1 genus+subgenus (+ trailing space): (?:([A-Z]\S+) (?:\(([A-Z]\S+?)\) )?)?
|
|
121
121
|
* $1.1 genus: ([A-Z]\S+)
|
|
122
122
|
* $1.2 subgenus: (?:\(([A-Z]\S+?)\) )?
|
|
123
|
-
* $2 species: ((?:x )?[a-
|
|
123
|
+
* $2 species: ((?:x )?[a-z]\S+)
|
|
124
124
|
*/
|
|
125
|
-
const BINAME_PATTERN = /^(?:([A-Z]\S+) (?:\(([A-Z]\S+?)\) )?)?((?:x )?[a-
|
|
125
|
+
const BINAME_PATTERN = /^(?:([A-Z]\S+) (?:\(([A-Z]\S+?)\) )?)?((?:x )?[a-z]\S+)(?= |$)/
|
|
126
126
|
|
|
127
127
|
function compareRanks (a: Rank, b: Rank): number {
|
|
128
128
|
return RANKS.indexOf(a) - RANKS.indexOf(b)
|
package/test/resources.js
CHANGED
|
@@ -90,4 +90,14 @@ Drymus
|
|
|
90
90
|
`, 'T1')
|
|
91
91
|
assert.strictEqual(resource.taxa['T1:1:1'].scientificName, 'Drymus')
|
|
92
92
|
})
|
|
93
|
+
|
|
94
|
+
await t.test('parses names containing non-ASCII characters', (t) => {
|
|
95
|
+
const [resource] = resources.parseTextFile(`---
|
|
96
|
+
levels: [species]
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
Nematus fåhraei Thomson
|
|
100
|
+
`, 'T1')
|
|
101
|
+
assert.strictEqual(resource.taxa['T1:1:1'].scientificName, 'Nematus fåhraei Thomson')
|
|
102
|
+
})
|
|
93
103
|
})
|