/
asciidoctor-core-api.js
1277 lines (1117 loc) · 29.4 KB
/
asciidoctor-core-api.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Convert a JSON to an (Opal) Hash.
* @private
*/
var toHash = function (object) {
return object && !('$$smap' in object) ? Opal.hash(object) : object;
};
/**
* Convert an (Opal) Hash to JSON.
* @private
*/
var fromHash = function (hash) {
var object = {};
for (var i = 0, keys = hash.$$keys, data = hash.$$smap, len = keys.length; i < len; i++) {
var key = keys[i];
object[key] = data[key];
}
return object;
};
/**
* @private
*/
var prepareOptions = function (options) {
if (options = toHash(options)) {
var attrs = options['$[]']('attributes');
if (attrs && typeof attrs === 'object' && attrs.constructor.name === 'Object') {
options = options.$dup();
options['$[]=']('attributes', toHash(attrs));
}
}
return options;
};
// Asciidoctor API
/**
* @namespace
* @description
* Methods for parsing AsciiDoc input files and converting documents.
*
* AsciiDoc documents comprise a header followed by zero or more sections.
* Sections are composed of blocks of content. For example:
* <pre>
* = Doc Title
*
* == Section 1
*
* This is a paragraph block in the first section.
*
* == Section 2
*
* This section has a paragraph block and an olist block.
*
* . Item 1
* . Item 2
* </pre>
*
* @example
* asciidoctor.convertFile('sample.adoc');
*/
var Asciidoctor = Opal.Asciidoctor['$$class'];
/**
* Get Asciidoctor core version number.
*
* @memberof Asciidoctor
* @returns {string} - returns the version number of Asciidoctor core.
*/
Asciidoctor.$$proto.getCoreVersion = function () {
return this.$$const.VERSION;
};
/**
* Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format.
*
* Accepts input as a Buffer or String.
*
* @param {string|Buffer} input - AsciiDoc input as String or Buffer
* @param {Object} options - a JSON of options to control processing (default: {})
* @returns {string|Document} - returns the {@link Document} object if the converted String is written to a file,
* otherwise the converted String
* @memberof Asciidoctor
* @example
* var input = '= Hello, AsciiDoc!\n' +
* 'Guillaume Grossetie <ggrossetie@example.com>\n\n' +
* 'An introduction to http://asciidoc.org[AsciiDoc].\n\n' +
* '== First Section\n\n' +
* '* item 1\n' +
* '* item 2\n';
*
* var html = asciidoctor.convert(input);
*/
Asciidoctor.$$proto.convert = function (input, options) {
if (typeof input === 'object' && input.constructor.name === 'Buffer') {
input = input.toString('utf8');
}
var result = this.$convert(input, prepareOptions(options));
return result === Opal.nil ? '' : result;
};
/**
* Parse the AsciiDoc source input into an {@link Document} and convert it to the specified backend format.
*
* @param {string} filename - source filename
* @param {Object} options - a JSON of options to control processing (default: {})
* @returns {string|Document} - returns the {@link Document} object if the converted String is written to a file,
* otherwise the converted String
* @memberof Asciidoctor
* @example
* var html = asciidoctor.convertFile('./document.adoc');
*/
Asciidoctor.$$proto.convertFile = function (filename, options) {
return this.$convert_file(filename, prepareOptions(options));
};
/**
* Parse the AsciiDoc source input into an {@link Document}
*
* Accepts input as a Buffer or String.
*
* @param {string|Buffer} input - AsciiDoc input as String or Buffer
* @param {Object} options - a JSON of options to control processing (default: {})
* @returns {Document} - returns the {@link Document} object
* @memberof Asciidoctor
*/
Asciidoctor.$$proto.load = function (input, options) {
if (typeof input === 'object' && input.constructor.name === 'Buffer') {
input = input.toString('utf8');
}
return this.$load(input, prepareOptions(options));
};
/**
* Parse the contents of the AsciiDoc source file into an {@link Document}
*
* @param {string} filename - source filename
* @param {Object} options - a JSON of options to control processing (default: {})
* @returns {Document} - returns the {@link Document} object
* @memberof Asciidoctor
*/
Asciidoctor.$$proto.loadFile = function (filename, options) {
return this.$load_file(filename, prepareOptions(options));
};
// AbstractBlock API
/**
* @namespace
* @extends AbstractNode
*/
var AbstractBlock = Opal.Asciidoctor.AbstractBlock;
/**
* Get the String title of this Block with title substitions applied
*
* The following substitutions are applied to block and section titles:
*
* <code>specialcharacters</code>, <code>quotes</code>, <code>replacements</code>, <code>macros</code>, <code>attributes</code> and <code>post_replacements</code>
*
* @memberof AbstractBlock
* @returns {string} - returns the converted String title for this Block, or undefined if the title is not set.
* @example
* block.title // "Foo 3^ # {two-colons} Bar(1)"
* block.getTitle(); // "Foo 3^ # :: Bar(1)"
*/
AbstractBlock.$$proto.getTitle = function () {
var title = this.$title();
return title === Opal.nil ? undefined : title;
};
/**
* Convenience method that returns the interpreted title of the Block
* with the caption prepended.
* Concatenates the value of this Block's caption instance variable and the
* return value of this Block's title method. No space is added between the
* two values. If the Block does not have a caption, the interpreted title is
* returned.
*
* @memberof AbstractBlock
* @returns {string} - the converted String title prefixed with the caption, or just the
* converted String title if no caption is set
*/
AbstractBlock.$$proto.getCaptionedTitle = function () {
return this.$captioned_title();
};
/**
* Get the style (block type qualifier) for this block.
* @memberof AbstractBlock
* @returns {string} - returns the style for this block
*/
AbstractBlock.$$proto.getStyle = function () {
return this.style;
};
/**
* Get the caption for this block.
* @memberof AbstractBlock
* @returns {string} - returns the caption for this block
*/
AbstractBlock.$$proto.getCaption = function () {
return this.$caption();
};
/**
* Set the caption for this block.
* @param {string} caption - Caption
* @memberof AbstractBlock
*/
AbstractBlock.$$proto.setCaption = function (caption) {
this.caption = caption;
};
/**
* Get the level of this section or the section level in which this block resides.
* @memberof AbstractBlock
* @returns {number} - returns the level of this section
*/
AbstractBlock.$$proto.getLevel = function () {
return this.level;
};
/**
* Get the substitution keywords to be applied to the contents of this block.
*
* @memberof AbstractBlock
* @returns {Array} - the list of {string} substitution keywords associated with this block.
*/
AbstractBlock.$$proto.getSubstitutions = function () {
return this.subs;
};
/**
* Check whether a given substitution keyword is present in the substitutions for this block.
*
* @memberof AbstractBlock
* @returns {boolean} - whether the substitution is present on this block.
*/
AbstractBlock.$$proto.hasSubstitution = function (substitution) {
return this['$sub?'](substitution);
};
/**
* Remove the specified substitution keyword from the list of substitutions for this block.
*
* @memberof AbstractBlock
* @returns undefined
*/
AbstractBlock.$$proto.removeSubstitution = function (substitution) {
this.$remove_sub(substitution);
};
/**
* Get the list of {@link AbstractBlock} sub-blocks for this block.
* @memberof AbstractBlock
* @returns {Array} - returns a list of {@link AbstractBlock} sub-blocks
*/
AbstractBlock.$$proto.getBlocks = function () {
return this.blocks;
};
/**
* Get the converted result of the child blocks by converting the children appropriate to content model that this block supports.
* @memberof AbstractBlock
* @returns {string} - returns the converted result of the child blocks
*/
AbstractBlock.$$proto.getContent = function () {
return this.$content();
};
/**
* Get the converted content for this block.
* If the block has child blocks, the content method should cause them to be converted
* and returned as content that can be included in the parent block's template.
* @memberof AbstractBlock
* @returns {string} - returns the converted String content for this block
*/
AbstractBlock.$$proto.convert = function () {
return this.$convert();
};
/**
* Query for all descendant block-level nodes in the document tree
* that match the specified selector (context, style, id, and/or role).
* If a function block is given, it's used as an additional filter.
* If no selector or function block is supplied, all block-level nodes in the tree are returned.
* @param {Object} [selector]
* @param {function} [block]
* @example
* doc.findBy({'context': 'section'});
* // => { level: 0, title: "Hello, AsciiDoc!", blocks: 0 }
* // => { level: 1, title: "First Section", blocks: 1 }
*
* doc.findBy({'context': 'section'}, function (section) { return section.getLevel() === 1; });
* // => { level: 1, title: "First Section", blocks: 1 }
*
* doc.findBy({'context': 'listing', 'style': 'source'});
* // => { context: :listing, content_model: :verbatim, style: "source", lines: 1 }
*
* @memberof AbstractBlock
* @returns {Array} - returns a list of block-level nodes that match the filter or an empty list if no matches are found
*/
AbstractBlock.$$proto.findBy = function (selector, block) {
if (typeof block === 'undefined' && typeof selector === 'function') {
return Opal.send(this, 'find_by', null, selector);
}
else if (typeof block === 'function') {
return Opal.send(this, 'find_by', [toHash(selector)], block);
}
else {
return this.$find_by(toHash(selector));
}
};
/**
* Get the source line number where this block started.
* @memberof AbstractBlock
* @returns {number} - returns the source line number where this block started
*/
AbstractBlock.$$proto.getLineNumber = function () {
var lineno = this.$lineno();
return lineno === Opal.nil ? undefined : lineno;
};
/**
* @namespace
*/
var Block = Opal.Asciidoctor.Block;
/**
* Get the source of this block.
* @memberof Block
* @returns {string} - returns the String source of this block.
*/
Block.$$proto.getSource = function () {
return this.$source();
};
/**
* Get the source lines of this block.
* @memberof Block
* @returns {Array} - returns the String {Array} of source lines for this block.
*/
Block.$$proto.getSourceLines = function () {
return this.lines;
};
// AbstractNode API
/**
* @namespace
*/
var AbstractNode = Opal.Asciidoctor.AbstractNode;
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.getAttributes = function () {
return fromHash(this.attributes);
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.getAttribute = function (name, defaultValue, inherit) {
var value = this.$attr(name, defaultValue, inherit);
return value === Opal.nil ? undefined : value;
};
/**
* Check whether the specified attribute is present on this node.
*
* @memberof AbstractNode
* @returns {boolean} true if the attribute is present, otherwise false
*/
AbstractNode.$$proto.hasAttribute = function (name) {
return name in this.attributes.$$smap;
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.isAttribute = function (name, expectedValue, inherit) {
var result = this['$attr?'](name, expectedValue, inherit);
return result === Opal.nil ? false : result;
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.setAttribute = function (name, value, overwrite) {
if (typeof overwrite === 'undefined') overwrite = true;
return this.$set_attr(name, value, overwrite);
};
/**
* Remove the attribute from the current node.
* @param {string} name - The String attribute name to remove
* @returns {string} - returns the previous {String} value, or undefined if the attribute was not present.
* @memberof AbstractNode
*/
AbstractNode.$$proto.removeAttribute = function (name) {
var value = this.$remove_attr(name);
return value === Opal.nil ? undefined : value;
};
/**
* Get the {@link Document} to which this node belongs.
*
* @memberof AbstractNode
* @returns {Document} - returns the {@link Document} object to which this node belongs.
*/
AbstractNode.$$proto.getDocument = function () {
return this.document;
};
/**
* Get the {@link AbstractNode} to which this node is attached.
*
* @memberof AbstractNode
* @returns {AbstractNode} - returns the {@link AbstractNode} object to which this node is attached,
* or undefined if this node has no parent.
*/
AbstractNode.$$proto.getParent = function () {
var parent = this.parent;
return parent === Opal.nil ? undefined : parent;
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.isInline = function () {
return this['$inline?']();
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.isBlock = function () {
return this['$block?']();
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.isRole = function (expected) {
return this['$role?'](expected);
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.getRole = function () {
return this.$role();
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.hasRole = function (name) {
return this['$has_role?'](name);
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.getRoles = function () {
return this.$roles();
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.addRole = function (name) {
return this.$add_role(name);
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.removeRole = function (name) {
return this.$remove_role(name);
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.isReftext = function () {
return this['$reftext?']();
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.getReftext = function () {
return this.$reftext();
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.getContext = function () {
var context = this.context;
// Automatically convert Opal pseudo-symbol to String
return typeof context === 'string' ? context : context.toString();
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.getId = function () {
return this.id;
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.isOption = function (name) {
return this['$option?'](name);
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.setOption = function (name) {
return this.$set_option(name);
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.getIconUri = function (name) {
return this.$icon_uri(name);
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.getMediaUri = function (target, assetDirKey) {
return this.$media_uri(target, assetDirKey);
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.getImageUri = function (targetImage, assetDirKey) {
return this.$image_uri(targetImage, assetDirKey);
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.getConverter = function () {
return this.$converter();
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.readContents = function (target, options) {
return this.$read_contents(target, toHash(options));
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.readAsset = function (path, options) {
return this.$read_asset(path, toHash(options));
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.normalizeWebPath = function (target, start, preserveTargetUri) {
return this.$normalize_web_path(target, start, preserveTargetUri);
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.normalizeSystemPath = function (target, start, jail, options) {
return this.$normalize_system_path(target, start, jail, toHash(options));
};
/**
* @memberof AbstractNode
*/
AbstractNode.$$proto.normalizeAssetPath = function (assetRef, assetName, autoCorrect) {
return this.$normalize_asset_path(assetRef, assetName, autoCorrect);
};
// Document API
/**
* @namespace
* @extends AbstractBlock
*/
var Document = Opal.Asciidoctor.Document;
/**
* @returns {string} - returns the level-0 section
* @memberof Document
*/
Document.$$proto.getHeader = function () {
return this.header;
};
/**
* @memberof Document
*/
Document.$$proto.setAttribute = function (name, value) {
return this.$set_attribute(name, value);
};
/**
* @memberof Document
*/
Document.$$proto.removeAttribute = function (name) {
this.attributes.$delete(name);
this.attribute_overrides.$delete(name);
};
/**
* @memberof Document
*/
Document.$$proto.convert = function (options) {
var result = this.$convert(toHash(options));
return result === Opal.nil ? '' : result;
};
/**
* @memberof Document
*/
Document.$$proto.write = function (output, target) {
return this.$write(output, target);
};
/**
* @returns {string} - returns the full name of the author as a String
* @memberof Document
*/
Document.$$proto.getAuthor = function () {
return this.$author();
};
/**
* @memberof Document
*/
Document.$$proto.getSource = function () {
return this.$source();
};
/**
* @memberof Document
*/
Document.$$proto.getSourceLines = function () {
return this.$source_lines();
};
/**
* @memberof Document
*/
Document.$$proto.isNested = function () {
return this['$nested?']();
};
/**
* @memberof Document
*/
Document.$$proto.hasFootnotes = function () {
return this['$footnotes?']();
};
/**
* @memberof Document
*/
Document.$$proto.getFootnotes = function () {
return this.$footnotes();
};
/**
* @memberof Document
*/
Document.$$proto.isEmbedded = function () {
return this['$embedded?']();
};
/**
* @memberof Document
*/
Document.$$proto.hasExtensions = function () {
return this['$extensions?']();
};
/**
* @memberof Document
*/
Document.$$proto.getDoctype = function () {
return this.doctype;
};
/**
* @memberof Document
*/
Document.$$proto.getBackend = function () {
return this.backend;
};
/**
* @memberof Document
*/
Document.$$proto.isBasebackend = function (base) {
return this['$basebackend?'](base);
};
/**
* Get the title explicitly defined in the document attributes.
* @returns {string}
* @see {@link AbstractNode#getAttributes}
* @memberof Document
*/
Document.$$proto.getTitle = function () {
var title = this.$title();
return title === Opal.nil ? undefined : title;
};
/**
* @memberof Document
*/
Document.$$proto.setTitle = function (title) {
return this['$title='](title);
};
/**
* @memberof Document
* @returns {Document/Title} - returns a {@link Document/Title}
*/
Document.$$proto.getDocumentTitle = function (options) {
var doctitle = this.$doctitle(toHash(options));
return doctitle === Opal.nil ? undefined : doctitle;
};
/**
* @memberof Document
* @see {@link Document#getDocumentTitle}
*/
Document.$$proto.getDoctitle = Document.$$proto.getDocumentTitle;
/**
* Get the document catalog Hash.
* @memberof Document
*/
Document.$$proto.getCatalog = function () {
return fromHash(this.catalog);
};
/**
* @memberof Document
*/
Document.$$proto.getReferences = Document.$$proto.getCatalog;
/**
* Get the document revision date from document header (document attribute <code>revdate</code>).
* @memberof Document
*/
Document.$$proto.getRevisionDate = function () {
return this.getAttribute('revdate');
};
/**
* @memberof Document
* @see Document#getRevisionDate
*/
Document.$$proto.getRevdate = function () {
return this.getRevisionDate();
};
/**
* Get the document revision number from document header (document attribute <code>revnumber</code>).
* @memberof Document
*/
Document.$$proto.getRevisionNumber = function () {
return this.getAttribute('revnumber');
};
/**
* Get the document revision remark from document header (document attribute <code>revremark</code>).
* @memberof Document
*/
Document.$$proto.getRevisionRemark = function () {
return this.getAttribute('revremark');
};
// private constructor
Document.RevisionInfo = function (date, number, remark) {
this.date = date;
this.number = number;
this.remark = remark;
};
/**
* @class
* @namespace
* @module Document/RevisionInfo
*/
var RevisionInfo = Document.RevisionInfo;
/**
* Get the document revision date from document header (document attribute <code>revdate</code>).
* @memberof Document/RevisionInfo
*/
RevisionInfo.prototype.getDate = function () {
return this.date;
};
/**
* Get the document revision number from document header (document attribute <code>revnumber</code>).
* @memberof Document/RevisionInfo
*/
RevisionInfo.prototype.getNumber = function () {
return this.number;
};
/**
* Get the document revision remark from document header (document attribute <code>revremark</code>).
* A short summary of changes in this document revision.
* @memberof Document/RevisionInfo
*/
RevisionInfo.prototype.getRemark = function () {
return this.remark;
};
/**
* @memberof Document/RevisionInfo
* @returns {boolean} - returns true if the revision info is empty (ie. not defined), otherwise false
*/
RevisionInfo.prototype.isEmpty = function () {
return this.date === undefined && this.number === undefined && this.remark === undefined;
};
/**
* @memberof Document
* @returns {Document/RevisionInfo} - returns a {@link Document/RevisionInfo}
*/
Document.$$proto.getRevisionInfo = function () {
return new Document.RevisionInfo(this.getRevisionDate(), this.getRevisionNumber(), this.getRevisionRemark());
};
/**
* @memberof Document
* @returns {boolean} - returns true if the document contains revision info, otherwise false
*/
Document.$$proto.hasRevisionInfo = function () {
var revisionInfo = this.getRevisionInfo();
return !revisionInfo.isEmpty();
};
/**
* @memberof Document
*/
Document.$$proto.getNotitle = function () {
return this.$notitle();
};
/**
* @memberof Document
*/
Document.$$proto.getNoheader = function () {
return this.$noheader();
};
/**
* @memberof Document
*/
Document.$$proto.getNofooter = function () {
return this.$nofooter();
};
/**
* @memberof Document
*/
Document.$$proto.hasHeader = function () {
return this['$header?']();
};
/**
* @memberof Document
*/
Document.$$proto.deleteAttribute = function (name) {
return this.$delete_attribute(name);
};
/**
* @memberof Document
*/
Document.$$proto.isAttributeLocked = function (name) {
return this['$attribute_locked?'](name);
};
/**
* @memberof Document
*/
Document.$$proto.parse = function (data) {
return this.$parse(data);
};
/**
* @memberof Document
*/
Document.$$proto.getDocinfo = function (docinfoLocation, suffix) {
return this.$docinfo(docinfoLocation, suffix);
};
/**
* @memberof Document
*/
Document.$$proto.hasDocinfoProcessors = function (docinfoLocation) {
return this['$docinfo_processors?'](docinfoLocation);
};
/**
* @memberof Document
*/
Document.$$proto.counterIncrement = function (counterName, block) {
return this.$counter_increment(counterName, block);
};
/**
* @memberof Document
*/
Document.$$proto.counter = function (name, seed) {
return this.$counter(name, seed);
};
/**
* @memberof Document
*/
Document.$$proto.getSafe = function () {
return this.safe;
};
/**
* @memberof Document
*/
Document.$$proto.getCompatMode = function () {
return this.compat_mode;
};
/**
* @memberof Document
*/
Document.$$proto.getSourcemap = function () {
return this.sourcemap;
};
/**
* @memberof Document
*/
Document.$$proto.getCounters = function () {
return fromHash(this.counters);
};
/**
* @memberof Document
*/
Document.$$proto.getCallouts = function () {
return this.$callouts();
};
/**
* @memberof Document
*/
Document.$$proto.getBaseDir = function () {
return this.base_dir;
};
/**
* @memberof Document
*/
Document.$$proto.getOptions = function () {
return fromHash(this.options);
};
/**
* @memberof Document
*/
Document.$$proto.getOutfilesuffix = function () {
return this.outfilesuffix;
};
/**
* @memberof Document
*/
Document.$$proto.getParentDocument = function () {
return this.parent_document;
};