@larsgw/formica 0.5.2 → 0.6.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@larsgw/formica",
3
- "version": "0.5.2",
3
+ "version": "0.6.1",
4
4
  "description": "SDK and tools for data from the Library of Identification Resources",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -6,8 +6,8 @@ import ietfTagListFactory = require('ietf-language-tag-regex')
6
6
  const ietfTagList = ietfTagListFactory()
7
7
 
8
8
  export const FORMATS = {
9
- ENTRY_TYPE: ['print', 'online', 'cd'],
10
- KEY_TYPE: ['key', 'matrix', 'reference', 'gallery', 'checklist', 'supplement', 'collection'],
9
+ ENTRY_TYPE: ['print', 'online', 'cd', 'application'],
10
+ KEY_TYPE: ['key', 'matrix', 'reference', 'gallery', 'checklist', 'supplement', 'collection', 'algorithm'],
11
11
  COMPLETE: ['TRUE', 'FALSE'],
12
12
 
13
13
  ID: /^B\d+$/,
@@ -245,8 +245,8 @@ function parseName (name: string, rank: Rank, parent: WorkingTaxon): WorkingTaxo
245
245
  }
246
246
 
247
247
  // Hybrids
248
- if (rank === 'species' && /^x /.test(name)) {
249
- name = '\u00D7' + name.slice(2)
248
+ if (rank === 'species' && /(^| )x /.test(name)) {
249
+ name = name.replace(/(^| )x /, '\u00D7')
250
250
  }
251
251
 
252
252
  // Divide the name into the main scientific name (only the epithet for taxa
package/test/resources.js CHANGED
@@ -124,4 +124,16 @@ Microdynerus Thomson, 1874
124
124
  `, 'T1')
125
125
  assert.strictEqual(resource.taxa['T1:1:3'].scientificName, 'Microdynerus microdynerus (Dalla Torre, 1889)')
126
126
  })
127
+
128
+ await t.test('parses hybrids', (t) => {
129
+ const [resource] = resources.parseTextFile(`---
130
+ levels: [species]
131
+ ---
132
+
133
+ Rumex conglomeratus x maritimus
134
+ Tilia x vulgaris
135
+ `, 'T1')
136
+ assert.strictEqual(resource.taxa['T1:1:1'].scientificName, 'Rumex conglomeratus×maritimus')
137
+ assert.strictEqual(resource.taxa['T1:1:2'].scientificName, 'Tilia ×vulgaris')
138
+ })
127
139
  })