latexpdf 0.4.8 → 0.4.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80543a4f0c87549c116be2e945255c75e3eaf85e
4
- data.tar.gz: cc2c90b750da73a7e32d982cc9f6d372754aa25f
3
+ metadata.gz: 875bfffe24681d989b512506119333cfb99e6098
4
+ data.tar.gz: e17d97f37cda7328a2ac3ba2c4d4972ae69bdc02
5
5
  SHA512:
6
- metadata.gz: d112964853f5c1d51955b680c5a5dc852a2847ccaa660b8f29154fe80292e70a635e2481ce7881e3d1a7629a2551beeb1d86dc28a1939d1617f6da7d9ae6787c
7
- data.tar.gz: 92f1aec26b7b1f8d5f97af520c3eedf2637eb2fe5b04b9cc2f09f4e94addb0d30fe008f2236ca53a542fabc5964adff6d42ebcb2194c56820fd5ef25c8774bfe
6
+ metadata.gz: 5052b01aa37e62269df74527c507148dddc296f56fb2cddf19ea62e8a45f91c455ff82b17a08dbc6f4e85d8aa107d1ab63985a93862c537b85fdbcf6cef696c4
7
+ data.tar.gz: 3d5a67f1f5dbf33bf15d1a89a6d5867f496182b403c2c22fedf877d6e396febaad36910530cfba031bd2c389d0c82c3c4448be9272b5c908040488046566ad90
@@ -10,8 +10,13 @@ module Latexpdf
10
10
  '>' => 'greater'
11
11
  }
12
12
 
13
- def remove_invalid_utf8(text)
14
- text.gsub("\u007F", "")
13
+ def tab_to_space(text)
14
+ text.gsub(/\x09/, " ")
15
+ end
16
+
17
+ def remove_non_printable_chars(text)
18
+ pattern = /([\x00-\x08\x0B-\x1F\x7F])/
19
+ text.gsub(pattern, "")
15
20
  end
16
21
 
17
22
  def tex_safe(text)
@@ -22,7 +27,8 @@ module Latexpdf
22
27
  "\\text#{ESC_MAP[m]}{}"
23
28
  end
24
29
  }
25
- text = remove_invalid_utf8(text)
30
+ text = tab_to_space(text)
31
+ text = remove_non_printable_chars(text)
26
32
  text.html_safe
27
33
  end
28
34
  end
@@ -1,3 +1,3 @@
1
1
  module Latexpdf
2
- VERSION = "0.4.8"
2
+ VERSION = "0.4.9"
3
3
  end
@@ -0,0 +1,12 @@
1
+ \documentclass{article}
2
+ \begin{document}
3
+ Test newlines and other non printable chars:
4
+
5
+ <%= tex_safe "tab:\tEND" %>
6
+
7
+ <%= tex_safe "cr:\rEND" %>
8
+
9
+ <%= tex_safe "newline:\nEND" %>
10
+
11
+ <%= tex_safe "form feed:\fEND" %>
12
+ \end{document}
@@ -287,3 +287,614 @@ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2016-10-24 15:52:40 +0200
287
287
  Processing by TexController#example2 as PDF
288
288
  Rendered tex/example2.pdf.tex (2051.5ms)
289
289
  Completed 200 OK in 2054ms (Views: 2053.3ms)
290
+ -------------------------------------------------------------
291
+ ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
292
+ -------------------------------------------------------------
293
+ -----------------------------------------------------------
294
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
295
+ -----------------------------------------------------------
296
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:35:06 +0100
297
+ Processing by TexController#example as PDF
298
+ Rendered tex/example.pdf.tex (3061.7ms)
299
+ Completed 200 OK in 3077ms (Views: 3076.3ms)
300
+ ---------------------------------------------------------
301
+ RenderingTest: test_Generate_PDF_using_escaped_characters
302
+ ---------------------------------------------------------
303
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:35:09 +0100
304
+ Processing by TexController#example2 as PDF
305
+ Rendered tex/example2.pdf.tex (3047.4ms)
306
+ Completed 200 OK in 3050ms (Views: 3049.9ms)
307
+ ---------------------------------------------------------
308
+ RenderingTest: test_Generate_PDF_using_escaped_characters
309
+ ---------------------------------------------------------
310
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:38:57 +0100
311
+ Processing by TexController#example2 as PDF
312
+ Rendered tex/example2.pdf.tex (2018.5ms)
313
+ Completed 200 OK in 2033ms (Views: 2032.7ms)
314
+ -----------------------------------------------------------
315
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
316
+ -----------------------------------------------------------
317
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:38:59 +0100
318
+ Processing by TexController#example as PDF
319
+ Rendered tex/example.pdf.tex (1800.8ms)
320
+ Completed 200 OK in 1804ms (Views: 1803.4ms)
321
+ ---------------------------------------------------------------
322
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
323
+ ---------------------------------------------------------------
324
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:39:01 +0100
325
+ Processing by TexController#example3 as PDF
326
+ Rendered tex/example3.pdf.tex (1819.2ms)
327
+ Completed 200 OK in 1834ms (Views: 1833.6ms)
328
+ -----------------------------------------------------------
329
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
330
+ -----------------------------------------------------------
331
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:40:05 +0100
332
+ Processing by TexController#example as PDF
333
+ Rendered tex/example.pdf.tex (2031.0ms)
334
+ Completed 200 OK in 2042ms (Views: 2041.6ms)
335
+ ---------------------------------------------------------
336
+ RenderingTest: test_Generate_PDF_using_escaped_characters
337
+ ---------------------------------------------------------
338
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:40:07 +0100
339
+ Processing by TexController#example2 as PDF
340
+ Rendered tex/example2.pdf.tex (1776.0ms)
341
+ Completed 200 OK in 1779ms (Views: 1778.9ms)
342
+ ---------------------------------------------------------------
343
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
344
+ ---------------------------------------------------------------
345
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:40:09 +0100
346
+ Processing by TexController#example3 as PDF
347
+ Rendered tex/example3.pdf.tex (1810.9ms)
348
+ Completed 200 OK in 1814ms (Views: 1813.3ms)
349
+ ---------------------------------------------------------------
350
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
351
+ ---------------------------------------------------------------
352
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:40:40 +0100
353
+ Processing by TexController#example3 as PDF
354
+ Rendered tex/example3.pdf.tex (2248.9ms)
355
+ Completed 200 OK in 2268ms (Views: 2267.7ms)
356
+ ---------------------------------------------------------
357
+ RenderingTest: test_Generate_PDF_using_escaped_characters
358
+ ---------------------------------------------------------
359
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:40:43 +0100
360
+ Processing by TexController#example2 as PDF
361
+ Rendered tex/example2.pdf.tex (1958.9ms)
362
+ Completed 200 OK in 1962ms (Views: 1962.0ms)
363
+ -----------------------------------------------------------
364
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
365
+ -----------------------------------------------------------
366
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:40:45 +0100
367
+ Processing by TexController#example as PDF
368
+ Rendered tex/example.pdf.tex (1827.0ms)
369
+ Completed 200 OK in 1830ms (Views: 1829.8ms)
370
+ -----------------------------------------------------------
371
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
372
+ -----------------------------------------------------------
373
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:40:57 +0100
374
+ Processing by TexController#example as PDF
375
+ Rendered tex/example.pdf.tex (1850.0ms)
376
+ Completed 200 OK in 1864ms (Views: 1863.2ms)
377
+ ---------------------------------------------------------
378
+ RenderingTest: test_Generate_PDF_using_escaped_characters
379
+ ---------------------------------------------------------
380
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:40:59 +0100
381
+ Processing by TexController#example2 as PDF
382
+ Rendered tex/example2.pdf.tex (1809.5ms)
383
+ Completed 200 OK in 1813ms (Views: 1812.2ms)
384
+ ---------------------------------------------------------------
385
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
386
+ ---------------------------------------------------------------
387
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:41:01 +0100
388
+ Processing by TexController#example3 as PDF
389
+ Rendered tex/example3.pdf.tex (1749.0ms)
390
+ Completed 200 OK in 1753ms (Views: 1752.7ms)
391
+ ---------------------------------------------------------
392
+ RenderingTest: test_Generate_PDF_using_escaped_characters
393
+ ---------------------------------------------------------
394
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:41:13 +0100
395
+ Processing by TexController#example2 as PDF
396
+ Rendered tex/example2.pdf.tex (2017.7ms)
397
+ Completed 200 OK in 2095ms (Views: 2094.6ms)
398
+ -----------------------------------------------------------
399
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
400
+ -----------------------------------------------------------
401
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:41:15 +0100
402
+ Processing by TexController#example as PDF
403
+ Rendered tex/example.pdf.tex (1832.7ms)
404
+ Completed 200 OK in 1836ms (Views: 1835.4ms)
405
+ ---------------------------------------------------------------
406
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
407
+ ---------------------------------------------------------------
408
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:41:17 +0100
409
+ Processing by TexController#example3 as PDF
410
+ Rendered tex/example3.pdf.tex (1954.3ms)
411
+ Completed 200 OK in 1960ms (Views: 1959.8ms)
412
+ ---------------------------------------------------------
413
+ RenderingTest: test_Generate_PDF_using_escaped_characters
414
+ ---------------------------------------------------------
415
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:41:26 +0100
416
+ Processing by TexController#example2 as PDF
417
+ Rendered tex/example2.pdf.tex (1843.5ms)
418
+ Completed 200 OK in 1858ms (Views: 1857.8ms)
419
+ ---------------------------------------------------------------
420
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
421
+ ---------------------------------------------------------------
422
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:41:28 +0100
423
+ Processing by TexController#example3 as PDF
424
+ Rendered tex/example3.pdf.tex (1791.2ms)
425
+ Completed 200 OK in 1794ms (Views: 1793.5ms)
426
+ -----------------------------------------------------------
427
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
428
+ -----------------------------------------------------------
429
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:41:30 +0100
430
+ Processing by TexController#example as PDF
431
+ Rendered tex/example.pdf.tex (1810.7ms)
432
+ Completed 200 OK in 1814ms (Views: 1813.1ms)
433
+ ---------------------------------------------------------------
434
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
435
+ ---------------------------------------------------------------
436
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:42:03 +0100
437
+ Processing by TexController#example3 as PDF
438
+ Rendered tex/example3.pdf.tex (2037.4ms)
439
+ Completed 200 OK in 2049ms (Views: 2049.0ms)
440
+ ---------------------------------------------------------
441
+ RenderingTest: test_Generate_PDF_using_escaped_characters
442
+ ---------------------------------------------------------
443
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:42:06 +0100
444
+ Processing by TexController#example2 as PDF
445
+ Rendered tex/example2.pdf.tex (1838.1ms)
446
+ Completed 200 OK in 1841ms (Views: 1840.7ms)
447
+ -----------------------------------------------------------
448
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
449
+ -----------------------------------------------------------
450
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:42:07 +0100
451
+ Processing by TexController#example as PDF
452
+ Rendered tex/example.pdf.tex (1775.3ms)
453
+ Completed 200 OK in 1778ms (Views: 1778.0ms)
454
+ ---------------------------------------------------------------
455
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
456
+ ---------------------------------------------------------------
457
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:42:49 +0100
458
+ Processing by TexController#example3 as PDF
459
+ Rendered tex/example3.pdf.tex (2126.1ms)
460
+ Completed 200 OK in 2139ms (Views: 2139.0ms)
461
+ ---------------------------------------------------------
462
+ RenderingTest: test_Generate_PDF_using_escaped_characters
463
+ ---------------------------------------------------------
464
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:42:51 +0100
465
+ Processing by TexController#example2 as PDF
466
+ Rendered tex/example2.pdf.tex (1823.0ms)
467
+ Completed 200 OK in 1826ms (Views: 1826.1ms)
468
+ -----------------------------------------------------------
469
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
470
+ -----------------------------------------------------------
471
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:42:53 +0100
472
+ Processing by TexController#example as PDF
473
+ Rendered tex/example.pdf.tex (1816.1ms)
474
+ Completed 200 OK in 1820ms (Views: 1819.5ms)
475
+ -----------------------------------------------------------
476
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
477
+ -----------------------------------------------------------
478
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:43:06 +0100
479
+ Processing by TexController#example as PDF
480
+ Rendered tex/example.pdf.tex (2027.1ms)
481
+ Completed 200 OK in 2041ms (Views: 2040.1ms)
482
+ ---------------------------------------------------------
483
+ RenderingTest: test_Generate_PDF_using_escaped_characters
484
+ ---------------------------------------------------------
485
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:43:08 +0100
486
+ Processing by TexController#example2 as PDF
487
+ Rendered tex/example2.pdf.tex (1877.0ms)
488
+ Completed 200 OK in 1886ms (Views: 1885.4ms)
489
+ ---------------------------------------------------------------
490
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
491
+ ---------------------------------------------------------------
492
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:43:10 +0100
493
+ Processing by TexController#example3 as PDF
494
+ Rendered tex/example3.pdf.tex (2007.4ms)
495
+ Completed 200 OK in 2012ms (Views: 2011.7ms)
496
+ -----------------------------------------------------------
497
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
498
+ -----------------------------------------------------------
499
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:43:17 +0100
500
+ Processing by TexController#example as PDF
501
+ Rendered tex/example.pdf.tex (1847.0ms)
502
+ Completed 200 OK in 1859ms (Views: 1858.7ms)
503
+ ---------------------------------------------------------------
504
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
505
+ ---------------------------------------------------------------
506
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:43:19 +0100
507
+ Processing by TexController#example3 as PDF
508
+ Rendered tex/example3.pdf.tex (1777.3ms)
509
+ Completed 200 OK in 1780ms (Views: 1779.5ms)
510
+ ---------------------------------------------------------
511
+ RenderingTest: test_Generate_PDF_using_escaped_characters
512
+ ---------------------------------------------------------
513
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:43:21 +0100
514
+ Processing by TexController#example2 as PDF
515
+ Rendered tex/example2.pdf.tex (1887.8ms)
516
+ Completed 200 OK in 1891ms (Views: 1890.5ms)
517
+ -----------------------------------------------------------
518
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
519
+ -----------------------------------------------------------
520
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:43:52 +0100
521
+ Processing by TexController#example as PDF
522
+ Rendered tex/example.pdf.tex (1998.8ms)
523
+ Completed 200 OK in 2012ms (Views: 2011.2ms)
524
+ ---------------------------------------------------------------
525
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
526
+ ---------------------------------------------------------------
527
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:43:54 +0100
528
+ Processing by TexController#example3 as PDF
529
+ Rendered tex/example3.pdf.tex (2093.2ms)
530
+ Completed 200 OK in 2096ms (Views: 2095.1ms)
531
+ ---------------------------------------------------------
532
+ RenderingTest: test_Generate_PDF_using_escaped_characters
533
+ ---------------------------------------------------------
534
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:43:56 +0100
535
+ Processing by TexController#example2 as PDF
536
+ Rendered tex/example2.pdf.tex (1759.0ms)
537
+ Completed 200 OK in 1762ms (Views: 1761.5ms)
538
+ -----------------------------------------------------------
539
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
540
+ -----------------------------------------------------------
541
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:44:47 +0100
542
+ Processing by TexController#example as PDF
543
+ Rendered tex/example.pdf.tex (2204.7ms)
544
+ Completed 200 OK in 2226ms (Views: 2226.0ms)
545
+ ---------------------------------------------------------------
546
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
547
+ ---------------------------------------------------------------
548
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:44:49 +0100
549
+ Processing by TexController#example3 as PDF
550
+ Rendered tex/example3.pdf.tex (1806.6ms)
551
+ Completed 200 OK in 1809ms (Views: 1808.8ms)
552
+ ---------------------------------------------------------
553
+ RenderingTest: test_Generate_PDF_using_escaped_characters
554
+ ---------------------------------------------------------
555
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:44:51 +0100
556
+ Processing by TexController#example2 as PDF
557
+ Rendered tex/example2.pdf.tex (1896.9ms)
558
+ Completed 200 OK in 1900ms (Views: 1899.7ms)
559
+ -----------------------------------------------------------
560
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
561
+ -----------------------------------------------------------
562
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:45:06 +0100
563
+ Processing by TexController#example as PDF
564
+ Rendered tex/example.pdf.tex (2537.0ms)
565
+ Completed 200 OK in 2549ms (Views: 2549.0ms)
566
+ ---------------------------------------------------------------
567
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
568
+ ---------------------------------------------------------------
569
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:45:09 +0100
570
+ Processing by TexController#example3 as PDF
571
+ Rendered tex/example3.pdf.tex (1916.7ms)
572
+ Completed 200 OK in 1919ms (Views: 1918.9ms)
573
+ ---------------------------------------------------------
574
+ RenderingTest: test_Generate_PDF_using_escaped_characters
575
+ ---------------------------------------------------------
576
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:45:11 +0100
577
+ Processing by TexController#example2 as PDF
578
+ Rendered tex/example2.pdf.tex (1805.5ms)
579
+ Completed 200 OK in 1809ms (Views: 1808.4ms)
580
+ ---------------------------------------------------------------
581
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
582
+ ---------------------------------------------------------------
583
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:45:30 +0100
584
+ Processing by TexController#example3 as PDF
585
+ Rendered tex/example3.pdf.tex (1818.9ms)
586
+ Completed 200 OK in 1835ms (Views: 1834.9ms)
587
+ ---------------------------------------------------------
588
+ RenderingTest: test_Generate_PDF_using_escaped_characters
589
+ ---------------------------------------------------------
590
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:45:32 +0100
591
+ Processing by TexController#example2 as PDF
592
+ Rendered tex/example2.pdf.tex (1776.5ms)
593
+ Completed 200 OK in 1779ms (Views: 1779.1ms)
594
+ -----------------------------------------------------------
595
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
596
+ -----------------------------------------------------------
597
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:45:34 +0100
598
+ Processing by TexController#example as PDF
599
+ Rendered tex/example.pdf.tex (1783.0ms)
600
+ Completed 200 OK in 1786ms (Views: 1785.4ms)
601
+ ---------------------------------------------------------------
602
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
603
+ ---------------------------------------------------------------
604
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:46:08 +0100
605
+ Processing by TexController#example3 as PDF
606
+ Rendered tex/example3.pdf.tex (2474.8ms)
607
+ Completed 200 OK in 2490ms (Views: 2489.2ms)
608
+ ---------------------------------------------------------
609
+ RenderingTest: test_Generate_PDF_using_escaped_characters
610
+ ---------------------------------------------------------
611
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:46:11 +0100
612
+ Processing by TexController#example2 as PDF
613
+ Rendered tex/example2.pdf.tex (1839.2ms)
614
+ Completed 200 OK in 1843ms (Views: 1842.2ms)
615
+ -----------------------------------------------------------
616
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
617
+ -----------------------------------------------------------
618
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:46:13 +0100
619
+ Processing by TexController#example as PDF
620
+ -----------------------------------------------------------
621
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
622
+ -----------------------------------------------------------
623
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:46:14 +0100
624
+ Processing by TexController#example as PDF
625
+ Rendered tex/example.pdf.tex (2461.9ms)
626
+ Completed 200 OK in 2465ms (Views: 2464.7ms)
627
+ Rendered tex/example.pdf.tex (2395.5ms)
628
+ Completed 200 OK in 2411ms (Views: 2410.1ms)
629
+ ---------------------------------------------------------
630
+ RenderingTest: test_Generate_PDF_using_escaped_characters
631
+ ---------------------------------------------------------
632
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:46:16 +0100
633
+ Processing by TexController#example2 as PDF
634
+ Rendered tex/example2.pdf.tex (1861.9ms)
635
+ Completed 200 OK in 1865ms (Views: 1864.7ms)
636
+ ---------------------------------------------------------------
637
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
638
+ ---------------------------------------------------------------
639
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:46:18 +0100
640
+ Processing by TexController#example3 as PDF
641
+ Rendered tex/example3.pdf.tex (1775.8ms)
642
+ Completed 200 OK in 1778ms (Views: 1778.1ms)
643
+ ---------------------------------------------------------------
644
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
645
+ ---------------------------------------------------------------
646
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:49:32 +0100
647
+ Processing by TexController#example3 as PDF
648
+ Rendered tex/example3.pdf.tex (2248.5ms)
649
+ Completed 200 OK in 2261ms (Views: 2260.5ms)
650
+ ---------------------------------------------------------
651
+ RenderingTest: test_Generate_PDF_using_escaped_characters
652
+ ---------------------------------------------------------
653
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:49:34 +0100
654
+ Processing by TexController#example2 as PDF
655
+ Rendered tex/example2.pdf.tex (1772.2ms)
656
+ Completed 200 OK in 1776ms (Views: 1775.4ms)
657
+ -----------------------------------------------------------
658
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
659
+ -----------------------------------------------------------
660
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:49:36 +0100
661
+ Processing by TexController#example as PDF
662
+ Rendered tex/example.pdf.tex (1779.9ms)
663
+ Completed 200 OK in 1783ms (Views: 1782.8ms)
664
+ ---------------------------------------------------------------
665
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
666
+ ---------------------------------------------------------------
667
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:49:52 +0100
668
+ Processing by TexController#example3 as PDF
669
+ Rendered tex/example3.pdf.tex (1942.2ms)
670
+ Completed 200 OK in 1966ms (Views: 1965.6ms)
671
+ ---------------------------------------------------------
672
+ RenderingTest: test_Generate_PDF_using_escaped_characters
673
+ ---------------------------------------------------------
674
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:49:54 +0100
675
+ Processing by TexController#example2 as PDF
676
+ Rendered tex/example2.pdf.tex (1822.9ms)
677
+ Completed 200 OK in 1826ms (Views: 1825.5ms)
678
+ -----------------------------------------------------------
679
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
680
+ -----------------------------------------------------------
681
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:49:56 +0100
682
+ Processing by TexController#example as PDF
683
+ Rendered tex/example.pdf.tex (1720.3ms)
684
+ Completed 200 OK in 1723ms (Views: 1722.9ms)
685
+ -----------------------------------------------------------
686
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
687
+ -----------------------------------------------------------
688
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-03 17:50:12 +0100
689
+ Processing by TexController#example as PDF
690
+ Rendered tex/example.pdf.tex (1954.7ms)
691
+ Completed 200 OK in 1972ms (Views: 1970.7ms)
692
+ ---------------------------------------------------------
693
+ RenderingTest: test_Generate_PDF_using_escaped_characters
694
+ ---------------------------------------------------------
695
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-03 17:50:14 +0100
696
+ Processing by TexController#example2 as PDF
697
+ Rendered tex/example2.pdf.tex (1816.5ms)
698
+ Completed 200 OK in 1821ms (Views: 1820.5ms)
699
+ ---------------------------------------------------------------
700
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
701
+ ---------------------------------------------------------------
702
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-03 17:50:16 +0100
703
+ Processing by TexController#example3 as PDF
704
+ Rendered tex/example3.pdf.tex (1726.5ms)
705
+ Completed 200 OK in 1729ms (Views: 1728.6ms)
706
+ -----------------------------------------------------------
707
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
708
+ -----------------------------------------------------------
709
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-04 11:31:01 +0100
710
+ Processing by TexController#example as PDF
711
+ Rendered tex/example.pdf.tex (2211.2ms)
712
+ Completed 200 OK in 2232ms (Views: 2231.2ms)
713
+ ---------------------------------------------------------
714
+ RenderingTest: test_Generate_PDF_using_escaped_characters
715
+ ---------------------------------------------------------
716
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-04 11:31:04 +0100
717
+ Processing by TexController#example2 as PDF
718
+ Rendered tex/example2.pdf.tex (1751.3ms)
719
+ Completed 200 OK in 1755ms (Views: 1755.2ms)
720
+ ---------------------------------------------------------------
721
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
722
+ ---------------------------------------------------------------
723
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-04 11:31:05 +0100
724
+ Processing by TexController#example3 as PDF
725
+ Rendered tex/example3.pdf.tex (1738.2ms)
726
+ Completed 200 OK in 1741ms (Views: 1741.1ms)
727
+ ---------------------------------------------------------------
728
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
729
+ ---------------------------------------------------------------
730
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-04 11:31:21 +0100
731
+ Processing by TexController#example3 as PDF
732
+ Rendered tex/example3.pdf.tex (2084.2ms)
733
+ Completed 200 OK in 2098ms (Views: 2096.8ms)
734
+ ---------------------------------------------------------
735
+ RenderingTest: test_Generate_PDF_using_escaped_characters
736
+ ---------------------------------------------------------
737
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-04 11:31:23 +0100
738
+ Processing by TexController#example2 as PDF
739
+ Rendered tex/example2.pdf.tex (2215.3ms)
740
+ Completed 200 OK in 2218ms (Views: 2218.0ms)
741
+ -----------------------------------------------------------
742
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
743
+ -----------------------------------------------------------
744
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-04 11:31:25 +0100
745
+ Processing by TexController#example as PDF
746
+ Rendered tex/example.pdf.tex (1830.9ms)
747
+ Completed 200 OK in 1835ms (Views: 1834.2ms)
748
+ -----------------------------------------------------------
749
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
750
+ -----------------------------------------------------------
751
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-04 11:31:41 +0100
752
+ Processing by TexController#example as PDF
753
+ Rendered tex/example.pdf.tex (2009.0ms)
754
+ Completed 200 OK in 2023ms (Views: 2022.5ms)
755
+ ---------------------------------------------------------
756
+ RenderingTest: test_Generate_PDF_using_escaped_characters
757
+ ---------------------------------------------------------
758
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-04 11:31:43 +0100
759
+ Processing by TexController#example2 as PDF
760
+ Rendered tex/example2.pdf.tex (1813.5ms)
761
+ Completed 200 OK in 1817ms (Views: 1816.2ms)
762
+ ---------------------------------------------------------------
763
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
764
+ ---------------------------------------------------------------
765
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-04 11:31:45 +0100
766
+ Processing by TexController#example3 as PDF
767
+ Rendered tex/example3.pdf.tex (1809.0ms)
768
+ Completed 200 OK in 1811ms (Views: 1810.9ms)
769
+ -----------------------------------------------------------
770
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
771
+ -----------------------------------------------------------
772
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-04 11:35:58 +0100
773
+ Processing by TexController#example as PDF
774
+ Rendered tex/example.pdf.tex (2117.8ms)
775
+ Completed 200 OK in 2136ms (Views: 2135.9ms)
776
+ ---------------------------------------------------------------
777
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
778
+ ---------------------------------------------------------------
779
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-04 11:36:01 +0100
780
+ Processing by TexController#example3 as PDF
781
+ Rendered tex/example3.pdf.tex (1773.2ms)
782
+ Completed 200 OK in 1776ms (Views: 1775.2ms)
783
+ ---------------------------------------------------------
784
+ RenderingTest: test_Generate_PDF_using_escaped_characters
785
+ ---------------------------------------------------------
786
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-04 11:36:02 +0100
787
+ Processing by TexController#example2 as PDF
788
+ Rendered tex/example2.pdf.tex (1843.9ms)
789
+ Completed 200 OK in 1847ms (Views: 1846.5ms)
790
+ ---------------------------------------------------------------
791
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
792
+ ---------------------------------------------------------------
793
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-04 11:36:34 +0100
794
+ Processing by TexController#example3 as PDF
795
+ Rendered tex/example3.pdf.tex (2166.1ms)
796
+ Completed 200 OK in 2178ms (Views: 2177.6ms)
797
+ -----------------------------------------------------------
798
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
799
+ -----------------------------------------------------------
800
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-04 11:36:36 +0100
801
+ Processing by TexController#example as PDF
802
+ Rendered tex/example.pdf.tex (1890.1ms)
803
+ Completed 200 OK in 1893ms (Views: 1892.7ms)
804
+ ---------------------------------------------------------
805
+ RenderingTest: test_Generate_PDF_using_escaped_characters
806
+ ---------------------------------------------------------
807
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-04 11:36:38 +0100
808
+ Processing by TexController#example2 as PDF
809
+ Rendered tex/example2.pdf.tex (1769.9ms)
810
+ Completed 200 OK in 1773ms (Views: 1772.3ms)
811
+ ---------------------------------------------------------------
812
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
813
+ ---------------------------------------------------------------
814
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-04 11:37:16 +0100
815
+ Processing by TexController#example3 as PDF
816
+ Rendered tex/example3.pdf.tex (2542.2ms)
817
+ Completed 200 OK in 2556ms (Views: 2555.9ms)
818
+ ---------------------------------------------------------
819
+ RenderingTest: test_Generate_PDF_using_escaped_characters
820
+ ---------------------------------------------------------
821
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-04 11:37:19 +0100
822
+ Processing by TexController#example2 as PDF
823
+ Rendered tex/example2.pdf.tex (2632.8ms)
824
+ Completed 200 OK in 2637ms (Views: 2636.4ms)
825
+ -----------------------------------------------------------
826
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
827
+ -----------------------------------------------------------
828
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-04 11:37:22 +0100
829
+ Processing by TexController#example as PDF
830
+ Rendered tex/example.pdf.tex (2538.8ms)
831
+ Completed 200 OK in 2542ms (Views: 2541.4ms)
832
+ -------------------------------------------------------------
833
+ ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
834
+ -------------------------------------------------------------
835
+ ---------------------------------------------------------------
836
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
837
+ ---------------------------------------------------------------
838
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-04 11:37:57 +0100
839
+ Processing by TexController#example3 as PDF
840
+ Rendered tex/example3.pdf.tex (2148.6ms)
841
+ Completed 200 OK in 2164ms (Views: 2163.7ms)
842
+ ---------------------------------------------------------
843
+ RenderingTest: test_Generate_PDF_using_escaped_characters
844
+ ---------------------------------------------------------
845
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-04 11:37:59 +0100
846
+ Processing by TexController#example2 as PDF
847
+ Rendered tex/example2.pdf.tex (2046.4ms)
848
+ Completed 200 OK in 2049ms (Views: 2048.9ms)
849
+ -----------------------------------------------------------
850
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
851
+ -----------------------------------------------------------
852
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-04 11:38:01 +0100
853
+ Processing by TexController#example as PDF
854
+ Rendered tex/example.pdf.tex (1827.2ms)
855
+ Completed 200 OK in 1831ms (Views: 1830.3ms)
856
+ -----------------------------------------------------------
857
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
858
+ -----------------------------------------------------------
859
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-04 11:38:20 +0100
860
+ Processing by TexController#example as PDF
861
+ Rendered tex/example.pdf.tex (1959.2ms)
862
+ Completed 200 OK in 1973ms (Views: 1972.9ms)
863
+ ---------------------------------------------------------
864
+ RenderingTest: test_Generate_PDF_using_escaped_characters
865
+ ---------------------------------------------------------
866
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-04 11:38:22 +0100
867
+ Processing by TexController#example2 as PDF
868
+ Rendered tex/example2.pdf.tex (1820.2ms)
869
+ Completed 200 OK in 1823ms (Views: 1822.7ms)
870
+ ---------------------------------------------------------------
871
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
872
+ ---------------------------------------------------------------
873
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-04 11:38:24 +0100
874
+ Processing by TexController#example3 as PDF
875
+ Rendered tex/example3.pdf.tex (1833.7ms)
876
+ Completed 200 OK in 1837ms (Views: 1836.4ms)
877
+ ---------------------------------------------------------------
878
+ RenderingTest: test_Generate_PDF_using_non_printable_characters
879
+ ---------------------------------------------------------------
880
+ Started GET "/tex/example3.pdf" for 127.0.0.1 at 2017-01-04 11:38:34 +0100
881
+ Processing by TexController#example3 as PDF
882
+ Rendered tex/example3.pdf.tex (4453.2ms)
883
+ Completed 200 OK in 4470ms (Views: 4469.9ms)
884
+ ---------------------------------------------------------
885
+ RenderingTest: test_Generate_PDF_using_escaped_characters
886
+ ---------------------------------------------------------
887
+ Started GET "/tex/example2.pdf" for 127.0.0.1 at 2017-01-04 11:38:38 +0100
888
+ Processing by TexController#example2 as PDF
889
+ Rendered tex/example2.pdf.tex (4404.9ms)
890
+ Completed 200 OK in 4409ms (Views: 4408.6ms)
891
+ -----------------------------------------------------------
892
+ RenderingTest: test_Generate_PDF_on_the_fly_in_a_controller
893
+ -----------------------------------------------------------
894
+ Started GET "/tex/example.pdf" for 127.0.0.1 at 2017-01-04 11:38:43 +0100
895
+ Processing by TexController#example as PDF
896
+ Rendered tex/example.pdf.tex (4288.7ms)
897
+ Completed 200 OK in 4291ms (Views: 4291.0ms)
898
+ -------------------------------------------------------------
899
+ ConfigTest: test_Build_path_is_Rails_temporary_dir_by_default
900
+ -------------------------------------------------------------
@@ -18,4 +18,15 @@ class RenderingTest < ActionDispatch::IntegrationTest
18
18
  assert_match (/\~ \^/), reader.pages.first.text
19
19
  # PDF reader does not parse the others correctly unfortunately
20
20
  end
21
+
22
+ test "Generate PDF using non printable characters" do
23
+ get "/tex/example3.pdf"
24
+ assert_match (/application\/pdf/), response.headers["Content-Type"]
25
+ reader = PDF::Reader.new(StringIO.new(response.body))
26
+ assert_equal 1, reader.pages.count
27
+ assert_match (/tab: END/), reader.pages.first.text
28
+ assert_match (/cr:END/), reader.pages.first.text
29
+ # PDF reader detects sometimes one, sometimes two newlines
30
+ assert_match (/form feed:END/), reader.pages.first.text
31
+ end
21
32
  end
@@ -39,9 +39,39 @@ module Latexpdf
39
39
  end
40
40
 
41
41
  # Although 007F is a valid UTF-8 char, xelatex does not like it
42
- # Since it is not visible (DELETE) we substitute with nothing
43
- def test_remove_utf8_delete
44
- assert_equal "text:", Latexpdf.escape_latex("text:\u007F")
42
+ # Since it is not printable (DELETE) we substitute with nothing
43
+ def test_removes_ascii_del
44
+ text = "\x7F"
45
+ text.force_encoding("UTF-8")
46
+ assert_equal "", Latexpdf.escape_latex(text)
47
+ end
48
+
49
+ # One should use newlines
50
+ def test_removes_carriage_return
51
+ text = "test: \x0D"
52
+ text.force_encoding("UTF-8")
53
+ assert_equal "test: ", Latexpdf.escape_latex(text)
54
+ end
55
+
56
+ def test_replaces_tab_to_space
57
+ assert_equal " test ", Latexpdf.escape_latex("\t\ttest\t")
58
+ end
59
+
60
+ def test_keeps_newlines
61
+ text = "\ntest\n\n"
62
+ escaped = Latexpdf.escape_latex(text)
63
+ assert_equal text, escaped
64
+ end
65
+
66
+ def test_remove_non_printable_chars
67
+ text = [*0..31].map {|i| i.chr }.join
68
+ text.force_encoding("UTF-8")
69
+ escaped_text = Latexpdf.escape_latex(text)
70
+
71
+ escaped_newline = Latexpdf.escape_latex("\n")
72
+ escaped_tab = Latexpdf.escape_latex("\t")
73
+
74
+ assert_equal escaped_tab + escaped_newline, escaped_text
45
75
  end
46
76
 
47
77
  def test_escape_percent_sign
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: latexpdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthijs Ooms
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-24 00:00:00.000000000 Z
11
+ date: 2017-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -153,6 +153,7 @@ files:
153
153
  - test/dummy/app/views/layouts/application.html.erb
154
154
  - test/dummy/app/views/tex/example.pdf.tex
155
155
  - test/dummy/app/views/tex/example2.pdf.tex
156
+ - test/dummy/app/views/tex/example3.pdf.tex
156
157
  - test/dummy/bin/bundle
157
158
  - test/dummy/bin/rails
158
159
  - test/dummy/bin/rake
@@ -244,6 +245,7 @@ test_files:
244
245
  - test/dummy/app/views/layouts/application.html.erb
245
246
  - test/dummy/app/views/tex/example.pdf.tex
246
247
  - test/dummy/app/views/tex/example2.pdf.tex
248
+ - test/dummy/app/views/tex/example3.pdf.tex
247
249
  - test/dummy/bin/bundle
248
250
  - test/dummy/bin/rails
249
251
  - test/dummy/bin/rake