asciidoctor-pdf 1.6.1 → 2.0.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/CHANGELOG.adoc +273 -31
- data/NOTICE.adoc +16 -4
- data/README.adoc +208 -68
- data/asciidoctor-pdf.gemspec +3 -7
- data/data/fonts/ABOUT-mplus1mn-subset +1 -1
- data/data/fonts/ABOUT-mplus1p-subset +2 -2
- data/data/fonts/ABOUT-notosans-subset +26 -0
- data/data/fonts/ABOUT-notoserif-subset +1 -1
- data/data/fonts/{LICENSE-notoserif → LICENSE-noto} +0 -0
- data/data/fonts/mplus1mn-bold-subset.ttf +0 -0
- data/data/fonts/mplus1mn-bold_italic-subset.ttf +0 -0
- data/data/fonts/mplus1mn-italic-subset.ttf +0 -0
- data/data/fonts/mplus1mn-regular-subset.ttf +0 -0
- data/data/fonts/mplus1p-regular-fallback.ttf +0 -0
- data/data/fonts/notoemoji-subset.ttf +0 -0
- data/data/fonts/notosans-bold-subset.ttf +0 -0
- data/data/fonts/notosans-bold_italic-subset.ttf +0 -0
- data/data/fonts/notosans-italic-subset.ttf +0 -0
- data/data/fonts/notosans-regular-subset.ttf +0 -0
- data/data/fonts/notoserif-bold-subset.ttf +0 -0
- data/data/fonts/notoserif-bold_italic-subset.ttf +0 -0
- data/data/fonts/notoserif-italic-subset.ttf +0 -0
- data/data/fonts/notoserif-regular-subset.ttf +0 -0
- data/data/themes/base-theme.yml +21 -24
- data/data/themes/default-for-print-theme.yml +24 -0
- data/data/themes/default-for-print-with-fallback-font-theme.yml +3 -0
- data/data/themes/default-theme.yml +55 -59
- data/data/themes/default-with-fallback-font-theme.yml +2 -2
- data/data/themes/sans-with-fallback-font-theme.yml +10 -0
- data/docs/theming-guide.adoc +977 -352
- data/lib/asciidoctor/pdf/converter.rb +1853 -1566
- data/lib/asciidoctor/pdf/ext/asciidoctor/document.rb +22 -1
- data/lib/asciidoctor/pdf/ext/asciidoctor/image.rb +9 -15
- data/lib/asciidoctor/pdf/ext/asciidoctor/list.rb +6 -13
- data/lib/asciidoctor/pdf/ext/asciidoctor/section.rb +3 -16
- data/lib/asciidoctor/pdf/ext/asciidoctor.rb +1 -5
- data/lib/asciidoctor/pdf/ext/core/file.rb +1 -1
- data/lib/asciidoctor/pdf/ext/core/quantifiable_stdout.rb +1 -4
- data/lib/asciidoctor/pdf/ext/core/string.rb +2 -2
- data/lib/asciidoctor/pdf/ext/core.rb +1 -4
- data/lib/asciidoctor/pdf/ext/pdf-core/page.rb +8 -33
- data/lib/asciidoctor/pdf/ext/pdf-core.rb +0 -16
- data/lib/asciidoctor/pdf/ext/prawn/coderay_encoder.rb +5 -7
- data/lib/asciidoctor/pdf/ext/prawn/extensions.rb +489 -331
- data/lib/asciidoctor/pdf/ext/prawn/font/afm.rb +0 -4
- data/lib/asciidoctor/pdf/ext/prawn/font_metric_cache.rb +1 -1
- data/lib/asciidoctor/pdf/ext/prawn/formatted_text/arranger.rb +33 -3
- data/lib/asciidoctor/pdf/ext/prawn/formatted_text/box.rb +25 -14
- data/lib/asciidoctor/pdf/ext/prawn/formatted_text/fragment.rb +9 -3
- data/lib/asciidoctor/pdf/ext/prawn/formatted_text/protect_bottom_gutter.rb +13 -0
- data/lib/asciidoctor/pdf/ext/prawn/images.rb +20 -18
- data/lib/asciidoctor/pdf/ext/prawn-svg/loaders/data.rb +6 -0
- data/lib/asciidoctor/pdf/ext/prawn-svg/loaders/web.rb +22 -0
- data/lib/asciidoctor/pdf/ext/prawn-svg/url_loader.rb +13 -0
- data/lib/asciidoctor/pdf/ext/prawn-svg.rb +5 -2
- data/lib/asciidoctor/pdf/ext/prawn-table/cell/asciidoc.rb +76 -20
- data/lib/asciidoctor/pdf/ext/prawn-table/cell/text.rb +39 -1
- data/lib/asciidoctor/pdf/ext/prawn-table/cell.rb +21 -15
- data/lib/asciidoctor/pdf/ext/prawn-table.rb +1 -1
- data/lib/asciidoctor/pdf/ext/prawn.rb +1 -0
- data/lib/asciidoctor/pdf/ext/pygments.rb +2 -2
- data/lib/asciidoctor/pdf/ext/rouge/formatters/prawn.rb +17 -20
- data/lib/asciidoctor/pdf/ext/rouge/themes/asciidoctor_pdf_default.rb +1 -0
- data/lib/asciidoctor/pdf/ext/rouge.rb +0 -1
- data/lib/asciidoctor/pdf/formatted_text/formatter.rb +2 -2
- data/lib/asciidoctor/pdf/formatted_text/inline_destination_marker.rb +8 -10
- data/lib/asciidoctor/pdf/formatted_text/inline_image_arranger.rb +69 -78
- data/lib/asciidoctor/pdf/formatted_text/inline_image_renderer.rb +7 -10
- data/lib/asciidoctor/pdf/formatted_text/inline_text_aligner.rb +2 -4
- data/lib/asciidoctor/pdf/formatted_text/parser.rb +53 -47
- data/lib/asciidoctor/pdf/formatted_text/parser.treetop +5 -7
- data/lib/asciidoctor/pdf/formatted_text/source_wrap.rb +14 -14
- data/lib/asciidoctor/pdf/formatted_text/text_background_and_border_renderer.rb +4 -7
- data/lib/asciidoctor/pdf/formatted_text/transform.rb +122 -110
- data/lib/asciidoctor/pdf/formatted_text.rb +0 -1
- data/lib/asciidoctor/pdf/index_catalog.rb +7 -11
- data/lib/asciidoctor/pdf/nogmagick.rb +6 -0
- data/lib/asciidoctor/pdf/optimizer.rb +3 -5
- data/lib/asciidoctor/pdf/pdfmark.rb +16 -8
- data/lib/asciidoctor/pdf/roman_numeral.rb +4 -22
- data/lib/asciidoctor/pdf/sanitizer.rb +18 -13
- data/lib/asciidoctor/pdf/section_info_by_page.rb +24 -0
- data/lib/asciidoctor/pdf/theme_loader.rb +100 -80
- data/lib/asciidoctor/pdf/version.rb +1 -2
- data/lib/asciidoctor/pdf.rb +5 -2
- metadata +36 -64
- data/data/fonts/mplus1mn-bold-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-bold_italic-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-italic-ascii.ttf +0 -0
- data/data/fonts/mplus1mn-regular-ascii-conums.ttf +0 -0
- data/lib/asciidoctor/pdf/ext/asciidoctor/abstract_block.rb +0 -7
- data/lib/asciidoctor/pdf/ext/asciidoctor/abstract_node.rb +0 -7
- data/lib/asciidoctor/pdf/ext/asciidoctor/list_item.rb +0 -18
- data/lib/asciidoctor/pdf/ext/asciidoctor/logging_shim.rb +0 -33
- data/lib/asciidoctor/pdf/ext/core/array.rb +0 -11
- data/lib/asciidoctor/pdf/ext/core/hash.rb +0 -7
- data/lib/asciidoctor/pdf/ext/core/regexp.rb +0 -5
- data/lib/asciidoctor/pdf/ext/pdf-core/pdf_object.rb +0 -8
- data/lib/asciidoctor-pdf/converter.rb +0 -3
- data/lib/asciidoctor-pdf/version.rb +0 -3
@@ -99,7 +99,7 @@ module Markup
|
|
99
99
|
end
|
100
100
|
|
101
101
|
module Element1
|
102
|
-
# NOTE content only applies to non-void elements (second part of rule)
|
102
|
+
# NOTE: content only applies to non-void elements (second part of rule)
|
103
103
|
def content
|
104
104
|
{ type: :element, name: (tag_element = elements[0]).name.to_sym, attributes: tag_element.attributes, pcdata: elements[1].content }
|
105
105
|
end
|
@@ -191,7 +191,7 @@ module Markup
|
|
191
191
|
r1 = true
|
192
192
|
@index += match_len
|
193
193
|
else
|
194
|
-
terminal_parse_failure('
|
194
|
+
terminal_parse_failure('\'<\'')
|
195
195
|
r1 = nil
|
196
196
|
end
|
197
197
|
s0 << r1
|
@@ -215,7 +215,7 @@ module Markup
|
|
215
215
|
r8 = true
|
216
216
|
@index += match_len
|
217
217
|
else
|
218
|
-
terminal_parse_failure('
|
218
|
+
terminal_parse_failure('\'/\'')
|
219
219
|
r8 = nil
|
220
220
|
end
|
221
221
|
s5 << r8
|
@@ -238,7 +238,7 @@ module Markup
|
|
238
238
|
r9 = true
|
239
239
|
@index += match_len
|
240
240
|
else
|
241
|
-
terminal_parse_failure('
|
241
|
+
terminal_parse_failure('\'>\'')
|
242
242
|
r9 = nil
|
243
243
|
end
|
244
244
|
s0 << r9
|
@@ -297,7 +297,7 @@ module Markup
|
|
297
297
|
r1 = true
|
298
298
|
@index += match_len
|
299
299
|
else
|
300
|
-
terminal_parse_failure('
|
300
|
+
terminal_parse_failure('\'<\'')
|
301
301
|
r1 = nil
|
302
302
|
end
|
303
303
|
s0 << r1
|
@@ -312,7 +312,7 @@ module Markup
|
|
312
312
|
r4 = true
|
313
313
|
@index += match_len
|
314
314
|
else
|
315
|
-
terminal_parse_failure('
|
315
|
+
terminal_parse_failure('\'>\'')
|
316
316
|
r4 = nil
|
317
317
|
end
|
318
318
|
s0 << r4
|
@@ -349,7 +349,7 @@ module Markup
|
|
349
349
|
r1 = true
|
350
350
|
@index += match_len
|
351
351
|
else
|
352
|
-
terminal_parse_failure('a')
|
352
|
+
terminal_parse_failure('\'a\'')
|
353
353
|
r1 = nil
|
354
354
|
end
|
355
355
|
if r1
|
@@ -360,7 +360,7 @@ module Markup
|
|
360
360
|
r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
361
361
|
@index += match_len
|
362
362
|
else
|
363
|
-
terminal_parse_failure('strong')
|
363
|
+
terminal_parse_failure('\'strong\'')
|
364
364
|
r2 = nil
|
365
365
|
end
|
366
366
|
if r2
|
@@ -371,7 +371,7 @@ module Markup
|
|
371
371
|
r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
372
372
|
@index += match_len
|
373
373
|
else
|
374
|
-
terminal_parse_failure('em')
|
374
|
+
terminal_parse_failure('\'em\'')
|
375
375
|
r3 = nil
|
376
376
|
end
|
377
377
|
if r3
|
@@ -382,95 +382,95 @@ module Markup
|
|
382
382
|
r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
383
383
|
@index += match_len
|
384
384
|
else
|
385
|
-
terminal_parse_failure('code')
|
385
|
+
terminal_parse_failure('\'code\'')
|
386
386
|
r4 = nil
|
387
387
|
end
|
388
388
|
if r4
|
389
389
|
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
390
390
|
r0 = r4
|
391
391
|
else
|
392
|
-
if (match_len = has_terminal?('
|
392
|
+
if (match_len = has_terminal?('font', false, index))
|
393
393
|
r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
394
394
|
@index += match_len
|
395
395
|
else
|
396
|
-
terminal_parse_failure('
|
396
|
+
terminal_parse_failure('\'font\'')
|
397
397
|
r5 = nil
|
398
398
|
end
|
399
399
|
if r5
|
400
400
|
r5 = SyntaxNode.new(input, (index-1)...index) if r5 == true
|
401
401
|
r0 = r5
|
402
402
|
else
|
403
|
-
if (match_len = has_terminal?('
|
403
|
+
if (match_len = has_terminal?('span', false, index))
|
404
404
|
r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
405
405
|
@index += match_len
|
406
406
|
else
|
407
|
-
terminal_parse_failure('
|
407
|
+
terminal_parse_failure('\'span\'')
|
408
408
|
r6 = nil
|
409
409
|
end
|
410
410
|
if r6
|
411
411
|
r6 = SyntaxNode.new(input, (index-1)...index) if r6 == true
|
412
412
|
r0 = r6
|
413
413
|
else
|
414
|
-
if (match_len = has_terminal?('
|
414
|
+
if (match_len = has_terminal?('button', false, index))
|
415
415
|
r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
416
416
|
@index += match_len
|
417
417
|
else
|
418
|
-
terminal_parse_failure('
|
418
|
+
terminal_parse_failure('\'button\'')
|
419
419
|
r7 = nil
|
420
420
|
end
|
421
421
|
if r7
|
422
422
|
r7 = SyntaxNode.new(input, (index-1)...index) if r7 == true
|
423
423
|
r0 = r7
|
424
424
|
else
|
425
|
-
if (match_len = has_terminal?('
|
425
|
+
if (match_len = has_terminal?('kbd', false, index))
|
426
426
|
r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
427
427
|
@index += match_len
|
428
428
|
else
|
429
|
-
terminal_parse_failure('
|
429
|
+
terminal_parse_failure('\'kbd\'')
|
430
430
|
r8 = nil
|
431
431
|
end
|
432
432
|
if r8
|
433
433
|
r8 = SyntaxNode.new(input, (index-1)...index) if r8 == true
|
434
434
|
r0 = r8
|
435
435
|
else
|
436
|
-
if (match_len = has_terminal?('
|
436
|
+
if (match_len = has_terminal?('sup', false, index))
|
437
437
|
r9 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
438
438
|
@index += match_len
|
439
439
|
else
|
440
|
-
terminal_parse_failure('
|
440
|
+
terminal_parse_failure('\'sup\'')
|
441
441
|
r9 = nil
|
442
442
|
end
|
443
443
|
if r9
|
444
444
|
r9 = SyntaxNode.new(input, (index-1)...index) if r9 == true
|
445
445
|
r0 = r9
|
446
446
|
else
|
447
|
-
if (match_len = has_terminal?('
|
447
|
+
if (match_len = has_terminal?('sub', false, index))
|
448
448
|
r10 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
449
449
|
@index += match_len
|
450
450
|
else
|
451
|
-
terminal_parse_failure('
|
451
|
+
terminal_parse_failure('\'sub\'')
|
452
452
|
r10 = nil
|
453
453
|
end
|
454
454
|
if r10
|
455
455
|
r10 = SyntaxNode.new(input, (index-1)...index) if r10 == true
|
456
456
|
r0 = r10
|
457
457
|
else
|
458
|
-
if (match_len = has_terminal?('
|
458
|
+
if (match_len = has_terminal?('mark', false, index))
|
459
459
|
r11 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
460
460
|
@index += match_len
|
461
461
|
else
|
462
|
-
terminal_parse_failure('
|
462
|
+
terminal_parse_failure('\'mark\'')
|
463
463
|
r11 = nil
|
464
464
|
end
|
465
465
|
if r11
|
466
466
|
r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
|
467
467
|
r0 = r11
|
468
468
|
else
|
469
|
-
if (match_len = has_terminal?('
|
469
|
+
if (match_len = has_terminal?('menu', false, index))
|
470
470
|
r12 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
471
471
|
@index += match_len
|
472
472
|
else
|
473
|
-
terminal_parse_failure('
|
473
|
+
terminal_parse_failure('\'menu\'')
|
474
474
|
r12 = nil
|
475
475
|
end
|
476
476
|
if r12
|
@@ -481,7 +481,7 @@ module Markup
|
|
481
481
|
r13 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
482
482
|
@index += match_len
|
483
483
|
else
|
484
|
-
terminal_parse_failure('del')
|
484
|
+
terminal_parse_failure('\'del\'')
|
485
485
|
r13 = nil
|
486
486
|
end
|
487
487
|
if r13
|
@@ -525,7 +525,7 @@ module Markup
|
|
525
525
|
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
526
526
|
@index += match_len
|
527
527
|
else
|
528
|
-
terminal_parse_failure('br')
|
528
|
+
terminal_parse_failure('\'br\'')
|
529
529
|
r1 = nil
|
530
530
|
end
|
531
531
|
if r1
|
@@ -536,7 +536,7 @@ module Markup
|
|
536
536
|
r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
537
537
|
@index += match_len
|
538
538
|
else
|
539
|
-
terminal_parse_failure('img')
|
539
|
+
terminal_parse_failure('\'img\'')
|
540
540
|
r2 = nil
|
541
541
|
end
|
542
542
|
if r2
|
@@ -647,7 +647,7 @@ module Markup
|
|
647
647
|
r4 = true
|
648
648
|
@index += match_len
|
649
649
|
else
|
650
|
-
terminal_parse_failure('
|
650
|
+
terminal_parse_failure('\'=\'')
|
651
651
|
r4 = nil
|
652
652
|
end
|
653
653
|
s0 << r4
|
@@ -656,7 +656,7 @@ module Markup
|
|
656
656
|
r5 = true
|
657
657
|
@index += match_len
|
658
658
|
else
|
659
|
-
terminal_parse_failure('"')
|
659
|
+
terminal_parse_failure('\'"\'')
|
660
660
|
r5 = nil
|
661
661
|
end
|
662
662
|
s0 << r5
|
@@ -683,7 +683,7 @@ module Markup
|
|
683
683
|
r8 = true
|
684
684
|
@index += match_len
|
685
685
|
else
|
686
|
-
terminal_parse_failure('"')
|
686
|
+
terminal_parse_failure('\'"\'')
|
687
687
|
r8 = nil
|
688
688
|
end
|
689
689
|
s0 << r8
|
@@ -735,7 +735,7 @@ module Markup
|
|
735
735
|
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
736
736
|
@index += match_len
|
737
737
|
else
|
738
|
-
terminal_parse_failure('
|
738
|
+
terminal_parse_failure('\'</\'')
|
739
739
|
r1 = nil
|
740
740
|
end
|
741
741
|
s0 << r1
|
@@ -747,7 +747,7 @@ module Markup
|
|
747
747
|
r3 = true
|
748
748
|
@index += match_len
|
749
749
|
else
|
750
|
-
terminal_parse_failure('
|
750
|
+
terminal_parse_failure('\'>\'')
|
751
751
|
r3 = nil
|
752
752
|
end
|
753
753
|
s0 << r3
|
@@ -855,7 +855,7 @@ module Markup
|
|
855
855
|
r1 = true
|
856
856
|
@index += match_len
|
857
857
|
else
|
858
|
-
terminal_parse_failure('
|
858
|
+
terminal_parse_failure('\'&\'')
|
859
859
|
r1 = nil
|
860
860
|
end
|
861
861
|
s0 << r1
|
@@ -866,7 +866,7 @@ module Markup
|
|
866
866
|
r4 = true
|
867
867
|
@index += match_len
|
868
868
|
else
|
869
|
-
terminal_parse_failure('
|
869
|
+
terminal_parse_failure('\'#\'')
|
870
870
|
r4 = nil
|
871
871
|
end
|
872
872
|
s3 << r4
|
@@ -890,7 +890,7 @@ module Markup
|
|
890
890
|
r7 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
891
891
|
@index += match_len
|
892
892
|
else
|
893
|
-
terminal_parse_failure('#x')
|
893
|
+
terminal_parse_failure('\'#x\'')
|
894
894
|
r7 = nil
|
895
895
|
end
|
896
896
|
s6 << r7
|
@@ -925,7 +925,7 @@ module Markup
|
|
925
925
|
r10 = true
|
926
926
|
@index += match_len
|
927
927
|
else
|
928
|
-
terminal_parse_failure('
|
928
|
+
terminal_parse_failure('\';\'')
|
929
929
|
r10 = nil
|
930
930
|
end
|
931
931
|
s0 << r10
|
@@ -978,6 +978,9 @@ module Markup
|
|
978
978
|
@index = i0
|
979
979
|
r0 = nil
|
980
980
|
else
|
981
|
+
if s0.size < 6
|
982
|
+
@terminal_failures.pop
|
983
|
+
end
|
981
984
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
982
985
|
end
|
983
986
|
|
@@ -999,11 +1002,11 @@ module Markup
|
|
999
1002
|
|
1000
1003
|
s0, i0 = [], index
|
1001
1004
|
loop do
|
1002
|
-
if has_terminal?(@regexps[gr = '\A[0-9a-
|
1005
|
+
if has_terminal?(@regexps[gr = '\A[0-9a-fA-F]'] ||= Regexp.new(gr), :regexp, index)
|
1003
1006
|
r1 = true
|
1004
1007
|
@index += 1
|
1005
1008
|
else
|
1006
|
-
terminal_parse_failure('[0-9a-
|
1009
|
+
terminal_parse_failure('[0-9a-fA-F]')
|
1007
1010
|
r1 = nil
|
1008
1011
|
end
|
1009
1012
|
if r1
|
@@ -1019,6 +1022,9 @@ module Markup
|
|
1019
1022
|
@index = i0
|
1020
1023
|
r0 = nil
|
1021
1024
|
else
|
1025
|
+
if s0.size < 5
|
1026
|
+
@terminal_failures.pop
|
1027
|
+
end
|
1022
1028
|
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
1023
1029
|
end
|
1024
1030
|
|
@@ -1043,7 +1049,7 @@ module Markup
|
|
1043
1049
|
r1 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1044
1050
|
@index += match_len
|
1045
1051
|
else
|
1046
|
-
terminal_parse_failure('amp')
|
1052
|
+
terminal_parse_failure('\'amp\'')
|
1047
1053
|
r1 = nil
|
1048
1054
|
end
|
1049
1055
|
if r1
|
@@ -1054,7 +1060,7 @@ module Markup
|
|
1054
1060
|
r2 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1055
1061
|
@index += match_len
|
1056
1062
|
else
|
1057
|
-
terminal_parse_failure('apos')
|
1063
|
+
terminal_parse_failure('\'apos\'')
|
1058
1064
|
r2 = nil
|
1059
1065
|
end
|
1060
1066
|
if r2
|
@@ -1065,7 +1071,7 @@ module Markup
|
|
1065
1071
|
r3 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1066
1072
|
@index += match_len
|
1067
1073
|
else
|
1068
|
-
terminal_parse_failure('gt')
|
1074
|
+
terminal_parse_failure('\'gt\'')
|
1069
1075
|
r3 = nil
|
1070
1076
|
end
|
1071
1077
|
if r3
|
@@ -1076,7 +1082,7 @@ module Markup
|
|
1076
1082
|
r4 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1077
1083
|
@index += match_len
|
1078
1084
|
else
|
1079
|
-
terminal_parse_failure('lt')
|
1085
|
+
terminal_parse_failure('\'lt\'')
|
1080
1086
|
r4 = nil
|
1081
1087
|
end
|
1082
1088
|
if r4
|
@@ -1087,7 +1093,7 @@ module Markup
|
|
1087
1093
|
r5 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1088
1094
|
@index += match_len
|
1089
1095
|
else
|
1090
|
-
terminal_parse_failure('nbsp')
|
1096
|
+
terminal_parse_failure('\'nbsp\'')
|
1091
1097
|
r5 = nil
|
1092
1098
|
end
|
1093
1099
|
if r5
|
@@ -1098,7 +1104,7 @@ module Markup
|
|
1098
1104
|
r6 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
1099
1105
|
@index += match_len
|
1100
1106
|
else
|
1101
|
-
terminal_parse_failure('quot')
|
1107
|
+
terminal_parse_failure('\'quot\'')
|
1102
1108
|
r6 = nil
|
1103
1109
|
end
|
1104
1110
|
if r6
|
@@ -1136,7 +1142,7 @@ module Markup
|
|
1136
1142
|
r1 = true
|
1137
1143
|
@index += match_len
|
1138
1144
|
else
|
1139
|
-
terminal_parse_failure(' ')
|
1145
|
+
terminal_parse_failure('\' \'')
|
1140
1146
|
r1 = nil
|
1141
1147
|
end
|
1142
1148
|
if r1
|
@@ -20,7 +20,7 @@ grammar Markup
|
|
20
20
|
# void_element / start_tag complex end_tag &{|seq| seq[0].name == seq[2].name } {
|
21
21
|
|
22
22
|
void_element / start_tag complex end_tag {
|
23
|
-
# NOTE content only applies to non-void elements (second part of rule)
|
23
|
+
# NOTE: content only applies to non-void elements (second part of rule)
|
24
24
|
def content
|
25
25
|
{ type: :element, name: (tag_element = elements[0]).name.to_sym, attributes: tag_element.attributes, pcdata: elements[1].content }
|
26
26
|
end
|
@@ -48,9 +48,9 @@ grammar Markup
|
|
48
48
|
end
|
49
49
|
|
50
50
|
rule tag_name
|
51
|
-
# QUESTION faster to do regex?
|
52
|
-
# QUESTION what about supporting hr?
|
53
|
-
'a' / 'strong' / 'em' / 'code' / '
|
51
|
+
# QUESTION: faster to do regex?
|
52
|
+
# QUESTION: what about supporting hr?
|
53
|
+
'a' / 'strong' / 'em' / 'code' / 'font' / 'span' / 'button' / 'kbd' / 'sup' / 'sub' / 'mark' / 'menu' / 'del'
|
54
54
|
end
|
55
55
|
|
56
56
|
rule void_tag_name
|
@@ -109,13 +109,11 @@ grammar Markup
|
|
109
109
|
end
|
110
110
|
|
111
111
|
rule character_decimal
|
112
|
-
# NOTE 6 decimals only supported in Asciidoctor 1.5.5 and up
|
113
112
|
[0-9] 2..6
|
114
113
|
end
|
115
114
|
|
116
115
|
rule character_hex
|
117
|
-
|
118
|
-
[0-9a-f] 2..5
|
116
|
+
[0-9a-fA-F] 2..5
|
119
117
|
end
|
120
118
|
|
121
119
|
rule character_name
|
@@ -6,23 +6,23 @@ module Asciidoctor
|
|
6
6
|
module SourceWrap
|
7
7
|
NoBreakSpace = ?\u00a0
|
8
8
|
|
9
|
+
# Override Prawn::Text::Formatted::Box#wrap method to add line numbers in source blocks.
|
10
|
+
# Note that this implementation assumes that the :single_line option is falsy.
|
9
11
|
def wrap array
|
12
|
+
return super unless array[0][:linenum] # sanity check
|
10
13
|
initialize_wrap array
|
11
|
-
stop = nil
|
12
|
-
highlight_line = nil
|
14
|
+
highlight_line = stop = nil
|
13
15
|
unconsumed = @arranger.unconsumed
|
14
|
-
if (linenum_fragment = unconsumed[0] || {})[:linenum]
|
15
|
-
linenum_spacer = { text: NoBreakSpace + (' ' * (linenum_fragment[:text].length - 1)) }
|
16
|
-
end
|
17
16
|
until stop
|
18
|
-
if
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
if (first_fragment = unconsumed[0])[:linenum]
|
18
|
+
linenum_text = first_fragment[:text]
|
19
|
+
linenum_spacer ||= { text: (NoBreakSpace.encode linenum_text.encoding) + (' ' * (linenum_text.length - 1)) }
|
20
|
+
highlight_line = (second_fragment = unconsumed[1])[:highlight] ? second_fragment.dup : nil
|
21
|
+
else
|
22
|
+
# NOTE: a wrapped line
|
23
|
+
first_fragment[:text] = first_fragment[:text].lstrip
|
24
|
+
@arranger.unconsumed.unshift highlight_line if highlight_line
|
25
|
+
@arranger.unconsumed.unshift linenum_spacer.dup
|
26
26
|
end
|
27
27
|
@line_wrap.wrap_line document: @document, kerning: @kerning, width: available_width, arranger: @arranger, disable_wrap_by_char: @disable_wrap_by_char
|
28
28
|
if enough_height_for_this_line?
|
@@ -31,7 +31,7 @@ module Asciidoctor
|
|
31
31
|
else
|
32
32
|
stop = true
|
33
33
|
end
|
34
|
-
stop ||= @
|
34
|
+
stop ||= @arranger.finished?
|
35
35
|
end
|
36
36
|
@text = @printed_lines.join ?\n
|
37
37
|
@everything_printed = @arranger.finished?
|
@@ -13,8 +13,9 @@ module Asciidoctor::PDF::FormattedText
|
|
13
13
|
if data[:inline_block]
|
14
14
|
padding = (height = fragment.line_height) - fragment.height
|
15
15
|
at = [fragment.left, fragment.top + padding * 0.5]
|
16
|
-
width = data[:extend] ? (pdf.bounds.width - fragment.left) : fragment.width
|
17
|
-
|
16
|
+
#width = data[:extend] ? (pdf.bounds.width - fragment.left) : fragment.width
|
17
|
+
width = pdf.bounds.width - fragment.left
|
18
|
+
fragment.conceal true # if fragment.text == DummyText
|
18
19
|
elsif (border_offset = data[:border_offset])
|
19
20
|
at = [fragment.left, fragment.top + border_offset]
|
20
21
|
width = fragment.width
|
@@ -41,11 +42,7 @@ module Asciidoctor::PDF::FormattedText
|
|
41
42
|
prev_line_width = pdf.line_width
|
42
43
|
pdf.stroke_color border_color
|
43
44
|
pdf.line_width border_width
|
44
|
-
|
45
|
-
pdf.stroke_rounded_rectangle at, width, height, border_radius
|
46
|
-
else
|
47
|
-
pdf.stroke_rectangle at, width, height
|
48
|
-
end
|
45
|
+
border_radius ? (pdf.stroke_rounded_rectangle at, width, height, border_radius) : (pdf.stroke_rectangle at, width, height)
|
49
46
|
pdf.stroke_color prev_stroke_color
|
50
47
|
pdf.line_width prev_line_width
|
51
48
|
end
|