book-source 0.1.1 → 0.2.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/README.md +2 -2
- package/documentation.md +2 -2
- package/lib/StructuredDocument.js +124 -139
- package/lib/Style.js +7 -1
- package/lib/Theme.js +3 -2
- package/lib/book-source.js +6 -28
- package/lib/documentParts.js +445 -0
- package/package.json +8 -3
- package/css/code.css +0 -120
- package/css/core.css +0 -317
- package/css/standalone.css +0 -30
- package/css/unimplemented.css +0 -65
- package/extlib/chromajs.custom.js +0 -865
- package/lib/Color.js +0 -197
- package/lib/HtmlRenderer.js +0 -618
- package/lib/Palette.js +0 -313
package/lib/Style.js
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
const Color = require( '
|
|
31
|
+
const Color = require( 'palette-shade' ).Color ;
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
@@ -44,6 +44,12 @@ module.exports = Style ;
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
|
+
Style.prototype.merge = function( ... styles ) {
|
|
48
|
+
return Style.merge( this , ... styles ) ;
|
|
49
|
+
} ;
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
47
53
|
Style.merge = function( ... styles ) {
|
|
48
54
|
var mergedStyle = new Style() ;
|
|
49
55
|
|
package/lib/Theme.js
CHANGED
package/lib/book-source.js
CHANGED
|
@@ -33,36 +33,14 @@ module.exports = bookSource ;
|
|
|
33
33
|
|
|
34
34
|
bookSource.StructuredDocument = require( './StructuredDocument.js' ) ;
|
|
35
35
|
bookSource.Style = require( './Style.js' ) ;
|
|
36
|
-
bookSource.Color = require( './Color.js' ) ;
|
|
37
|
-
|
|
38
|
-
bookSource.Palette = require( './Palette.js' ) ;
|
|
39
36
|
bookSource.Theme = require( './Theme.js' ) ;
|
|
40
|
-
bookSource.HtmlRenderer = require( './HtmlRenderer.js' ) ;
|
|
41
|
-
|
|
42
|
-
bookSource.parse = bookSource.StructuredDocument.parse ;
|
|
43
|
-
|
|
44
37
|
|
|
38
|
+
Object.assign( bookSource , require( './documentParts.js' ) ) ;
|
|
45
39
|
|
|
46
|
-
|
|
40
|
+
// Exposed external lib
|
|
41
|
+
const paletteShade = require( 'palette-shade' ) ;
|
|
42
|
+
bookSource.Color = paletteShade.Color ;
|
|
43
|
+
bookSource.Palette = paletteShade.Palette ;
|
|
47
44
|
|
|
48
|
-
bookSource.
|
|
49
|
-
switch ( type ) {
|
|
50
|
-
case 'core' :
|
|
51
|
-
case 'standalone' :
|
|
52
|
-
case 'code' :
|
|
53
|
-
return path.join( __dirname , '..' , 'css' , type + '.css' ) ;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
throw new Error( "There is no built-in CSS of type '" + type + "'" ) ;
|
|
57
|
-
} ;
|
|
58
|
-
|
|
59
|
-
bookSource.getBuiltinCssSync = type => {
|
|
60
|
-
const fs = require( 'fs' ) ;
|
|
61
|
-
return fs.readFileSync( bookSource.getBuiltinCssPath( type ) , 'utf8' ) ;
|
|
62
|
-
} ;
|
|
63
|
-
|
|
64
|
-
bookSource.getBuiltinCss = type => {
|
|
65
|
-
const fs = require( 'fs' ) ;
|
|
66
|
-
return fs.promises.readFile( bookSource.getBuiltinCssPath( type ) , 'utf8' ) ;
|
|
67
|
-
} ;
|
|
45
|
+
bookSource.parse = bookSource.StructuredDocument.parse ;
|
|
68
46
|
|
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Book Source
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2023 Cédric Ronvel
|
|
5
|
+
|
|
6
|
+
The MIT License (MIT)
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
"use strict" ;
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
const documentParts = {} ;
|
|
32
|
+
module.exports = documentParts ;
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
function Part() {
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
documentParts.Part = Part ;
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
function InlinePart() {
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
InlinePart.prototype = Object.create( Part.prototype ) ;
|
|
47
|
+
InlinePart.prototype.constructor = InlinePart ;
|
|
48
|
+
documentParts.InlinePart = InlinePart ;
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
function InlineTextPart( text ) {
|
|
53
|
+
this.text = text ;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
InlineTextPart.prototype = Object.create( Part.prototype ) ;
|
|
57
|
+
InlineTextPart.prototype.constructor = InlineTextPart ;
|
|
58
|
+
documentParts.InlineTextPart = InlineTextPart ;
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
function BlockPart() {
|
|
63
|
+
this.parts = [] ;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
BlockPart.prototype = Object.create( Part.prototype ) ;
|
|
67
|
+
BlockPart.prototype.constructor = BlockPart ;
|
|
68
|
+
documentParts.BlockPart = BlockPart ;
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
// Inline Parts
|
|
73
|
+
|
|
74
|
+
function Text( text ) {
|
|
75
|
+
this.type = 'text' ;
|
|
76
|
+
InlineTextPart.call( this , text ) ;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
Text.prototype = Object.create( InlineTextPart.prototype ) ;
|
|
80
|
+
Text.prototype.constructor = Text ;
|
|
81
|
+
documentParts.Text = Text ;
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
function EmphasisText( text , level ) {
|
|
86
|
+
this.type = 'emphasisText' ;
|
|
87
|
+
this.level = level ;
|
|
88
|
+
InlineTextPart.call( this , text ) ;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
EmphasisText.prototype = Object.create( InlineTextPart.prototype ) ;
|
|
92
|
+
EmphasisText.prototype.constructor = EmphasisText ;
|
|
93
|
+
documentParts.EmphasisText = EmphasisText ;
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
function DecoratedText( text , level ) {
|
|
98
|
+
this.type = 'decoratedText' ;
|
|
99
|
+
this.level = level ;
|
|
100
|
+
this.underline = true ;
|
|
101
|
+
InlineTextPart.call( this , text ) ;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
DecoratedText.prototype = Object.create( InlineTextPart.prototype ) ;
|
|
105
|
+
DecoratedText.prototype.constructor = DecoratedText ;
|
|
106
|
+
documentParts.DecoratedText = DecoratedText ;
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
function Code( text ) {
|
|
111
|
+
this.type = 'code' ;
|
|
112
|
+
InlineTextPart.call( this , text ) ;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
Code.prototype = Object.create( InlineTextPart.prototype ) ;
|
|
116
|
+
Code.prototype.constructor = Code ;
|
|
117
|
+
documentParts.Code = Code ;
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
function Link( text , href , style , title ) {
|
|
122
|
+
this.type = 'link' ;
|
|
123
|
+
this.href = href ;
|
|
124
|
+
this.style = style || undefined ;
|
|
125
|
+
InlineTextPart.call( this , text ) ;
|
|
126
|
+
this.title = title || undefined ;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
Link.prototype = Object.create( InlineTextPart.prototype ) ;
|
|
130
|
+
Link.prototype.constructor = Link ;
|
|
131
|
+
documentParts.Link = Link ;
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
function StyledText( text , style , title ) {
|
|
136
|
+
this.type = 'styledText' ;
|
|
137
|
+
this.style = style || undefined ;
|
|
138
|
+
InlineTextPart.call( this , text ) ;
|
|
139
|
+
this.title = title || undefined ;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
StyledText.prototype = Object.create( InlineTextPart.prototype ) ;
|
|
143
|
+
StyledText.prototype.constructor = StyledText ;
|
|
144
|
+
documentParts.StyledText = StyledText ;
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
function Image( href , altText , title ) {
|
|
149
|
+
this.type = 'image' ;
|
|
150
|
+
this.href = href ;
|
|
151
|
+
this.altText = altText ;
|
|
152
|
+
this.title = title || undefined ;
|
|
153
|
+
InlinePart.call( this ) ;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
Image.prototype = Object.create( InlinePart.prototype ) ;
|
|
157
|
+
Image.prototype.constructor = Image ;
|
|
158
|
+
documentParts.Image = Image ;
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
const emoji = require( 'string-kit/lib/emoji.js' ) ;
|
|
163
|
+
|
|
164
|
+
function Pictogram( code , altText , title ) {
|
|
165
|
+
this.type = 'pictogram' ;
|
|
166
|
+
this.code = code ;
|
|
167
|
+
|
|
168
|
+
var emojiChar = emoji.get( this.code ) ;
|
|
169
|
+
this.emoji = emojiChar || undefined ;
|
|
170
|
+
|
|
171
|
+
this.altText =
|
|
172
|
+
altText ? altText :
|
|
173
|
+
emojiChar ? emoji.getCanonicalName( emojiChar ) :
|
|
174
|
+
undefined ;
|
|
175
|
+
|
|
176
|
+
this.title = title || undefined ;
|
|
177
|
+
|
|
178
|
+
InlinePart.call( this ) ;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
Pictogram.prototype = Object.create( InlinePart.prototype ) ;
|
|
182
|
+
Pictogram.prototype.constructor = Pictogram ;
|
|
183
|
+
documentParts.Pictogram = Pictogram ;
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
// Block parts
|
|
188
|
+
|
|
189
|
+
function Paragraph() {
|
|
190
|
+
this.type = 'paragraph' ;
|
|
191
|
+
BlockPart.call( this ) ;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
Paragraph.prototype = Object.create( BlockPart.prototype ) ;
|
|
195
|
+
Paragraph.prototype.constructor = Paragraph ;
|
|
196
|
+
documentParts.Paragraph = Paragraph ;
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
function Header( level ) {
|
|
201
|
+
this.type = 'header' ;
|
|
202
|
+
this.level = level ;
|
|
203
|
+
BlockPart.call( this ) ;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
Header.prototype = Object.create( BlockPart.prototype ) ;
|
|
207
|
+
Header.prototype.constructor = Header ;
|
|
208
|
+
documentParts.Header = Header ;
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
function Cite() {
|
|
213
|
+
this.type = 'cite' ;
|
|
214
|
+
BlockPart.call( this ) ;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
Cite.prototype = Object.create( BlockPart.prototype ) ;
|
|
218
|
+
Cite.prototype.constructor = Cite ;
|
|
219
|
+
documentParts.Cite = Cite ;
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
function List( indent ) {
|
|
224
|
+
this.type = 'list' ;
|
|
225
|
+
this.indent = indent ;
|
|
226
|
+
BlockPart.call( this ) ;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
List.prototype = Object.create( BlockPart.prototype ) ;
|
|
230
|
+
List.prototype.constructor = List ;
|
|
231
|
+
documentParts.List = List ;
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
function ListItem( indent ) {
|
|
236
|
+
this.type = 'listItem' ;
|
|
237
|
+
this.indent = indent ;
|
|
238
|
+
BlockPart.call( this ) ;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
ListItem.prototype = Object.create( BlockPart.prototype ) ;
|
|
242
|
+
ListItem.prototype.constructor = ListItem ;
|
|
243
|
+
documentParts.ListItem = ListItem ;
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
function OrderedList( indent ) {
|
|
248
|
+
this.type = 'orderedList' ;
|
|
249
|
+
this.indent = indent ;
|
|
250
|
+
BlockPart.call( this ) ;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
OrderedList.prototype = Object.create( BlockPart.prototype ) ;
|
|
254
|
+
OrderedList.prototype.constructor = OrderedList ;
|
|
255
|
+
documentParts.OrderedList = OrderedList ;
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
function OrderedListItem( indent , order ) {
|
|
260
|
+
this.type = 'orderedListItem' ;
|
|
261
|
+
this.indent = indent ;
|
|
262
|
+
this.order = order ;
|
|
263
|
+
BlockPart.call( this ) ;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
OrderedListItem.prototype = Object.create( BlockPart.prototype ) ;
|
|
267
|
+
OrderedListItem.prototype.constructor = OrderedListItem ;
|
|
268
|
+
documentParts.OrderedListItem = OrderedListItem ;
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
function Quote( indent ) {
|
|
273
|
+
this.type = 'quote' ;
|
|
274
|
+
this.indent = indent ;
|
|
275
|
+
BlockPart.call( this ) ;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
Quote.prototype = Object.create( BlockPart.prototype ) ;
|
|
279
|
+
Quote.prototype.constructor = Quote ;
|
|
280
|
+
documentParts.Quote = Quote ;
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
function HorizontalRule( clearFloat ) {
|
|
285
|
+
this.type = 'horizontalRule' ;
|
|
286
|
+
this.clearFloat = clearFloat ;
|
|
287
|
+
BlockPart.call( this ) ;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
HorizontalRule.prototype = Object.create( BlockPart.prototype ) ;
|
|
291
|
+
HorizontalRule.prototype.constructor = HorizontalRule ;
|
|
292
|
+
documentParts.HorizontalRule = HorizontalRule ;
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
function ClearFloat() {
|
|
297
|
+
this.type = 'clearFloat' ;
|
|
298
|
+
BlockPart.call( this ) ;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
ClearFloat.prototype = Object.create( BlockPart.prototype ) ;
|
|
302
|
+
ClearFloat.prototype.constructor = ClearFloat ;
|
|
303
|
+
documentParts.ClearFloat = ClearFloat ;
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
function CodeBlock( text , lang ) {
|
|
308
|
+
this.type = 'codeBlock' ;
|
|
309
|
+
this.lang = lang || undefined ;
|
|
310
|
+
this.text = text ;
|
|
311
|
+
BlockPart.call( this ) ;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
CodeBlock.prototype = Object.create( BlockPart.prototype ) ;
|
|
315
|
+
CodeBlock.prototype.constructor = CodeBlock ;
|
|
316
|
+
documentParts.CodeBlock = CodeBlock ;
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
function Anchor( href ) {
|
|
321
|
+
this.type = 'anchor' ;
|
|
322
|
+
this.href = href ;
|
|
323
|
+
BlockPart.call( this ) ;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
Anchor.prototype = Object.create( BlockPart.prototype ) ;
|
|
327
|
+
Anchor.prototype.constructor = Anchor ;
|
|
328
|
+
documentParts.Anchor = Anchor ;
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
function Table() {
|
|
333
|
+
this.type = 'table' ;
|
|
334
|
+
this.columns = [] ;
|
|
335
|
+
this.multilineRowMode = false ;
|
|
336
|
+
this.hasHeadSeparator = false ;
|
|
337
|
+
this.hasRowSeparator = false ;
|
|
338
|
+
BlockPart.call( this ) ;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
Table.prototype = Object.create( BlockPart.prototype ) ;
|
|
342
|
+
Table.prototype.constructor = Table ;
|
|
343
|
+
documentParts.Table = Table ;
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
function TableCaption( style ) {
|
|
348
|
+
this.type = 'tableCaption' ;
|
|
349
|
+
this.style = style || undefined ;
|
|
350
|
+
BlockPart.call( this ) ;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
TableCaption.prototype = Object.create( BlockPart.prototype ) ;
|
|
354
|
+
TableCaption.prototype.constructor = TableCaption ;
|
|
355
|
+
documentParts.TableCaption = TableCaption ;
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
function TableRow( style ) {
|
|
360
|
+
this.type = 'tableRow' ;
|
|
361
|
+
this.style = style || undefined ;
|
|
362
|
+
this.rowSeparator = false ;
|
|
363
|
+
this.continueRowSpan = undefined ;
|
|
364
|
+
BlockPart.call( this ) ;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
TableRow.prototype = Object.create( BlockPart.prototype ) ;
|
|
368
|
+
TableRow.prototype.constructor = TableRow ;
|
|
369
|
+
documentParts.TableRow = TableRow ;
|
|
370
|
+
|
|
371
|
+
TableRow.prototype.toHead = function() {
|
|
372
|
+
var tableHeadRow = new TableHeadRow( this.style ) ;
|
|
373
|
+
tableHeadRow.rowSeparator = this.rowSeparator ;
|
|
374
|
+
tableHeadRow.continueRowSpan = this.continueRowSpan ;
|
|
375
|
+
tableHeadRow.parts = this.parts ;
|
|
376
|
+
return tableHeadRow ;
|
|
377
|
+
} ;
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
function TableHeadRow( style ) {
|
|
382
|
+
this.type = 'tableHeadRow' ;
|
|
383
|
+
this.style = style || undefined ;
|
|
384
|
+
this.rowSeparator = false ;
|
|
385
|
+
this.continueRowSpan = undefined ;
|
|
386
|
+
BlockPart.call( this ) ;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
TableHeadRow.prototype = Object.create( BlockPart.prototype ) ;
|
|
390
|
+
TableHeadRow.prototype.constructor = TableHeadRow ;
|
|
391
|
+
documentParts.TableHeadRow = TableHeadRow ;
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
function TableCell( style ) {
|
|
396
|
+
this.type = 'tableCell' ;
|
|
397
|
+
this.style = style || undefined ;
|
|
398
|
+
this.column = - 1 ; // The column index
|
|
399
|
+
this.columnSeparator = false ;
|
|
400
|
+
this.columnSpan = 1 ;
|
|
401
|
+
this.rowSpan = 1 ;
|
|
402
|
+
this.sx = - 1 ;
|
|
403
|
+
this.ex = - 1 ;
|
|
404
|
+
this.masterCell = undefined ;
|
|
405
|
+
BlockPart.call( this ) ;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
TableCell.prototype = Object.create( BlockPart.prototype ) ;
|
|
409
|
+
TableCell.prototype.constructor = TableCell ;
|
|
410
|
+
documentParts.TableCell = TableCell ;
|
|
411
|
+
|
|
412
|
+
TableCell.prototype.toHead = function() {
|
|
413
|
+
var tableHeadCell = new TableHeadCell( this.style ) ;
|
|
414
|
+
tableHeadCell.column = this.column ;
|
|
415
|
+
tableHeadCell.columnSeparator = this.columnSeparator ;
|
|
416
|
+
tableHeadCell.columnSpan = this.columnSpan ;
|
|
417
|
+
tableHeadCell.rowSpan = this.rowSpan ;
|
|
418
|
+
tableHeadCell.sx = this.sx ;
|
|
419
|
+
tableHeadCell.ex = this.ex ;
|
|
420
|
+
tableHeadCell.masterCell = this.masterCell ;
|
|
421
|
+
tableHeadCell.parts = this.parts ;
|
|
422
|
+
return tableHeadCell ;
|
|
423
|
+
} ;
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
function TableHeadCell( style ) {
|
|
428
|
+
this.type = 'tableHeadCell' ;
|
|
429
|
+
this.style = style || undefined ;
|
|
430
|
+
this.column = - 1 ;
|
|
431
|
+
this.columnSeparator = false ;
|
|
432
|
+
this.columnSpan = 1 ;
|
|
433
|
+
this.rowSpan = 1 ;
|
|
434
|
+
this.sx = - 1 ;
|
|
435
|
+
this.ex = - 1 ;
|
|
436
|
+
this.masterCell = undefined ;
|
|
437
|
+
this.isColumnHead = false ;
|
|
438
|
+
this.isRowHead = false ;
|
|
439
|
+
BlockPart.call( this ) ;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
TableHeadCell.prototype = Object.create( BlockPart.prototype ) ;
|
|
443
|
+
TableHeadCell.prototype.constructor = TableHeadCell ;
|
|
444
|
+
documentParts.TableHeadCell = TableHeadCell ;
|
|
445
|
+
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "book-source",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A lightweight markup language, inspired by Markdown",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "A lightweight markup language, inspired by Markdown.",
|
|
5
5
|
"main": "lib/book-source.js",
|
|
6
6
|
"directories": {
|
|
7
7
|
"test": "test"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"array-kit": "^0.2.6",
|
|
11
|
-
"
|
|
11
|
+
"palette-shade": "^0.1.1",
|
|
12
12
|
"string-kit": "^0.18.0"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
"url": "https://github.com/cronvel/book-source.git"
|
|
20
20
|
},
|
|
21
21
|
"keywords": [
|
|
22
|
+
"lightweight",
|
|
22
23
|
"markup",
|
|
24
|
+
"language",
|
|
23
25
|
"book",
|
|
24
26
|
"source"
|
|
25
27
|
],
|
|
@@ -34,5 +36,8 @@
|
|
|
34
36
|
2023
|
|
35
37
|
],
|
|
36
38
|
"owner": "Cédric Ronvel"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=14.15.0"
|
|
37
42
|
}
|
|
38
43
|
}
|
package/css/code.css
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
.book-source .hljs {
|
|
2
|
-
display: block;
|
|
3
|
-
padding: 0.5em;
|
|
4
|
-
color: #333;
|
|
5
|
-
background: #f8f8f8;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.book-source .hljs-comment ,
|
|
9
|
-
.book-source .hljs-template_comment ,
|
|
10
|
-
.book-source .diff .hljs-header ,
|
|
11
|
-
.book-source .hljs-javadoc {
|
|
12
|
-
color: #998;
|
|
13
|
-
font-style: italic;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.book-source .hljs-keyword ,
|
|
17
|
-
.book-source .css .rule .hljs-keyword ,
|
|
18
|
-
.book-source .hljs-winutils ,
|
|
19
|
-
.book-source .javascript .hljs-title ,
|
|
20
|
-
.book-source .nginx .hljs-title ,
|
|
21
|
-
.book-source .hljs-subst ,
|
|
22
|
-
.book-source .hljs-request ,
|
|
23
|
-
.book-source .hljs-status {
|
|
24
|
-
color: #333;
|
|
25
|
-
font-weight: bold;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.book-source .hljs-number ,
|
|
29
|
-
.book-source .hljs-hexcolor ,
|
|
30
|
-
.book-source .ruby .hljs-constant {
|
|
31
|
-
color: #099;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.book-source .hljs-string ,
|
|
35
|
-
.book-source .hljs-tag .hljs-value ,
|
|
36
|
-
.book-source .hljs-phpdoc ,
|
|
37
|
-
.book-source .tex .hljs-formula {
|
|
38
|
-
color: #d14;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.book-source .hljs-title ,
|
|
42
|
-
.book-source .hljs-id ,
|
|
43
|
-
.book-source .coffeescript .hljs-params ,
|
|
44
|
-
.book-source .scss .hljs-preprocessor {
|
|
45
|
-
color: #900;
|
|
46
|
-
font-weight: bold;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.book-source .javascript .hljs-title ,
|
|
50
|
-
.book-source .lisp .hljs-title ,
|
|
51
|
-
.book-source .clojure .hljs-title ,
|
|
52
|
-
.book-source .hljs-subst {
|
|
53
|
-
font-weight: normal;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.book-source .hljs-class .hljs-title ,
|
|
57
|
-
.book-source .haskell .hljs-type ,
|
|
58
|
-
.book-source .vhdl .hljs-literal ,
|
|
59
|
-
.book-source .tex .hljs-command {
|
|
60
|
-
color: #458;
|
|
61
|
-
font-weight: bold;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.book-source .hljs-tag ,
|
|
65
|
-
.book-source .hljs-tag .hljs-title ,
|
|
66
|
-
.book-source .hljs-rules .hljs-property ,
|
|
67
|
-
.book-source .django .hljs-tag .hljs-keyword {
|
|
68
|
-
color: #000080;
|
|
69
|
-
font-weight: normal;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.book-source .hljs-attribute ,
|
|
73
|
-
.book-source .hljs-variable ,
|
|
74
|
-
.book-source .lisp .hljs-body {
|
|
75
|
-
color: #008080;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.book-source .hljs-regexp {
|
|
79
|
-
color: #009926;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.book-source .hljs-symbol ,
|
|
83
|
-
.book-source .ruby .hljs-symbol .hljs-string ,
|
|
84
|
-
.book-source .lisp .hljs-keyword ,
|
|
85
|
-
.book-source .tex .hljs-special ,
|
|
86
|
-
.book-source .hljs-prompt {
|
|
87
|
-
color: #990073;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.book-source .hljs-built_in ,
|
|
91
|
-
.book-source .lisp .hljs-title ,
|
|
92
|
-
.book-source .clojure .hljs-built_in {
|
|
93
|
-
color: #0086b3;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.book-source .hljs-preprocessor ,
|
|
97
|
-
.book-source .hljs-pragma ,
|
|
98
|
-
.book-source .hljs-pi ,
|
|
99
|
-
.book-source .hljs-doctype ,
|
|
100
|
-
.book-source .hljs-shebang ,
|
|
101
|
-
.book-source .hljs-cdata {
|
|
102
|
-
color: #999;
|
|
103
|
-
font-weight: bold;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.book-source .hljs-deletion {
|
|
107
|
-
background: #fdd;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.book-source .hljs-addition {
|
|
111
|
-
background: #dfd;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.book-source .diff .hljs-change {
|
|
115
|
-
background: #0086b3;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.book-source .hljs-chunk {
|
|
119
|
-
color: #aaa;
|
|
120
|
-
}
|