commonmarker 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of commonmarker might be problematic. Click here for more details.
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: fd465d3c630c43a890eee8ec949fccf4eabb5997
         | 
| 4 | 
            +
              data.tar.gz: e9932c4d91ef3479c9635276a634ce1da089b4b3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 58d1456c8e6da1b8b7288303570acbe467daf61402965fca54f0bc2f9f4c922a4edc19c7be25743b702b8a7fd0b0911742935498918e9044ebedeb89fd5cdcb3
         | 
| 7 | 
            +
              data.tar.gz: 0c9d4f55d0326a1bf9830aea8f98b917c2f4fd3ea828bdfbebfdb2dd9063841b538d61228d7ae3ac7dc02b411d6562029d89e78f3a260090e3023c0238bd75d9
         | 
| @@ -19,7 +19,7 @@ set(PROJECT_NAME "cmark") | |
| 19 19 | 
             
            set(PROJECT_VERSION_MAJOR 0)
         | 
| 20 20 | 
             
            set(PROJECT_VERSION_MINOR 28)
         | 
| 21 21 | 
             
            set(PROJECT_VERSION_PATCH 0)
         | 
| 22 | 
            -
            set(PROJECT_VERSION_GFM  | 
| 22 | 
            +
            set(PROJECT_VERSION_GFM 9)
         | 
| 23 23 | 
             
            set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.gfm.${PROJECT_VERSION_GFM} )
         | 
| 24 24 |  | 
| 25 25 | 
             
            option(CMARK_TESTS "Build cmark tests and enable testing" ON)
         | 
| @@ -934,176 +934,59 @@ static void test_feed_across_line_ending(test_batch_runner *runner) { | |
| 934 934 | 
             
              cmark_node_free(document);
         | 
| 935 935 | 
             
            }
         | 
| 936 936 |  | 
| 937 | 
            -
             | 
| 938 | 
            -
               | 
| 939 | 
            -
             | 
| 940 | 
            -
             | 
| 941 | 
            -
             | 
| 942 | 
            -
             | 
| 943 | 
            -
             | 
| 944 | 
            -
             | 
| 945 | 
            -
             | 
| 946 | 
            -
             | 
| 947 | 
            -
             | 
| 948 | 
            -
             | 
| 949 | 
            -
             | 
| 950 | 
            -
               | 
| 951 | 
            -
             | 
| 952 | 
            -
               | 
| 953 | 
            -
             | 
| 954 | 
            -
             | 
| 955 | 
            -
             | 
| 956 | 
            -
             | 
| 957 | 
            -
             | 
| 958 | 
            -
             | 
| 959 | 
            -
             | 
| 960 | 
            -
             | 
| 961 | 
            -
             | 
| 962 | 
            -
             | 
| 963 | 
            -
             | 
| 964 | 
            -
             | 
| 965 | 
            -
             | 
| 966 | 
            -
             | 
| 967 | 
            -
             | 
| 968 | 
            -
             | 
| 969 | 
            -
             | 
| 970 | 
            -
             | 
| 971 | 
            -
                                  "    <link sourcepos=\"4:15-4:41\" destination=\"www.google.com\" title=\"ok\">\n"
         | 
| 972 | 
            -
                                  "      <text sourcepos=\"4:16-4:19\">okay</text>\n"
         | 
| 973 | 
            -
                                  "    </link>\n"
         | 
| 974 | 
            -
                                  "    <text sourcepos=\"4:42-4:42\">.</text>\n"
         | 
| 975 | 
            -
                                  "  </paragraph>\n"
         | 
| 976 | 
            -
                                  "  <block_quote sourcepos=\"6:1-10:20\">\n"
         | 
| 977 | 
            -
                                  "    <list sourcepos=\"6:3-10:20\" type=\"ordered\" start=\"1\" delim=\"period\" tight=\"false\">\n"
         | 
| 978 | 
            -
                                  "      <item sourcepos=\"6:3-8:1\">\n"
         | 
| 979 | 
            -
                                  "        <paragraph sourcepos=\"6:6-7:10\">\n"
         | 
| 980 | 
            -
                                  "          <text sourcepos=\"6:6-6:10\">Okay.</text>\n"
         | 
| 981 | 
            -
                                  "          <softbreak />\n"
         | 
| 982 | 
            -
                                  "          <text sourcepos=\"7:6-7:10\">Sure.</text>\n"
         | 
| 983 | 
            -
                                  "        </paragraph>\n"
         | 
| 984 | 
            -
                                  "      </item>\n"
         | 
| 985 | 
            -
                                  "      <item sourcepos=\"9:3-10:20\">\n"
         | 
| 986 | 
            -
                                  "        <paragraph sourcepos=\"9:6-10:20\">\n"
         | 
| 987 | 
            -
                                  "          <text sourcepos=\"9:6-9:15\">Yes, okay.</text>\n"
         | 
| 988 | 
            -
                                  "          <softbreak />\n"
         | 
| 989 | 
            -
                                  "          <image sourcepos=\"10:6-10:20\" destination=\"hi\" title=\"yes\">\n"
         | 
| 990 | 
            -
                                  "            <text sourcepos=\"10:8-10:9\">ok</text>\n"
         | 
| 991 | 
            -
                                  "          </image>\n"
         | 
| 992 | 
            -
                                  "        </paragraph>\n"
         | 
| 993 | 
            -
                                  "      </item>\n"
         | 
| 994 | 
            -
                                  "    </list>\n"
         | 
| 995 | 
            -
                                  "  </block_quote>\n"
         | 
| 996 | 
            -
                                  "</document>\n",
         | 
| 997 | 
            -
                     "sourcepos are as expected");
         | 
| 998 | 
            -
              free(xml);
         | 
| 999 | 
            -
              cmark_node_free(doc);
         | 
| 1000 | 
            -
            }
         | 
| 1001 | 
            -
             | 
| 1002 | 
            -
            static void ext_source_pos(test_batch_runner *runner) {
         | 
| 1003 | 
            -
              static const char *extensions[3] = {
         | 
| 1004 | 
            -
                "strikethrough",
         | 
| 1005 | 
            -
                "table",
         | 
| 1006 | 
            -
                "autolink",
         | 
| 1007 | 
            -
              };
         | 
| 1008 | 
            -
             | 
| 1009 | 
            -
              static const char markdown[] =
         | 
| 1010 | 
            -
                "Hi ~~friend~~.\n"
         | 
| 1011 | 
            -
                "\n"
         | 
| 1012 | 
            -
                "> www.github.com\n"
         | 
| 1013 | 
            -
                "\n"
         | 
| 1014 | 
            -
                "1. | a | b | *c* |\n"
         | 
| 1015 | 
            -
                "   | - | - | --: |\n"
         | 
| 1016 | 
            -
                "   | 1 | 2 | ~3~ |\n";
         | 
| 1017 | 
            -
             | 
| 1018 | 
            -
              cmark_parser *parser = cmark_parser_new(CMARK_OPT_DEFAULT);
         | 
| 1019 | 
            -
              core_extensions_ensure_registered();
         | 
| 937 | 
            +
            #if !defined(_WIN32) || defined(__CYGWIN__)
         | 
| 938 | 
            +
            #  include <sys/time.h>
         | 
| 939 | 
            +
            static struct timeval _before, _after;
         | 
| 940 | 
            +
            static int _timing;
         | 
| 941 | 
            +
            #  define START_TIMING() \
         | 
| 942 | 
            +
                   gettimeofday(&_before, NULL)
         | 
| 943 | 
            +
             | 
| 944 | 
            +
            #  define END_TIMING() \
         | 
| 945 | 
            +
                    do { \
         | 
| 946 | 
            +
                      gettimeofday(&_after, NULL); \
         | 
| 947 | 
            +
                      _timing = (_after.tv_sec - _before.tv_sec) * 1000 + (_after.tv_usec - _before.tv_usec) / 1000; \
         | 
| 948 | 
            +
                    } while (0)
         | 
| 949 | 
            +
             | 
| 950 | 
            +
            #  define TIMING _timing
         | 
| 951 | 
            +
            #else
         | 
| 952 | 
            +
            #  define START_TIMING()
         | 
| 953 | 
            +
            #  define END_TIMING()
         | 
| 954 | 
            +
            #  define TIMING 0
         | 
| 955 | 
            +
            #endif
         | 
| 956 | 
            +
             | 
| 957 | 
            +
            static void test_pathological_regressions(test_batch_runner *runner) {
         | 
| 958 | 
            +
              {
         | 
| 959 | 
            +
                // I don't care what the output is, so long as it doesn't take too long.
         | 
| 960 | 
            +
                char path[] = "[a](b";
         | 
| 961 | 
            +
                char *input = (char *)calloc(1, (sizeof(path) - 1) * 50000);
         | 
| 962 | 
            +
                for (int i = 0; i < 50000; ++i)
         | 
| 963 | 
            +
                  memcpy(input + i * (sizeof(path) - 1), path, sizeof(path) - 1);
         | 
| 964 | 
            +
             | 
| 965 | 
            +
                START_TIMING();
         | 
| 966 | 
            +
                char *html = cmark_markdown_to_html(input, (sizeof(path) - 1) * 50000,
         | 
| 967 | 
            +
                                                    CMARK_OPT_VALIDATE_UTF8);
         | 
| 968 | 
            +
                END_TIMING();
         | 
| 969 | 
            +
                free(html);
         | 
| 970 | 
            +
                free(input);
         | 
| 1020 971 |  | 
| 1021 | 
            -
             | 
| 1022 | 
            -
                cmark_syntax_extension *ext = cmark_find_syntax_extension(extensions[i]);
         | 
| 1023 | 
            -
                cmark_parser_attach_syntax_extension(parser, ext);
         | 
| 972 | 
            +
                OK(runner, TIMING < 1000, "takes less than 1000ms to run");
         | 
| 1024 973 | 
             
              }
         | 
| 1025 974 |  | 
| 1026 | 
            -
               | 
| 1027 | 
            -
             | 
| 1028 | 
            -
             | 
| 1029 | 
            -
             | 
| 1030 | 
            -
             | 
| 1031 | 
            -
                                  "<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n"
         | 
| 1032 | 
            -
                                  "<document sourcepos=\"1:1-7:18\" xmlns=\"http://commonmark.org/xml/1.0\">\n"
         | 
| 1033 | 
            -
                                  "  <paragraph sourcepos=\"1:1-1:14\">\n"
         | 
| 1034 | 
            -
                                  "    <text sourcepos=\"1:1-1:3\">Hi </text>\n"
         | 
| 1035 | 
            -
                                  "    <strikethrough sourcepos=\"1:4-1:13\">\n"
         | 
| 1036 | 
            -
                                  "      <text sourcepos=\"1:6-1:11\">friend</text>\n"
         | 
| 1037 | 
            -
                                  "    </strikethrough>\n"
         | 
| 1038 | 
            -
                                  "    <text sourcepos=\"1:14-1:14\">.</text>\n"
         | 
| 1039 | 
            -
                                  "  </paragraph>\n"
         | 
| 1040 | 
            -
                                  "  <block_quote sourcepos=\"3:1-3:16\">\n"
         | 
| 1041 | 
            -
                                  "    <paragraph sourcepos=\"3:3-3:16\">\n"
         | 
| 1042 | 
            -
                                  "      <link sourcepos=\"3:2-3:16\" destination=\"http://www.github.com\" title=\"\">\n"
         | 
| 1043 | 
            -
                                  "        <text sourcepos=\"3:2-3:16\">www.github.com</text>\n"
         | 
| 1044 | 
            -
                                  "      </link>\n"
         | 
| 1045 | 
            -
                                  "    </paragraph>\n"
         | 
| 1046 | 
            -
                                  "  </block_quote>\n"
         | 
| 1047 | 
            -
            		      "  <list sourcepos=\"5:1-7:18\" type=\"ordered\" start=\"1\" delim=\"period\" tight=\"true\">\n"
         | 
| 1048 | 
            -
            		      "    <item sourcepos=\"5:1-7:18\">\n"
         | 
| 1049 | 
            -
                                  "      <table sourcepos=\"5:4-7:18\">\n"
         | 
| 1050 | 
            -
                                  "        <table_header sourcepos=\"5:4-5:18\">\n"
         | 
| 1051 | 
            -
                                  "          <table_cell sourcepos=\"5:5-5:7\">\n"
         | 
| 1052 | 
            -
                                  "            <text sourcepos=\"5:6-5:6\">a</text>\n"
         | 
| 1053 | 
            -
                                  "          </table_cell>\n"
         | 
| 1054 | 
            -
                                  "          <table_cell sourcepos=\"5:9-5:11\">\n"
         | 
| 1055 | 
            -
                                  "            <text sourcepos=\"5:10-5:10\">b</text>\n"
         | 
| 1056 | 
            -
                                  "          </table_cell>\n"
         | 
| 1057 | 
            -
                                  "          <table_cell sourcepos=\"5:13-5:17\">\n"
         | 
| 1058 | 
            -
                                  "            <emph sourcepos=\"5:14-5:16\">\n"
         | 
| 1059 | 
            -
                                  "              <text sourcepos=\"5:15-5:15\">c</text>\n"
         | 
| 1060 | 
            -
                                  "            </emph>\n"
         | 
| 1061 | 
            -
                                  "          </table_cell>\n"
         | 
| 1062 | 
            -
                                  "        </table_header>\n"
         | 
| 1063 | 
            -
                                  "        <table_row sourcepos=\"7:4-7:18\">\n"
         | 
| 1064 | 
            -
                                  "          <table_cell sourcepos=\"7:5-7:7\">\n"
         | 
| 1065 | 
            -
                                  "            <text sourcepos=\"7:6-7:6\">1</text>\n"
         | 
| 1066 | 
            -
                                  "          </table_cell>\n"
         | 
| 1067 | 
            -
                                  "          <table_cell sourcepos=\"7:9-7:11\">\n"
         | 
| 1068 | 
            -
                                  "            <text sourcepos=\"7:10-7:10\">2</text>\n"
         | 
| 1069 | 
            -
                                  "          </table_cell>\n"
         | 
| 1070 | 
            -
                                  "          <table_cell sourcepos=\"7:13-7:17\">\n"
         | 
| 1071 | 
            -
                                  "            <strikethrough sourcepos=\"7:14-7:16\">\n"
         | 
| 1072 | 
            -
                                  "              <text sourcepos=\"7:15-7:15\">3</text>\n"
         | 
| 1073 | 
            -
                                  "            </strikethrough>\n"
         | 
| 1074 | 
            -
                                  "          </table_cell>\n"
         | 
| 1075 | 
            -
                                  "        </table_row>\n"
         | 
| 1076 | 
            -
                                  "      </table>\n"
         | 
| 1077 | 
            -
            		      "    </item>\n"
         | 
| 1078 | 
            -
            		      "  </list>\n"
         | 
| 1079 | 
            -
                                  "</document>\n",
         | 
| 1080 | 
            -
                     "sourcepos are as expected");
         | 
| 1081 | 
            -
              free(xml);
         | 
| 1082 | 
            -
              cmark_node_free(doc);
         | 
| 1083 | 
            -
            }
         | 
| 975 | 
            +
              {
         | 
| 976 | 
            +
                char path[] = "[a](<b";
         | 
| 977 | 
            +
                char *input = (char *)calloc(1, (sizeof(path) - 1) * 50000);
         | 
| 978 | 
            +
                for (int i = 0; i < 50000; ++i)
         | 
| 979 | 
            +
                  memcpy(input + i * (sizeof(path) - 1), path, sizeof(path) - 1);
         | 
| 1084 980 |  | 
| 1085 | 
            -
             | 
| 1086 | 
            -
             | 
| 1087 | 
            -
             | 
| 1088 | 
            -
                 | 
| 1089 | 
            -
                 | 
| 981 | 
            +
                START_TIMING();
         | 
| 982 | 
            +
                char *html = cmark_markdown_to_html(input, (sizeof(path) - 1) * 50000,
         | 
| 983 | 
            +
                                                    CMARK_OPT_VALIDATE_UTF8);
         | 
| 984 | 
            +
                END_TIMING();
         | 
| 985 | 
            +
                free(html);
         | 
| 986 | 
            +
                free(input);
         | 
| 1090 987 |  | 
| 1091 | 
            -
             | 
| 1092 | 
            -
               | 
| 1093 | 
            -
              STR_EQ(runner, xml, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
         | 
| 1094 | 
            -
                                  "<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n"
         | 
| 1095 | 
            -
                                  "<document sourcepos=\"1:1-3:40\" xmlns=\"http://commonmark.org/xml/1.0\">\n"
         | 
| 1096 | 
            -
                                  "  <paragraph sourcepos=\"1:1-1:28\">\n"
         | 
| 1097 | 
            -
                                  "    <text sourcepos=\"1:1-1:10\">Let's try </text>\n"
         | 
| 1098 | 
            -
                                  "    <link sourcepos=\"1:11-1:21\" destination=\"https://github.com\" title=\"GitHub\">\n"
         | 
| 1099 | 
            -
                                  "      <text sourcepos=\"1:12-1:20\">reference</text>\n"
         | 
| 1100 | 
            -
                                  "    </link>\n"
         | 
| 1101 | 
            -
                                  "    <text sourcepos=\"1:22-1:28\"> links.</text>\n"
         | 
| 1102 | 
            -
                                  "  </paragraph>\n"
         | 
| 1103 | 
            -
                                  "</document>\n",
         | 
| 1104 | 
            -
                     "sourcepos are as expected");
         | 
| 1105 | 
            -
              free(xml);
         | 
| 1106 | 
            -
              cmark_node_free(doc);
         | 
| 988 | 
            +
                OK(runner, TIMING < 1000, "takes less than 1000ms to run");
         | 
| 989 | 
            +
              }
         | 
| 1107 990 | 
             
            }
         | 
| 1108 991 |  | 
| 1109 992 | 
             
            int main() {
         | 
| @@ -1132,9 +1015,7 @@ int main() { | |
| 1132 1015 | 
             
              test_cplusplus(runner);
         | 
| 1133 1016 | 
             
              test_safe(runner);
         | 
| 1134 1017 | 
             
              test_feed_across_line_ending(runner);
         | 
| 1135 | 
            -
               | 
| 1136 | 
            -
              ext_source_pos(runner);
         | 
| 1137 | 
            -
              ref_source_pos(runner);
         | 
| 1018 | 
            +
              test_pathological_regressions(runner);
         | 
| 1138 1019 |  | 
| 1139 1020 | 
             
              test_print_summary(runner);
         | 
| 1140 1021 | 
             
              retval = test_ok(runner) ? 0 : 1;
         | 
| @@ -119,7 +119,7 @@ static cmark_chunk chunk_clone(cmark_mem *mem, cmark_chunk *src) { | |
| 119 119 | 
             
              c.data = (unsigned char *)mem->calloc(len + 1, 1);
         | 
| 120 120 | 
             
              c.alloc = 1;
         | 
| 121 121 | 
             
              if (len)
         | 
| 122 | 
            -
             | 
| 122 | 
            +
                memcpy(c.data, src->data, len);
         | 
| 123 123 | 
             
              c.data[len] = '\0';
         | 
| 124 124 |  | 
| 125 125 | 
             
              return c;
         | 
    
        data/lib/commonmarker/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: commonmarker
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.17. | 
| 4 | 
            +
              version: 0.17.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Garen Torikian
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2017- | 
| 12 | 
            +
            date: 2017-09-06 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: ruby-enum
         |