Browse code

Handle <a href> tag

devnewton authored on 20/06/2016 22:35:56
Showing 4 changed files
... ...
@@ -11,7 +11,7 @@ function convert() {
11 11
 convertButton.addEventListener('click', convert);
12 12
 
13 13
 function init() {
14
-	inputArea.value = '>o_/ 22:23:56 #5766f86ae4b00e368dfab8a3 [:bondour] 2016/06/19#10:22:01 les <b>moules<</b> \\_o< https://sauf.ca http://totoz.eu/ ftp://ftp.fr.debian.org/';
14
+	inputArea.value = '>o_/ 22:23:56 #5766f86ae4b00e368dfab8a3 [:bondour] 2016/06/19#10:22:01 les <b>moules<</b> \\_o< https://sauf.ca http://totoz.eu/ ftp://ftp.fr.debian.org/ <a><i> <a nofollow="plop" href="http://linuxfr.org"> <a href="http://linuxfr.org" nofollow target="_blank">plop</a>';
15 15
 	convert();
16 16
 }
17 17
 document.readyState === "interactive" || document.readyState === "complete" ? init() : document.addEventListener("DOMContentLoaded", init);
... ...
@@ -60,66 +60,94 @@ p2c2 = (function() {
60 60
         peg$c21 = function() {return '<canard/>';},
61 61
         peg$c22 = /^[o0\xF4\xB0\xF8\xF2\xF3@]/,
62 62
         peg$c23 = { type: "class", value: "[o0\xF4\xB0\xF8\xF2\xF3@]", description: "[o0\xF4\xB0\xF8\xF2\xF3@]" },
63
-        peg$c24 = "</",
64
-        peg$c25 = { type: "literal", value: "</", description: "\"</\"" },
65
-        peg$c26 = function() { return ""; },
66
-        peg$c27 = /^[A-Za-z]/,
67
-        peg$c28 = { type: "class", value: "[A-Za-z]", description: "[A-Za-z]" },
68
-        peg$c29 = /^[^>]/,
69
-        peg$c30 = { type: "class", value: "[^>]", description: "[^>]" },
70
-        peg$c31 = "a",
71
-        peg$c32 = { type: "literal", value: "a", description: "\"a\"" },
72
-        peg$c33 = "b",
73
-        peg$c34 = { type: "literal", value: "b", description: "\"b\"" },
74
-        peg$c35 = "i",
75
-        peg$c36 = { type: "literal", value: "i", description: "\"i\"" },
76
-        peg$c37 = "u",
77
-        peg$c38 = { type: "literal", value: "u", description: "\"u\"" },
78
-        peg$c39 = "tt",
79
-        peg$c40 = { type: "literal", value: "tt", description: "\"tt\"" },
80
-        peg$c41 = function(norloge) { return '<norloge>' + norloge +'</norloge>'},
81
-        peg$c42 = "/",
82
-        peg$c43 = { type: "literal", value: "/", description: "\"/\"" },
83
-        peg$c44 = function(y, ln) { return y + "/" + ln; },
84
-        peg$c45 = /^[0-9]/,
85
-        peg$c46 = { type: "class", value: "[0-9]", description: "[0-9]" },
86
-        peg$c47 = function(digits) { return digits.join(""); },
87
-        peg$c48 = "#",
88
-        peg$c49 = { type: "literal", value: "#", description: "\"#\"" },
89
-        peg$c50 = function(m, d, nn) { return m + "/" + d + "#" + nn; },
90
-        peg$c51 = /^[0-1]/,
91
-        peg$c52 = { type: "class", value: "[0-1]", description: "[0-1]" },
92
-        peg$c53 = function(first, last) { return first + last; },
93
-        peg$c54 = /^[0-3]/,
94
-        peg$c55 = { type: "class", value: "[0-3]", description: "[0-3]" },
95
-        peg$c56 = ":",
96
-        peg$c57 = { type: "literal", value: ":", description: "\":\"" },
97
-        peg$c58 = function(sn, s) { return sn + ":" + s; },
98
-        peg$c59 = function(h, m) { return h + ":" + m; },
99
-        peg$c60 = /^[0-2]/,
100
-        peg$c61 = { type: "class", value: "[0-2]", description: "[0-2]" },
101
-        peg$c62 = /^[0-5]/,
102
-        peg$c63 = { type: "class", value: "[0-5]", description: "[0-5]" },
103
-        peg$c64 = /^[a-zA-Z0-9_]/,
104
-        peg$c65 = { type: "class", value: "[a-zA-Z0-9_]", description: "[a-zA-Z0-9_]" },
105
-        peg$c66 = function(chars) { var norlogeId = chars.join("");
63
+        peg$c24 = "b",
64
+        peg$c25 = { type: "literal", value: "b", description: "\"b\"" },
65
+        peg$c26 = "i",
66
+        peg$c27 = { type: "literal", value: "i", description: "\"i\"" },
67
+        peg$c28 = "u",
68
+        peg$c29 = { type: "literal", value: "u", description: "\"u\"" },
69
+        peg$c30 = "tt",
70
+        peg$c31 = { type: "literal", value: "tt", description: "\"tt\"" },
71
+        peg$c32 = "</",
72
+        peg$c33 = { type: "literal", value: "</", description: "\"</\"" },
73
+        peg$c34 = function() { return ""; },
74
+        peg$c35 = /^[A-Za-z]/,
75
+        peg$c36 = { type: "class", value: "[A-Za-z]", description: "[A-Za-z]" },
76
+        peg$c37 = /^[^>]/,
77
+        peg$c38 = { type: "class", value: "[^>]", description: "[^>]" },
78
+        peg$c39 = "<a",
79
+        peg$c40 = { type: "literal", value: "<a", description: "\"<a\"" },
80
+        peg$c41 = /^[^<]/,
81
+        peg$c42 = { type: "class", value: "[^<]", description: "[^<]" },
82
+        peg$c43 = "</a>",
83
+        peg$c44 = { type: "literal", value: "</a>", description: "\"</a>\"" },
84
+        peg$c45 = function(attributes) { 
85
+           if(attributes.href) {
86
+              return "<url>" + attributes.href + "</url>";
87
+           }
88
+         },
89
+        peg$c46 = " ",
90
+        peg$c47 = { type: "literal", value: " ", description: "\" \"" },
91
+        peg$c48 = function(separator, attribute) { return attribute;},
92
+        peg$c49 = function(attributes) {  var result = {};
93
+         	for(var a in attributes) {
94
+            	result[attributes[a].name] = attributes[a].value;
95
+            }
96
+         	return result;
97
+         },
98
+        peg$c50 = /^[a-z]/,
99
+        peg$c51 = { type: "class", value: "[a-z]", description: "[a-z]" },
100
+        peg$c52 = "=\"",
101
+        peg$c53 = { type: "literal", value: "=\"", description: "\"=\\\"\"" },
102
+        peg$c54 = /^[^"]/,
103
+        peg$c55 = { type: "class", value: "[^\"]", description: "[^\"]" },
104
+        peg$c56 = "\"",
105
+        peg$c57 = { type: "literal", value: "\"", description: "\"\\\"\"" },
106
+        peg$c58 = function(name, value) {return value;},
107
+        peg$c59 = function(name, value) {return { name: name, value: value}},
108
+        peg$c60 = function(norloge) { return '<norloge>' + norloge +'</norloge>'},
109
+        peg$c61 = "/",
110
+        peg$c62 = { type: "literal", value: "/", description: "\"/\"" },
111
+        peg$c63 = function(y, ln) { return y + "/" + ln; },
112
+        peg$c64 = /^[0-9]/,
113
+        peg$c65 = { type: "class", value: "[0-9]", description: "[0-9]" },
114
+        peg$c66 = function(digits) { return digits.join(""); },
115
+        peg$c67 = "#",
116
+        peg$c68 = { type: "literal", value: "#", description: "\"#\"" },
117
+        peg$c69 = function(m, d, nn) { return m + "/" + d + "#" + nn; },
118
+        peg$c70 = /^[0-1]/,
119
+        peg$c71 = { type: "class", value: "[0-1]", description: "[0-1]" },
120
+        peg$c72 = function(first, last) { return first + last; },
121
+        peg$c73 = /^[0-3]/,
122
+        peg$c74 = { type: "class", value: "[0-3]", description: "[0-3]" },
123
+        peg$c75 = ":",
124
+        peg$c76 = { type: "literal", value: ":", description: "\":\"" },
125
+        peg$c77 = function(sn, s) { return sn + ":" + s; },
126
+        peg$c78 = function(h, m) { return h + ":" + m; },
127
+        peg$c79 = /^[0-2]/,
128
+        peg$c80 = { type: "class", value: "[0-2]", description: "[0-2]" },
129
+        peg$c81 = /^[0-5]/,
130
+        peg$c82 = { type: "class", value: "[0-5]", description: "[0-5]" },
131
+        peg$c83 = /^[a-zA-Z0-9_]/,
132
+        peg$c84 = { type: "class", value: "[a-zA-Z0-9_]", description: "[a-zA-Z0-9_]" },
133
+        peg$c85 = function(chars) { var norlogeId = chars.join("");
106 134
            return '<norloge-id>#' + norlogeId + '</norloge-id>';
107 135
            },
108
-        peg$c67 = /^[a-zA-Z0-9\-_]/,
109
-        peg$c68 = { type: "class", value: "[a-zA-Z0-9-_]", description: "[a-zA-Z0-9-_]" },
110
-        peg$c69 = /^[<[]/,
111
-        peg$c70 = { type: "class", value: "[<[]", description: "[<[]" },
112
-        peg$c71 = function(bigorno) { return [].concat('<bigorno>', bigorno,'</bigorno>').join("")},
113
-        peg$c72 = "[:",
114
-        peg$c73 = { type: "literal", value: "[:", description: "\"[:\"" },
115
-        peg$c74 = /^[^\]]/,
116
-        peg$c75 = { type: "class", value: "[^\\]]", description: "[^\\]]" },
117
-        peg$c76 = "]",
118
-        peg$c77 = { type: "literal", value: "]", description: "\"]\"" },
119
-        peg$c78 = function(first, totoz, third) { var totozId = totoz.join(""); 
136
+        peg$c86 = /^[a-zA-Z0-9\-_]/,
137
+        peg$c87 = { type: "class", value: "[a-zA-Z0-9-_]", description: "[a-zA-Z0-9-_]" },
138
+        peg$c88 = /^[<[]/,
139
+        peg$c89 = { type: "class", value: "[<[]", description: "[<[]" },
140
+        peg$c90 = function(bigorno) { return [].concat('<bigorno>', bigorno,'</bigorno>').join("")},
141
+        peg$c91 = "[:",
142
+        peg$c92 = { type: "literal", value: "[:", description: "\"[:\"" },
143
+        peg$c93 = /^[^\]]/,
144
+        peg$c94 = { type: "class", value: "[^\\]]", description: "[^\\]]" },
145
+        peg$c95 = "]",
146
+        peg$c96 = { type: "literal", value: "]", description: "\"]\"" },
147
+        peg$c97 = function(first, totoz, third) { var totozId = totoz.join(""); 
120 148
           return '<totoz>' + totozId + '</totoz>'; },
121
-        peg$c79 = /^[ \t\r\n]/,
122
-        peg$c80 = { type: "class", value: "[ \\t\\r\\n]", description: "[ \\t\\r\\n]" },
149
+        peg$c98 = /^[ \t\r\n]/,
150
+        peg$c99 = { type: "class", value: "[ \\t\\r\\n]", description: "[ \\t\\r\\n]" },
123 151
 
124 152
         peg$currPos          = 0,
125 153
         peg$savedPos         = 0,
... ...
@@ -338,16 +366,19 @@ p2c2 = (function() {
338 366
             if (s0 === peg$FAILED) {
339 367
               s0 = peg$parsenorloge();
340 368
               if (s0 === peg$FAILED) {
341
-                s0 = peg$parseopentag();
369
+                s0 = peg$parseatag();
342 370
                 if (s0 === peg$FAILED) {
343
-                  s0 = peg$parseclosetag();
371
+                  s0 = peg$parseopentag();
344 372
                   if (s0 === peg$FAILED) {
345
-                    if (input.length > peg$currPos) {
346
-                      s0 = input.charAt(peg$currPos);
347
-                      peg$currPos++;
348
-                    } else {
349
-                      s0 = peg$FAILED;
350
-                      if (peg$silentFails === 0) { peg$fail(peg$c1); }
373
+                    s0 = peg$parseclosetag();
374
+                    if (s0 === peg$FAILED) {
375
+                      if (input.length > peg$currPos) {
376
+                        s0 = input.charAt(peg$currPos);
377
+                        peg$currPos++;
378
+                      } else {
379
+                        s0 = peg$FAILED;
380
+                        if (peg$silentFails === 0) { peg$fail(peg$c1); }
381
+                      }
351 382
                     }
352 383
                   }
353 384
                 }
... ...
@@ -573,7 +604,7 @@ p2c2 = (function() {
573 604
         if (peg$silentFails === 0) { peg$fail(peg$c16); }
574 605
       }
575 606
       if (s2 !== peg$FAILED) {
576
-        s3 = peg$parsetag();
607
+        s3 = peg$parsevalidFormatTag();
577 608
         if (s3 !== peg$FAILED) {
578 609
           if (input.charCodeAt(peg$currPos) === 62) {
579 610
             s4 = peg$c17;
... ...
@@ -609,20 +640,70 @@ p2c2 = (function() {
609 640
       return s0;
610 641
     }
611 642
 
643
+    function peg$parsevalidFormatTag() {
644
+      var s0;
645
+
646
+      if (input.charCodeAt(peg$currPos) === 98) {
647
+        s0 = peg$c24;
648
+        peg$currPos++;
649
+      } else {
650
+        s0 = peg$FAILED;
651
+        if (peg$silentFails === 0) { peg$fail(peg$c25); }
652
+      }
653
+      if (s0 === peg$FAILED) {
654
+        if (input.charCodeAt(peg$currPos) === 105) {
655
+          s0 = peg$c26;
656
+          peg$currPos++;
657
+        } else {
658
+          s0 = peg$FAILED;
659
+          if (peg$silentFails === 0) { peg$fail(peg$c27); }
660
+        }
661
+        if (s0 === peg$FAILED) {
662
+          if (input.charCodeAt(peg$currPos) === 115) {
663
+            s0 = peg$c4;
664
+            peg$currPos++;
665
+          } else {
666
+            s0 = peg$FAILED;
667
+            if (peg$silentFails === 0) { peg$fail(peg$c5); }
668
+          }
669
+          if (s0 === peg$FAILED) {
670
+            if (input.charCodeAt(peg$currPos) === 117) {
671
+              s0 = peg$c28;
672
+              peg$currPos++;
673
+            } else {
674
+              s0 = peg$FAILED;
675
+              if (peg$silentFails === 0) { peg$fail(peg$c29); }
676
+            }
677
+            if (s0 === peg$FAILED) {
678
+              if (input.substr(peg$currPos, 2) === peg$c30) {
679
+                s0 = peg$c30;
680
+                peg$currPos += 2;
681
+              } else {
682
+                s0 = peg$FAILED;
683
+                if (peg$silentFails === 0) { peg$fail(peg$c31); }
684
+              }
685
+            }
686
+          }
687
+        }
688
+      }
689
+
690
+      return s0;
691
+    }
692
+
612 693
     function peg$parseclosetag() {
613 694
       var s0, s1, s2, s3, s4;
614 695
 
615 696
       s0 = peg$currPos;
616 697
       s1 = peg$currPos;
617
-      if (input.substr(peg$currPos, 2) === peg$c24) {
618
-        s2 = peg$c24;
698
+      if (input.substr(peg$currPos, 2) === peg$c32) {
699
+        s2 = peg$c32;
619 700
         peg$currPos += 2;
620 701
       } else {
621 702
         s2 = peg$FAILED;
622
-        if (peg$silentFails === 0) { peg$fail(peg$c25); }
703
+        if (peg$silentFails === 0) { peg$fail(peg$c33); }
623 704
       }
624 705
       if (s2 !== peg$FAILED) {
625
-        s3 = peg$parsetag();
706
+        s3 = peg$parsevalidFormatTag();
626 707
         if (s3 !== peg$FAILED) {
627 708
           if (input.charCodeAt(peg$currPos) === 62) {
628 709
             s4 = peg$c17;
... ...
@@ -670,7 +751,7 @@ p2c2 = (function() {
670 751
         if (peg$silentFails === 0) { peg$fail(peg$c16); }
671 752
       }
672 753
       if (s1 !== peg$FAILED) {
673
-        s2 = peg$parsetagName();
754
+        s2 = peg$parseinvalidTag();
674 755
         if (s2 !== peg$FAILED) {
675 756
           if (input.charCodeAt(peg$currPos) === 62) {
676 757
             s3 = peg$c17;
... ...
@@ -681,7 +762,7 @@ p2c2 = (function() {
681 762
           }
682 763
           if (s3 !== peg$FAILED) {
683 764
             peg$savedPos = s0;
684
-            s1 = peg$c26();
765
+            s1 = peg$c34();
685 766
             s0 = s1;
686 767
           } else {
687 768
             peg$currPos = s0;
... ...
@@ -703,15 +784,15 @@ p2c2 = (function() {
703 784
       var s0, s1, s2, s3;
704 785
 
705 786
       s0 = peg$currPos;
706
-      if (input.substr(peg$currPos, 2) === peg$c24) {
707
-        s1 = peg$c24;
787
+      if (input.substr(peg$currPos, 2) === peg$c32) {
788
+        s1 = peg$c32;
708 789
         peg$currPos += 2;
709 790
       } else {
710 791
         s1 = peg$FAILED;
711
-        if (peg$silentFails === 0) { peg$fail(peg$c25); }
792
+        if (peg$silentFails === 0) { peg$fail(peg$c33); }
712 793
       }
713 794
       if (s1 !== peg$FAILED) {
714
-        s2 = peg$parsetagName();
795
+        s2 = peg$parseinvalidTag();
715 796
         if (s2 !== peg$FAILED) {
716 797
           if (input.charCodeAt(peg$currPos) === 62) {
717 798
             s3 = peg$c17;
... ...
@@ -722,7 +803,7 @@ p2c2 = (function() {
722 803
           }
723 804
           if (s3 !== peg$FAILED) {
724 805
             peg$savedPos = s0;
725
-            s1 = peg$c26();
806
+            s1 = peg$c34();
726 807
             s0 = s1;
727 808
           } else {
728 809
             peg$currPos = s0;
... ...
@@ -740,34 +821,34 @@ p2c2 = (function() {
740 821
       return s0;
741 822
     }
742 823
 
743
-    function peg$parsetagName() {
824
+    function peg$parseinvalidTag() {
744 825
       var s0, s1, s2, s3;
745 826
 
746 827
       s0 = peg$currPos;
747
-      if (peg$c27.test(input.charAt(peg$currPos))) {
828
+      if (peg$c35.test(input.charAt(peg$currPos))) {
748 829
         s1 = input.charAt(peg$currPos);
749 830
         peg$currPos++;
750 831
       } else {
751 832
         s1 = peg$FAILED;
752
-        if (peg$silentFails === 0) { peg$fail(peg$c28); }
833
+        if (peg$silentFails === 0) { peg$fail(peg$c36); }
753 834
       }
754 835
       if (s1 !== peg$FAILED) {
755 836
         s2 = [];
756
-        if (peg$c29.test(input.charAt(peg$currPos))) {
837
+        if (peg$c37.test(input.charAt(peg$currPos))) {
757 838
           s3 = input.charAt(peg$currPos);
758 839
           peg$currPos++;
759 840
         } else {
760 841
           s3 = peg$FAILED;
761
-          if (peg$silentFails === 0) { peg$fail(peg$c30); }
842
+          if (peg$silentFails === 0) { peg$fail(peg$c38); }
762 843
         }
763 844
         while (s3 !== peg$FAILED) {
764 845
           s2.push(s3);
765
-          if (peg$c29.test(input.charAt(peg$currPos))) {
846
+          if (peg$c37.test(input.charAt(peg$currPos))) {
766 847
             s3 = input.charAt(peg$currPos);
767 848
             peg$currPos++;
768 849
           } else {
769 850
             s3 = peg$FAILED;
770
-            if (peg$silentFails === 0) { peg$fail(peg$c30); }
851
+            if (peg$silentFails === 0) { peg$fail(peg$c38); }
771 852
           }
772 853
         }
773 854
         if (s2 !== peg$FAILED) {
... ...
@@ -785,60 +866,247 @@ p2c2 = (function() {
785 866
       return s0;
786 867
     }
787 868
 
788
-    function peg$parsetag() {
789
-      var s0;
869
+    function peg$parseatag() {
870
+      var s0, s1, s2, s3, s4, s5;
790 871
 
791
-      if (input.charCodeAt(peg$currPos) === 97) {
792
-        s0 = peg$c31;
793
-        peg$currPos++;
872
+      s0 = peg$currPos;
873
+      if (input.substr(peg$currPos, 2) === peg$c39) {
874
+        s1 = peg$c39;
875
+        peg$currPos += 2;
794 876
       } else {
795
-        s0 = peg$FAILED;
796
-        if (peg$silentFails === 0) { peg$fail(peg$c32); }
877
+        s1 = peg$FAILED;
878
+        if (peg$silentFails === 0) { peg$fail(peg$c40); }
797 879
       }
798
-      if (s0 === peg$FAILED) {
799
-        if (input.charCodeAt(peg$currPos) === 98) {
800
-          s0 = peg$c33;
801
-          peg$currPos++;
802
-        } else {
803
-          s0 = peg$FAILED;
804
-          if (peg$silentFails === 0) { peg$fail(peg$c34); }
805
-        }
806
-        if (s0 === peg$FAILED) {
807
-          if (input.charCodeAt(peg$currPos) === 105) {
808
-            s0 = peg$c35;
880
+      if (s1 !== peg$FAILED) {
881
+        s2 = peg$parsetagAttributes();
882
+        if (s2 !== peg$FAILED) {
883
+          if (input.charCodeAt(peg$currPos) === 62) {
884
+            s3 = peg$c17;
809 885
             peg$currPos++;
810 886
           } else {
811
-            s0 = peg$FAILED;
812
-            if (peg$silentFails === 0) { peg$fail(peg$c36); }
887
+            s3 = peg$FAILED;
888
+            if (peg$silentFails === 0) { peg$fail(peg$c18); }
813 889
           }
814
-          if (s0 === peg$FAILED) {
815
-            if (input.charCodeAt(peg$currPos) === 115) {
816
-              s0 = peg$c4;
890
+          if (s3 !== peg$FAILED) {
891
+            s4 = [];
892
+            if (peg$c41.test(input.charAt(peg$currPos))) {
893
+              s5 = input.charAt(peg$currPos);
817 894
               peg$currPos++;
818 895
             } else {
819
-              s0 = peg$FAILED;
820
-              if (peg$silentFails === 0) { peg$fail(peg$c5); }
896
+              s5 = peg$FAILED;
897
+              if (peg$silentFails === 0) { peg$fail(peg$c42); }
821 898
             }
822
-            if (s0 === peg$FAILED) {
823
-              if (input.charCodeAt(peg$currPos) === 117) {
824
-                s0 = peg$c37;
899
+            while (s5 !== peg$FAILED) {
900
+              s4.push(s5);
901
+              if (peg$c41.test(input.charAt(peg$currPos))) {
902
+                s5 = input.charAt(peg$currPos);
825 903
                 peg$currPos++;
826 904
               } else {
827
-                s0 = peg$FAILED;
828
-                if (peg$silentFails === 0) { peg$fail(peg$c38); }
905
+                s5 = peg$FAILED;
906
+                if (peg$silentFails === 0) { peg$fail(peg$c42); }
829 907
               }
830
-              if (s0 === peg$FAILED) {
831
-                if (input.substr(peg$currPos, 2) === peg$c39) {
832
-                  s0 = peg$c39;
833
-                  peg$currPos += 2;
834
-                } else {
835
-                  s0 = peg$FAILED;
836
-                  if (peg$silentFails === 0) { peg$fail(peg$c40); }
837
-                }
908
+            }
909
+            if (s4 !== peg$FAILED) {
910
+              if (input.substr(peg$currPos, 4) === peg$c43) {
911
+                s5 = peg$c43;
912
+                peg$currPos += 4;
913
+              } else {
914
+                s5 = peg$FAILED;
915
+                if (peg$silentFails === 0) { peg$fail(peg$c44); }
916
+              }
917
+              if (s5 !== peg$FAILED) {
918
+                peg$savedPos = s0;
919
+                s1 = peg$c45(s2);
920
+                s0 = s1;
921
+              } else {
922
+                peg$currPos = s0;
923
+                s0 = peg$FAILED;
838 924
               }
925
+            } else {
926
+              peg$currPos = s0;
927
+              s0 = peg$FAILED;
928
+            }
929
+          } else {
930
+            peg$currPos = s0;
931
+            s0 = peg$FAILED;
932
+          }
933
+        } else {
934
+          peg$currPos = s0;
935
+          s0 = peg$FAILED;
936
+        }
937
+      } else {
938
+        peg$currPos = s0;
939
+        s0 = peg$FAILED;
940
+      }
941
+
942
+      return s0;
943
+    }
944
+
945
+    function peg$parsetagAttributes() {
946
+      var s0, s1, s2, s3, s4;
947
+
948
+      s0 = peg$currPos;
949
+      s1 = [];
950
+      s2 = peg$currPos;
951
+      if (input.charCodeAt(peg$currPos) === 32) {
952
+        s3 = peg$c46;
953
+        peg$currPos++;
954
+      } else {
955
+        s3 = peg$FAILED;
956
+        if (peg$silentFails === 0) { peg$fail(peg$c47); }
957
+      }
958
+      if (s3 !== peg$FAILED) {
959
+        s4 = peg$parsetagAttribute();
960
+        if (s4 !== peg$FAILED) {
961
+          peg$savedPos = s2;
962
+          s3 = peg$c48(s3, s4);
963
+          s2 = s3;
964
+        } else {
965
+          peg$currPos = s2;
966
+          s2 = peg$FAILED;
967
+        }
968
+      } else {
969
+        peg$currPos = s2;
970
+        s2 = peg$FAILED;
971
+      }
972
+      while (s2 !== peg$FAILED) {
973
+        s1.push(s2);
974
+        s2 = peg$currPos;
975
+        if (input.charCodeAt(peg$currPos) === 32) {
976
+          s3 = peg$c46;
977
+          peg$currPos++;
978
+        } else {
979
+          s3 = peg$FAILED;
980
+          if (peg$silentFails === 0) { peg$fail(peg$c47); }
981
+        }
982
+        if (s3 !== peg$FAILED) {
983
+          s4 = peg$parsetagAttribute();
984
+          if (s4 !== peg$FAILED) {
985
+            peg$savedPos = s2;
986
+            s3 = peg$c48(s3, s4);
987
+            s2 = s3;
988
+          } else {
989
+            peg$currPos = s2;
990
+            s2 = peg$FAILED;
991
+          }
992
+        } else {
993
+          peg$currPos = s2;
994
+          s2 = peg$FAILED;
995
+        }
996
+      }
997
+      if (s1 !== peg$FAILED) {
998
+        peg$savedPos = s0;
999
+        s1 = peg$c49(s1);
1000
+      }
1001
+      s0 = s1;
1002
+
1003
+      return s0;
1004
+    }
1005
+
1006
+    function peg$parsetagAttribute() {
1007
+      var s0, s1, s2, s3, s4, s5, s6;
1008
+
1009
+      s0 = peg$currPos;
1010
+      s1 = peg$currPos;
1011
+      s2 = [];
1012
+      if (peg$c50.test(input.charAt(peg$currPos))) {
1013
+        s3 = input.charAt(peg$currPos);
1014
+        peg$currPos++;
1015
+      } else {
1016
+        s3 = peg$FAILED;
1017
+        if (peg$silentFails === 0) { peg$fail(peg$c51); }
1018
+      }
1019
+      if (s3 !== peg$FAILED) {
1020
+        while (s3 !== peg$FAILED) {
1021
+          s2.push(s3);
1022
+          if (peg$c50.test(input.charAt(peg$currPos))) {
1023
+            s3 = input.charAt(peg$currPos);
1024
+            peg$currPos++;
1025
+          } else {
1026
+            s3 = peg$FAILED;
1027
+            if (peg$silentFails === 0) { peg$fail(peg$c51); }
1028
+          }
1029
+        }
1030
+      } else {
1031
+        s2 = peg$FAILED;
1032
+      }
1033
+      if (s2 !== peg$FAILED) {
1034
+        s1 = input.substring(s1, peg$currPos);
1035
+      } else {
1036
+        s1 = s2;
1037
+      }
1038
+      if (s1 !== peg$FAILED) {
1039
+        s2 = peg$currPos;
1040
+        if (input.substr(peg$currPos, 2) === peg$c52) {
1041
+          s3 = peg$c52;
1042
+          peg$currPos += 2;
1043
+        } else {
1044
+          s3 = peg$FAILED;
1045
+          if (peg$silentFails === 0) { peg$fail(peg$c53); }
1046
+        }
1047
+        if (s3 !== peg$FAILED) {
1048
+          s4 = peg$currPos;
1049
+          s5 = [];
1050
+          if (peg$c54.test(input.charAt(peg$currPos))) {
1051
+            s6 = input.charAt(peg$currPos);
1052
+            peg$currPos++;
1053
+          } else {
1054
+            s6 = peg$FAILED;
1055
+            if (peg$silentFails === 0) { peg$fail(peg$c55); }
1056
+          }
1057
+          while (s6 !== peg$FAILED) {
1058
+            s5.push(s6);
1059
+            if (peg$c54.test(input.charAt(peg$currPos))) {
1060
+              s6 = input.charAt(peg$currPos);
1061
+              peg$currPos++;
1062
+            } else {
1063
+              s6 = peg$FAILED;
1064
+              if (peg$silentFails === 0) { peg$fail(peg$c55); }
1065
+            }
1066
+          }
1067
+          if (s5 !== peg$FAILED) {
1068
+            s4 = input.substring(s4, peg$currPos);
1069
+          } else {
1070
+            s4 = s5;
1071
+          }
1072
+          if (s4 !== peg$FAILED) {
1073
+            if (input.charCodeAt(peg$currPos) === 34) {
1074
+              s5 = peg$c56;
1075
+              peg$currPos++;
1076
+            } else {
1077
+              s5 = peg$FAILED;
1078
+              if (peg$silentFails === 0) { peg$fail(peg$c57); }
1079
+            }
1080
+            if (s5 !== peg$FAILED) {
1081
+              peg$savedPos = s2;
1082
+              s3 = peg$c58(s1, s4);
1083
+              s2 = s3;
1084
+            } else {
1085
+              peg$currPos = s2;
1086
+              s2 = peg$FAILED;
839 1087
             }
1088
+          } else {
1089
+            peg$currPos = s2;
1090
+            s2 = peg$FAILED;
840 1091
           }
1092
+        } else {
1093
+          peg$currPos = s2;
1094
+          s2 = peg$FAILED;
841 1095
         }
1096
+        if (s2 === peg$FAILED) {
1097
+          s2 = null;
1098
+        }
1099
+        if (s2 !== peg$FAILED) {
1100
+          peg$savedPos = s0;
1101
+          s1 = peg$c59(s1, s2);
1102
+          s0 = s1;
1103
+        } else {
1104
+          peg$currPos = s0;
1105
+          s0 = peg$FAILED;
1106
+        }
1107
+      } else {
1108
+        peg$currPos = s0;
1109
+        s0 = peg$FAILED;
842 1110
       }
843 1111
 
844 1112
       return s0;
... ...
@@ -871,7 +1139,7 @@ p2c2 = (function() {
871 1139
       }
872 1140
       if (s1 !== peg$FAILED) {
873 1141
         peg$savedPos = s0;
874
-        s1 = peg$c41(s1);
1142
+        s1 = peg$c60(s1);
875 1143
       }
876 1144
       s0 = s1;
877 1145
 
... ...
@@ -885,17 +1153,17 @@ p2c2 = (function() {
885 1153
       s1 = peg$parsenorlogeYear();
886 1154
       if (s1 !== peg$FAILED) {
887 1155
         if (input.charCodeAt(peg$currPos) === 47) {
888
-          s2 = peg$c42;
1156
+          s2 = peg$c61;
889 1157
           peg$currPos++;
890 1158
         } else {
891 1159
           s2 = peg$FAILED;
892
-          if (peg$silentFails === 0) { peg$fail(peg$c43); }
1160
+          if (peg$silentFails === 0) { peg$fail(peg$c62); }
893 1161
         }
894 1162
         if (s2 !== peg$FAILED) {
895 1163
           s3 = peg$parselongNorloge();
896 1164
           if (s3 !== peg$FAILED) {
897 1165
             peg$savedPos = s0;
898
-            s1 = peg$c44(s1, s3);
1166
+            s1 = peg$c63(s1, s3);
899 1167
             s0 = s1;
900 1168
           } else {
901 1169
             peg$currPos = s0;
... ...
@@ -918,22 +1186,22 @@ p2c2 = (function() {
918 1186
 
919 1187
       s0 = peg$currPos;
920 1188
       s1 = [];
921
-      if (peg$c45.test(input.charAt(peg$currPos))) {
1189
+      if (peg$c64.test(input.charAt(peg$currPos))) {
922 1190
         s2 = input.charAt(peg$currPos);
923 1191
         peg$currPos++;
924 1192
       } else {
925 1193
         s2 = peg$FAILED;
926
-        if (peg$silentFails === 0) { peg$fail(peg$c46); }
1194
+        if (peg$silentFails === 0) { peg$fail(peg$c65); }
927 1195
       }
928 1196
       if (s2 !== peg$FAILED) {
929 1197
         while (s2 !== peg$FAILED) {
930 1198
           s1.push(s2);
931
-          if (peg$c45.test(input.charAt(peg$currPos))) {
1199
+          if (peg$c64.test(input.charAt(peg$currPos))) {
932 1200
             s2 = input.charAt(peg$currPos);
933 1201
             peg$currPos++;
934 1202
           } else {
935 1203
             s2 = peg$FAILED;
936
-            if (peg$silentFails === 0) { peg$fail(peg$c46); }
1204
+            if (peg$silentFails === 0) { peg$fail(peg$c65); }
937 1205
           }
938 1206
         }
939 1207
       } else {
... ...
@@ -941,7 +1209,7 @@ p2c2 = (function() {
941 1209
       }
942 1210
       if (s1 !== peg$FAILED) {
943 1211
         peg$savedPos = s0;
944
-        s1 = peg$c47(s1);
1212
+        s1 = peg$c66(s1);
945 1213
       }
946 1214
       s0 = s1;
947 1215
 
... ...
@@ -955,27 +1223,27 @@ p2c2 = (function() {
955 1223
       s1 = peg$parsenorlogeMonth();
956 1224
       if (s1 !== peg$FAILED) {
957 1225
         if (input.charCodeAt(peg$currPos) === 47) {
958
-          s2 = peg$c42;
1226
+          s2 = peg$c61;
959 1227
           peg$currPos++;
960 1228
         } else {
961 1229
           s2 = peg$FAILED;
962
-          if (peg$silentFails === 0) { peg$fail(peg$c43); }
1230
+          if (peg$silentFails === 0) { peg$fail(peg$c62); }
963 1231
         }
964 1232
         if (s2 !== peg$FAILED) {
965 1233
           s3 = peg$parsenorlogeDay();
966 1234
           if (s3 !== peg$FAILED) {
967 1235
             if (input.charCodeAt(peg$currPos) === 35) {
968
-              s4 = peg$c48;
1236
+              s4 = peg$c67;
969 1237
               peg$currPos++;
970 1238
             } else {
971 1239
               s4 = peg$FAILED;
972
-              if (peg$silentFails === 0) { peg$fail(peg$c49); }
1240
+              if (peg$silentFails === 0) { peg$fail(peg$c68); }
973 1241
             }
974 1242
             if (s4 !== peg$FAILED) {
975 1243
               s5 = peg$parsenormalNorloge();
976 1244
               if (s5 !== peg$FAILED) {
977 1245
                 peg$savedPos = s0;
978
-                s1 = peg$c50(s1, s3, s5);
1246
+                s1 = peg$c69(s1, s3, s5);
979 1247
                 s0 = s1;
980 1248
               } else {
981 1249
                 peg$currPos = s0;
... ...
@@ -1005,24 +1273,24 @@ p2c2 = (function() {
1005 1273
       var s0, s1, s2;
1006 1274
 
1007 1275
       s0 = peg$currPos;
1008
-      if (peg$c51.test(input.charAt(peg$currPos))) {
1276
+      if (peg$c70.test(input.charAt(peg$currPos))) {
1009 1277
         s1 = input.charAt(peg$currPos);
1010 1278
         peg$currPos++;
1011 1279
       } else {
1012 1280
         s1 = peg$FAILED;
1013
-        if (peg$silentFails === 0) { peg$fail(peg$c52); }
1281
+        if (peg$silentFails === 0) { peg$fail(peg$c71); }
1014 1282
       }
1015 1283
       if (s1 !== peg$FAILED) {
1016
-        if (peg$c45.test(input.charAt(peg$currPos))) {
1284
+        if (peg$c64.test(input.charAt(peg$currPos))) {
1017 1285
           s2 = input.charAt(peg$currPos);
1018 1286
           peg$currPos++;
1019 1287
         } else {
1020 1288
           s2 = peg$FAILED;
1021
-          if (peg$silentFails === 0) { peg$fail(peg$c46); }
1289
+          if (peg$silentFails === 0) { peg$fail(peg$c65); }
1022 1290
         }
1023 1291
         if (s2 !== peg$FAILED) {
1024 1292
           peg$savedPos = s0;
1025
-          s1 = peg$c53(s1, s2);
1293
+          s1 = peg$c72(s1, s2);
1026 1294
           s0 = s1;
1027 1295
         } else {
1028 1296
           peg$currPos = s0;
... ...
@@ -1040,24 +1308,24 @@ p2c2 = (function() {
1040 1308
       var s0, s1, s2;
1041 1309
 
1042 1310
       s0 = peg$currPos;
1043
-      if (peg$c54.test(input.charAt(peg$currPos))) {
1311
+      if (peg$c73.test(input.charAt(peg$currPos))) {
1044 1312
         s1 = input.charAt(peg$currPos);
1045 1313
         peg$currPos++;
1046 1314
       } else {
1047 1315
         s1 = peg$FAILED;
1048
-        if (peg$silentFails === 0) { peg$fail(peg$c55); }
1316
+        if (peg$silentFails === 0) { peg$fail(peg$c74); }
1049 1317
       }
1050 1318
       if (s1 !== peg$FAILED) {
1051
-        if (peg$c45.test(input.charAt(peg$currPos))) {
1319
+        if (peg$c64.test(input.charAt(peg$currPos))) {
1052 1320
           s2 = input.charAt(peg$currPos);
1053 1321
           peg$currPos++;
1054 1322
         } else {
1055 1323
           s2 = peg$FAILED;
1056
-          if (peg$silentFails === 0) { peg$fail(peg$c46); }
1324
+          if (peg$silentFails === 0) { peg$fail(peg$c65); }
1057 1325
         }
1058 1326
         if (s2 !== peg$FAILED) {
1059 1327
           peg$savedPos = s0;
1060
-          s1 = peg$c53(s1, s2);
1328
+          s1 = peg$c72(s1, s2);
1061 1329
           s0 = s1;
1062 1330
         } else {
1063 1331
           peg$currPos = s0;
... ...
@@ -1078,17 +1346,17 @@ p2c2 = (function() {
1078 1346
       s1 = peg$parseshortNorloge();
1079 1347
       if (s1 !== peg$FAILED) {
1080 1348
         if (input.charCodeAt(peg$currPos) === 58) {
1081
-          s2 = peg$c56;
1349
+          s2 = peg$c75;
1082 1350
           peg$currPos++;
1083 1351
         } else {
1084 1352
           s2 = peg$FAILED;
1085
-          if (peg$silentFails === 0) { peg$fail(peg$c57); }
1353
+          if (peg$silentFails === 0) { peg$fail(peg$c76); }
1086 1354
         }
1087 1355
         if (s2 !== peg$FAILED) {
1088 1356
           s3 = peg$parsenorlogeSeconds();
1089 1357
           if (s3 !== peg$FAILED) {
1090 1358
             peg$savedPos = s0;
1091
-            s1 = peg$c58(s1, s3);
1359
+            s1 = peg$c77(s1, s3);
1092 1360
             s0 = s1;
1093 1361
           } else {
1094 1362
             peg$currPos = s0;
... ...
@@ -1113,17 +1381,17 @@ p2c2 = (function() {
1113 1381
       s1 = peg$parsenorlogeHours();
1114 1382
       if (s1 !== peg$FAILED) {
1115 1383
         if (input.charCodeAt(peg$currPos) === 58) {
1116
-          s2 = peg$c56;
1384
+          s2 = peg$c75;
1117 1385
           peg$currPos++;
1118 1386
         } else {
1119 1387
           s2 = peg$FAILED;
1120
-          if (peg$silentFails === 0) { peg$fail(peg$c57); }
1388
+          if (peg$silentFails === 0) { peg$fail(peg$c76); }
1121 1389
         }
1122 1390
         if (s2 !== peg$FAILED) {
1123 1391
           s3 = peg$parsenorlogeMinutes();
1124 1392
           if (s3 !== peg$FAILED) {
1125 1393
             peg$savedPos = s0;
1126
-            s1 = peg$c59(s1, s3);
1394
+            s1 = peg$c78(s1, s3);
1127 1395
             s0 = s1;
1128 1396
           } else {
1129 1397
             peg$currPos = s0;
... ...
@@ -1145,24 +1413,24 @@ p2c2 = (function() {
1145 1413
       var s0, s1, s2;
1146 1414
 
1147 1415
       s0 = peg$currPos;
1148
-      if (peg$c60.test(input.charAt(peg$currPos))) {
1416
+      if (peg$c79.test(input.charAt(peg$currPos))) {
1149 1417
         s1 = input.charAt(peg$currPos);
1150 1418
         peg$currPos++;
1151 1419
       } else {
1152 1420
         s1 = peg$FAILED;
1153
-        if (peg$silentFails === 0) { peg$fail(peg$c61); }
1421
+        if (peg$silentFails === 0) { peg$fail(peg$c80); }
1154 1422
       }
1155 1423
       if (s1 !== peg$FAILED) {
1156
-        if (peg$c54.test(input.charAt(peg$currPos))) {
1424
+        if (peg$c73.test(input.charAt(peg$currPos))) {
1157 1425
           s2 = input.charAt(peg$currPos);
1158 1426
           peg$currPos++;
1159 1427
         } else {
1160 1428
           s2 = peg$FAILED;
1161
-          if (peg$silentFails === 0) { peg$fail(peg$c55); }
1429
+          if (peg$silentFails === 0) { peg$fail(peg$c74); }
1162 1430
         }
1163 1431
         if (s2 !== peg$FAILED) {
1164 1432
           peg$savedPos = s0;
1165
-          s1 = peg$c53(s1, s2);
1433
+          s1 = peg$c72(s1, s2);
1166 1434
           s0 = s1;
1167 1435
         } else {
1168 1436
           peg$currPos = s0;
... ...
@@ -1180,24 +1448,24 @@ p2c2 = (function() {
1180 1448
       var s0, s1, s2;
1181 1449
 
1182 1450
       s0 = peg$currPos;
1183
-      if (peg$c62.test(input.charAt(peg$currPos))) {
1451
+      if (peg$c81.test(input.charAt(peg$currPos))) {
1184 1452
         s1 = input.charAt(peg$currPos);
1185 1453
         peg$currPos++;
1186 1454
       } else {
1187 1455
         s1 = peg$FAILED;
1188
-        if (peg$silentFails === 0) { peg$fail(peg$c63); }
1456
+        if (peg$silentFails === 0) { peg$fail(peg$c82); }
1189 1457
       }
1190 1458
       if (s1 !== peg$FAILED) {
1191
-        if (peg$c45.test(input.charAt(peg$currPos))) {
1459
+        if (peg$c64.test(input.charAt(peg$currPos))) {
1192 1460
           s2 = input.charAt(peg$currPos);
1193 1461
           peg$currPos++;
1194 1462
         } else {
1195 1463
           s2 = peg$FAILED;
1196
-          if (peg$silentFails === 0) { peg$fail(peg$c46); }
1464
+          if (peg$silentFails === 0) { peg$fail(peg$c65); }
1197 1465
         }
1198 1466
         if (s2 !== peg$FAILED) {
1199 1467
           peg$savedPos = s0;
1200
-          s1 = peg$c53(s1, s2);
1468
+          s1 = peg$c72(s1, s2);
1201 1469
           s0 = s1;
1202 1470
         } else {
1203 1471
           peg$currPos = s0;
... ...
@@ -1215,24 +1483,24 @@ p2c2 = (function() {
1215 1483
       var s0, s1, s2;
1216 1484
 
1217 1485
       s0 = peg$currPos;
1218
-      if (peg$c62.test(input.charAt(peg$currPos))) {
1486
+      if (peg$c81.test(input.charAt(peg$currPos))) {
1219 1487
         s1 = input.charAt(peg$currPos);
1220 1488
         peg$currPos++;
1221 1489
       } else {
1222 1490
         s1 = peg$FAILED;
1223
-        if (peg$silentFails === 0) { peg$fail(peg$c63); }
1491
+        if (peg$silentFails === 0) { peg$fail(peg$c82); }
1224 1492
       }
1225 1493
       if (s1 !== peg$FAILED) {
1226
-        if (peg$c45.test(input.charAt(peg$currPos))) {
1494
+        if (peg$c64.test(input.charAt(peg$currPos))) {
1227 1495
           s2 = input.charAt(peg$currPos);
1228 1496
           peg$currPos++;
1229 1497
         } else {
1230 1498
           s2 = peg$FAILED;
1231
-          if (peg$silentFails === 0) { peg$fail(peg$c46); }
1499
+          if (peg$silentFails === 0) { peg$fail(peg$c65); }
1232 1500
         }
1233 1501
         if (s2 !== peg$FAILED) {
1234 1502
           peg$savedPos = s0;
1235
-          s1 = peg$c53(s1, s2);
1503
+          s1 = peg$c72(s1, s2);
1236 1504
           s0 = s1;
1237 1505
         } else {
1238 1506
           peg$currPos = s0;
... ...
@@ -1251,30 +1519,30 @@ p2c2 = (function() {
1251 1519
 
1252 1520
       s0 = peg$currPos;
1253 1521
       if (input.charCodeAt(peg$currPos) === 35) {
1254
-        s1 = peg$c48;
1522
+        s1 = peg$c67;
1255 1523
         peg$currPos++;
1256 1524
       } else {
1257 1525
         s1 = peg$FAILED;
1258
-        if (peg$silentFails === 0) { peg$fail(peg$c49); }
1526
+        if (peg$silentFails === 0) { peg$fail(peg$c68); }
1259 1527
       }
1260 1528
       if (s1 !== peg$FAILED) {
1261 1529
         s2 = [];
1262
-        if (peg$c64.test(input.charAt(peg$currPos))) {
1530
+        if (peg$c83.test(input.charAt(peg$currPos))) {
1263 1531
           s3 = input.charAt(peg$currPos);
1264 1532
           peg$currPos++;
1265 1533
         } else {
1266 1534
           s3 = peg$FAILED;
1267
-          if (peg$silentFails === 0) { peg$fail(peg$c65); }
1535
+          if (peg$silentFails === 0) { peg$fail(peg$c84); }
1268 1536
         }
1269 1537
         if (s3 !== peg$FAILED) {
1270 1538
           while (s3 !== peg$FAILED) {
1271 1539
             s2.push(s3);
1272
-            if (peg$c64.test(input.charAt(peg$currPos))) {
1540
+            if (peg$c83.test(input.charAt(peg$currPos))) {
1273 1541
               s3 = input.charAt(peg$currPos);
1274 1542
               peg$currPos++;
1275 1543
             } else {
1276 1544
               s3 = peg$FAILED;
1277
-              if (peg$silentFails === 0) { peg$fail(peg$c65); }
1545
+              if (peg$silentFails === 0) { peg$fail(peg$c84); }
1278 1546
             }
1279 1547
           }
1280 1548
         } else {
... ...
@@ -1282,7 +1550,7 @@ p2c2 = (function() {
1282 1550
         }
1283 1551
         if (s2 !== peg$FAILED) {
1284 1552
           peg$savedPos = s0;
1285
-          s1 = peg$c66(s2);
1553
+          s1 = peg$c85(s2);
1286 1554
           s0 = s1;
1287 1555
         } else {
1288 1556
           peg$currPos = s0;
... ...
@@ -1301,22 +1569,22 @@ p2c2 = (function() {
1301 1569
 
1302 1570
       s0 = peg$currPos;
1303 1571
       s1 = [];
1304
-      if (peg$c67.test(input.charAt(peg$currPos))) {
1572
+      if (peg$c86.test(input.charAt(peg$currPos))) {
1305 1573
         s2 = input.charAt(peg$currPos);
1306 1574
         peg$currPos++;
1307 1575
       } else {
1308 1576
         s2 = peg$FAILED;
1309
-        if (peg$silentFails === 0) { peg$fail(peg$c68); }
1577
+        if (peg$silentFails === 0) { peg$fail(peg$c87); }
1310 1578
       }
1311 1579
       if (s2 !== peg$FAILED) {
1312 1580
         while (s2 !== peg$FAILED) {
1313 1581
           s1.push(s2);
1314
-          if (peg$c67.test(input.charAt(peg$currPos))) {
1582
+          if (peg$c86.test(input.charAt(peg$currPos))) {
1315 1583
             s2 = input.charAt(peg$currPos);
1316 1584
             peg$currPos++;
1317 1585
           } else {
1318 1586
             s2 = peg$FAILED;
1319
-            if (peg$silentFails === 0) { peg$fail(peg$c68); }
1587
+            if (peg$silentFails === 0) { peg$fail(peg$c87); }
1320 1588
           }
1321 1589
         }
1322 1590
       } else {
... ...
@@ -1335,12 +1603,12 @@ p2c2 = (function() {
1335 1603
           peg$silentFails++;
1336 1604
           s4 = peg$parsewhitespaces();
1337 1605
           if (s4 === peg$FAILED) {
1338
-            if (peg$c69.test(input.charAt(peg$currPos))) {
1606
+            if (peg$c88.test(input.charAt(peg$currPos))) {
1339 1607
               s4 = input.charAt(peg$currPos);
1340 1608
               peg$currPos++;
1341 1609
             } else {
1342 1610
               s4 = peg$FAILED;
1343
-              if (peg$silentFails === 0) { peg$fail(peg$c70); }
1611
+              if (peg$silentFails === 0) { peg$fail(peg$c89); }
1344 1612
             }
1345 1613
           }
1346 1614
           peg$silentFails--;
... ...
@@ -1352,7 +1620,7 @@ p2c2 = (function() {
1352 1620
           }
1353 1621
           if (s3 !== peg$FAILED) {
1354 1622
             peg$savedPos = s0;
1355
-            s1 = peg$c71(s1);
1623
+            s1 = peg$c90(s1);
1356 1624
             s0 = s1;
1357 1625
           } else {
1358 1626
             peg$currPos = s0;
... ...
@@ -1374,31 +1642,31 @@ p2c2 = (function() {
1374 1642
       var s0, s1, s2, s3;
1375 1643
 
1376 1644
       s0 = peg$currPos;
1377
-      if (input.substr(peg$currPos, 2) === peg$c72) {
1378
-        s1 = peg$c72;
1645
+      if (input.substr(peg$currPos, 2) === peg$c91) {
1646
+        s1 = peg$c91;
1379 1647
         peg$currPos += 2;
1380 1648
       } else {
1381 1649
         s1 = peg$FAILED;
1382
-        if (peg$silentFails === 0) { peg$fail(peg$c73); }
1650
+        if (peg$silentFails === 0) { peg$fail(peg$c92); }
1383 1651
       }
1384 1652
       if (s1 !== peg$FAILED) {
1385 1653
         s2 = [];
1386
-        if (peg$c74.test(input.charAt(peg$currPos))) {
1654
+        if (peg$c93.test(input.charAt(peg$currPos))) {
1387 1655
           s3 = input.charAt(peg$currPos);
1388 1656
           peg$currPos++;
1389 1657
         } else {
1390 1658
           s3 = peg$FAILED;
1391
-          if (peg$silentFails === 0) { peg$fail(peg$c75); }
1659
+          if (peg$silentFails === 0) { peg$fail(peg$c94); }
1392 1660
         }
1393 1661
         if (s3 !== peg$FAILED) {
1394 1662
           while (s3 !== peg$FAILED) {
1395 1663
             s2.push(s3);
1396
-            if (peg$c74.test(input.charAt(peg$currPos))) {
1664
+            if (peg$c93.test(input.charAt(peg$currPos))) {
1397 1665
               s3 = input.charAt(peg$currPos);
1398 1666
               peg$currPos++;
1399 1667
             } else {
1400 1668
               s3 = peg$FAILED;
1401
-              if (peg$silentFails === 0) { peg$fail(peg$c75); }
1669
+              if (peg$silentFails === 0) { peg$fail(peg$c94); }
1402 1670
             }
1403 1671
           }
1404 1672
         } else {
... ...
@@ -1406,15 +1674,15 @@ p2c2 = (function() {
1406 1674
         }
1407 1675
         if (s2 !== peg$FAILED) {
1408 1676
           if (input.charCodeAt(peg$currPos) === 93) {
1409
-            s3 = peg$c76;
1677
+            s3 = peg$c95;
1410 1678
             peg$currPos++;
1411 1679
           } else {
1412 1680
             s3 = peg$FAILED;
1413
-            if (peg$silentFails === 0) { peg$fail(peg$c77); }
1681
+            if (peg$silentFails === 0) { peg$fail(peg$c96); }
1414 1682
           }
1415 1683
           if (s3 !== peg$FAILED) {
1416 1684
             peg$savedPos = s0;
1417
-            s1 = peg$c78(s1, s2, s3);
1685
+            s1 = peg$c97(s1, s2, s3);
1418 1686
             s0 = s1;
1419 1687
           } else {
1420 1688
             peg$currPos = s0;
... ...
@@ -1435,12 +1703,12 @@ p2c2 = (function() {
1435 1703
     function peg$parsewhitespaces() {
1436 1704
       var s0, s1;
1437 1705
 
1438
-      if (peg$c79.test(input.charAt(peg$currPos))) {
1706
+      if (peg$c98.test(input.charAt(peg$currPos))) {
1439 1707
         s0 = input.charAt(peg$currPos);
1440 1708
         peg$currPos++;
1441 1709
       } else {
1442 1710
         s0 = peg$FAILED;
1443
-        if (peg$silentFails === 0) { peg$fail(peg$c80); }
1711
+        if (peg$silentFails === 0) { peg$fail(peg$c99); }
1444 1712
       }
1445 1713
       if (s0 === peg$FAILED) {
1446 1714
         s0 = peg$currPos;
1447 1715
deleted file mode 100644
... ...
@@ -1,113 +0,0 @@
1
-post
2
- = items:postItem*
3
- { return items.join(""); }
4
- 
5
-postItem
6
- = url
7
- / totoz
8
- / canard
9
- / bigorno
10
- / norloge
11
- / opentag
12
- / closetag
13
- / .
14
- 
15
-url
16
- = url:$((("http" "s"?) / "ftp") "://" [^ \t\r\n]+)
17
- {return '<url>' + url + '</url>'}
18
- 
19
-canard
20
-= ("\\_" teteCanard "<" / ">" teteCanard "_/")
21
- {return '<canard/>';}
22
- 
23
-teteCanard
24
- = [o0ô°øòó@]
25
- 
26
-
27
-opentag
28
- = $("<" tag ">")
29
- / invalidOpenTag
30
- 
31
-closetag
32
- = $("</" tag ">")
33
- / invalidCloseTag
34
- 
35
-invalidOpenTag
36
- = "<" tagName ">"
37
- { return ""; }
38
-
39
-invalidCloseTag
40
- = "</" tagName ">"
41
- { return ""; }
42
- 
43
-tagName
44
- = [A-Za-z] [^>]*
45
- 
46
-tag
47
- = ("a" / "b" / "i" / "s" / "u" / "tt")
48
-
49
-norloge
50
- = norlogeTime
51
- / norlogeId
52
- 
53
-norlogeTime
54
- = norloge:(fullNorloge / longNorloge / normalNorloge / shortNorloge)
55
- { return '<norloge>' + norloge +'</norloge>'}
56
-
57
-fullNorloge
58
- = y: norlogeYear "/" ln:longNorloge
59
- { return y + "/" + ln; }
60
- 
61
-norlogeYear
62
- = digits: [0-9]+
63
- { return digits.join(""); }
64
-
65
-longNorloge
66
- = m: norlogeMonth "/" d:norlogeDay "#" nn:normalNorloge
67
- { return m + "/" + d + "#" + nn; }
68
- 
69
-norlogeMonth
70
- = first: [0-1] last: [0-9]
71
- { return first + last; }
72
-
73
-norlogeDay
74
- = first: [0-3] last: [0-9]
75
- { return first + last; }
76
-
77
-normalNorloge
78
- = sn:shortNorloge ":" s:norlogeSeconds
79
- { return sn + ":" + s; }
80
- 
81
-shortNorloge
82
- = h:norlogeHours ":" m:norlogeMinutes
83
- { return h + ":" + m; }
84
-
85
-norlogeHours
86
- = first: [0-2] last: [0-3]
87
- { return first + last; }
88
- 
89
-norlogeMinutes
90
- = first: [0-5] last: [0-9]
91
- { return first + last; }
92
- 
93
-norlogeSeconds
94
- = first: [0-5] last: [0-9]
95
- { return first + last; }
96
-
97
-norlogeId =
98
- "#" chars:[a-zA-Z0-9_]+
99
- { var norlogeId = chars.join("");
100
-   return '<norloge-id>#' + norlogeId + '</norloge-id>';
101
-   }
102
-
103
-bigorno
104
- = bigorno:[a-zA-Z0-9-_]+ "<" &(whitespaces / [<[])
105
- { return [].concat('<bigorno>', bigorno,'</bigorno>').join("")}
106
-
107
-totoz
108
-  = first:"[:" totoz:[^\]]+ third:"]"
109
-  { var totozId = totoz.join(""); 
110
-  return '<totoz>' + totozId + '</totoz>'; }
111
-  
112
-whitespaces
113
- = [ \t\r\n] / !.
114 0
\ No newline at end of file
115 1
new file mode 100644
... ...
@@ -0,0 +1,134 @@
1
+post
2
+ = items:postItem*
3
+ { return items.join(""); }
4
+ 
5
+postItem
6
+ = url
7
+ / totoz
8
+ / canard
9
+ / bigorno
10
+ / norloge
11
+ / atag
12
+ / opentag
13
+ / closetag
14
+ / .
15
+ 
16
+url
17
+ = url:$((("http" "s"?) / "ftp") "://" [^ \t\r\n]+)
18
+ {return '<url>' + url + '</url>'}
19
+ 
20
+canard
21
+= ("\\_" teteCanard "<" / ">" teteCanard "_/")
22
+ {return '<canard/>';}
23
+ 
24
+teteCanard
25
+ = [o0ô°øòó@]
26
+
27
+opentag
28
+ = $("<" validFormatTag ">")
29
+ / invalidOpenTag
30
+
31
+validFormatTag
32
+ = ("b" / "i" / "s" / "u" / "tt")
33
+ 
34
+closetag
35
+ = $("</" validFormatTag ">")
36
+ / invalidCloseTag
37
+ 
38
+invalidOpenTag
39
+ = "<" invalidTag ">"
40
+ { return ""; }
41
+
42
+invalidCloseTag
43
+ = "</" invalidTag ">"
44
+ { return ""; }
45
+ 
46
+invalidTag
47
+ = [A-Za-z] [^>]*
48
+
49
+atag
50
+ = "<a" attributes:tagAttributes ">" [^<]* "</a>"
51
+ { 
52
+   if(attributes.href) {
53
+      return "<url>" + attributes.href + "</url>";
54
+   }
55
+ }
56
+ 
57
+tagAttributes
58
+ = attributes:(separator:" " attribute:tagAttribute { return attribute;})*
59
+ {  var result = {};
60
+ 	for(var a in attributes) {
61
+    	result[attributes[a].name] = attributes[a].value;
62
+    }
63
+ 	return result;
64
+ }
65
+
66
+tagAttribute
67
+ = name:$[a-z]+ value:("=\"" value:$[^"]* "\"" {return value;} )?
68
+ {return { name: name, value: value}}
69
+
70
+norloge
71
+ = norlogeTime
72
+ / norlogeId
73
+ 
74
+norlogeTime
75
+ = norloge:(fullNorloge / longNorloge / normalNorloge / shortNorloge)
76
+ { return '<norloge>' + norloge +'</norloge>'}
77
+
78
+fullNorloge
79
+ = y: norlogeYear "/" ln:longNorloge
80
+ { return y + "/" + ln; }
81
+ 
82
+norlogeYear
83
+ = digits: [0-9]+
84
+ { return digits.join(""); }
85
+
86
+longNorloge
87
+ = m: norlogeMonth "/" d:norlogeDay "#" nn:normalNorloge
88
+ { return m + "/" + d + "#" + nn; }
89
+ 
90
+norlogeMonth
91
+ = first: [0-1] last: [0-9]
92
+ { return first + last; }
93
+
94
+norlogeDay
95
+ = first: [0-3] last: [0-9]
96
+ { return first + last; }
97
+
98
+normalNorloge
99
+ = sn:shortNorloge ":" s:norlogeSeconds
100
+ { return sn + ":" + s; }
101
+ 
102
+shortNorloge
103
+ = h:norlogeHours ":" m:norlogeMinutes
104
+ { return h + ":" + m; }
105
+
106
+norlogeHours
107
+ = first: [0-2] last: [0-3]
108
+ { return first + last; }
109
+ 
110
+norlogeMinutes
111
+ = first: [0-5] last: [0-9]
112
+ { return first + last; }
113
+ 
114
+norlogeSeconds
115
+ = first: [0-5] last: [0-9]
116
+ { return first + last; }
117
+
118
+norlogeId =
119
+ "#" chars:[a-zA-Z0-9_]+
120
+ { var norlogeId = chars.join("");
121
+   return '<norloge-id>#' + norlogeId + '</norloge-id>';
122
+   }
123
+
124
+bigorno
125
+ = bigorno:[a-zA-Z0-9-_]+ "<" &(whitespaces / [<[])
126
+ { return [].concat('<bigorno>', bigorno,'</bigorno>').join("")}
127
+
128
+totoz
129
+  = first:"[:" totoz:[^\]]+ third:"]"
130
+  { var totozId = totoz.join(""); 
131
+  return '<totoz>' + totozId + '</totoz>'; }
132
+  
133
+whitespaces
134
+ = [ \t\r\n] / !.
0 135
\ No newline at end of file