book-source 0.3.6 → 0.3.7

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 (2) hide show
  1. package/lib/Style.js +10 -2
  2. package/package.json +1 -1
package/lib/Style.js CHANGED
@@ -38,6 +38,7 @@ function Style() {
38
38
  this.bold = null ;
39
39
  this.italic = null ;
40
40
  this.underline = null ;
41
+ this.fx = null ;
41
42
  }
42
43
 
43
44
  module.exports = Style ;
@@ -69,6 +70,7 @@ Style.merge = function( ... styles ) {
69
70
  const BOOLEAN_PROPERTIES = new Set( [ 'bold' , 'italic' , 'underline' ] ) ;
70
71
  const TEXT_COLOR_PROPERTIES = new Set( [ 'text' , 'tx' , 'foreground' , 'fg' ] ) ;
71
72
  const BACKGROUND_COLOR_PROPERTIES = new Set( [ 'background' , 'bg' ] ) ;
73
+ const FX_PROPERTIES = new Set( [ 'fx' ] ) ;
72
74
 
73
75
 
74
76
 
@@ -79,9 +81,12 @@ Style.parse = function( str , forTextElement = true ) {
79
81
  let [ property , value ] = part.split( ':' ) ;
80
82
 
81
83
  if ( value ) {
82
- property = TEXT_COLOR_PROPERTIES.has( property ) ? 'text' :
84
+ property =
85
+ TEXT_COLOR_PROPERTIES.has( property ) ? 'text' :
83
86
  BACKGROUND_COLOR_PROPERTIES.has( property ) ? 'background' :
84
- forTextElement ? 'text' : 'background' ;
87
+ FX_PROPERTIES.has( property ) ? 'fx' :
88
+ forTextElement ? 'text' :
89
+ 'background' ;
85
90
  }
86
91
  else {
87
92
  if ( BOOLEAN_PROPERTIES.has( property ) ) {
@@ -100,6 +105,9 @@ Style.parse = function( str , forTextElement = true ) {
100
105
  case 'background' :
101
106
  style.backgroundColor = Color.parse( value ) ;
102
107
  break ;
108
+ case 'fx' :
109
+ style.fx = value ;
110
+ break ;
103
111
  }
104
112
  }
105
113
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "book-source",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "A lightweight markup language, inspired by Markdown.",
5
5
  "main": "lib/book-source.js",
6
6
  "directories": {