@tim-greller/xgettext-regex 0.8.0 → 0.8.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.
Files changed (3) hide show
  1. package/README.md +6 -0
  2. package/index.js +5 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -20,6 +20,12 @@ ___________________
20
20
  - Switched to **relative paths** for location comments to prohibit commiting personal workspace directory paths.
21
21
  ___________________
22
22
 
23
+ ## Install
24
+
25
+ ```sh
26
+ npm i @tim-greller/xgettext-regex
27
+ ```
28
+
23
29
  ## Examples
24
30
 
25
31
  ```sh
package/index.js CHANGED
@@ -81,13 +81,14 @@ function createDuplexStream (filename, opts) {
81
81
  text = '"' + text.replace(/"/g, '\\"') + '"'
82
82
  }
83
83
 
84
- // handle triple-quoted string (java code blocks)
84
+ // handle triple-quoted string (java text blocks)
85
85
  if (text.slice(0, 3) == '"""') {
86
86
  text = text
87
87
  .slice(3, -3)
88
- .replace(/^\r?\n\s*/, '') // remove initial new line
89
- .replace(/\\\r?\n\s*/g, '') // escaped linebreak + indent
90
- .replace(/\r?\n\s*/g, '\\n') // normal linebreak + indent
88
+ // The following regexes use the double-negation [^\S\r\n] which corresponds to \s but excludes \r and \n.
89
+ .replace(/^\r?\n[^\S\r\n]*/, '') // remove initial new line
90
+ .replace(/\\\r?\n[^\S\r\n]*/g, '') // escaped linebreak + indent
91
+ .replace(/\r?\n[^\S\r\n]*/g, '\\n') // normal linebreak + indent
91
92
  text = `"${text}"`
92
93
  }
93
94
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tim-greller/xgettext-regex",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Minimum viable xgettext .po file generator. Uses a configurable regex to get translation keys.",
5
5
  "main": "index.js",
6
6
  "scripts": {