patcito-rdiscount 1.6.8 → 1.6.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.
data/ext/extconf.rb CHANGED
@@ -7,13 +7,8 @@ HAVE_SRANDOM = have_func('srandom')
7
7
  HAVE_RAND = have_func('rand')
8
8
  HAVE_SRAND = have_func('srand')
9
9
 
10
- def sized_int(size, types)
11
- types.find { |type| check_sizeof(type) == 4 } ||
12
- abort("no int with size #{size}")
13
- end
14
-
15
- DWORD = sized_int(4, ["unsigned long", "unsigned int"])
16
- WORD = sized_int(2, ["unsigned int", "unsigned short"])
10
+ DWORD = "unsigned long"
11
+ WORD = "unsigned short"
17
12
  BYTE = "unsigned char"
18
13
 
19
14
  $defs.push("-DDWORD='#{DWORD}'")
data/ext/generate.c CHANGED
@@ -1072,7 +1072,7 @@ smartypants(int c, int *flags, MMIOT *f)
1072
1072
  {
1073
1073
  int i;
1074
1074
 
1075
- if ( f->flags & (MKD_NOPANTS|MKD_TAGTEXT|IS_LABEL|MKD_MATH) )
1075
+ if ( f->flags & (MKD_NOPANTS|MKD_TAGTEXT|IS_LABEL) )
1076
1076
  return 0;
1077
1077
 
1078
1078
  for ( i=0; i < NRSMART; i++)
@@ -1140,53 +1140,13 @@ tickhandler(MMIOT *f, int tickchar, int minticks, spanhandler spanner)
1140
1140
  return 0;
1141
1141
  }
1142
1142
 
1143
- static int
1144
- ismathleft(MMIOT *f, int offset)
1145
- {
1146
- int i;
1147
-
1148
- while (peek(f,offset-1) == '$')
1149
- --offset;
1150
-
1151
- i = 1;
1152
- while (peek(f,offset-i) == '\\')
1153
- ++i;
1154
- if ( (i % 2) == 0 )
1155
- return 0;
1156
-
1157
- while (!isthisspace(f,offset-i)) {
1158
- if (isthisalnum(f,offset-i))
1159
- return 0;
1160
- ++i;
1161
- }
1162
-
1163
- return !isthisspace(f,offset+1);
1164
- }
1165
-
1166
- static int
1167
- ismathright(MMIOT *f, int offset)
1168
- {
1169
- int i;
1170
-
1171
- while (peek(f,offset+1) == '$')
1172
- ++offset;
1173
-
1174
- i = 1;
1175
- while (peek(f,offset-i) == '\\')
1176
- ++i;
1177
- if ( (i % 2) == 0 )
1178
- return 0;
1179
-
1180
- return !isthisalnum(f,offset+1);
1181
- }
1182
-
1183
- #define protected(f) (f->flags & (MKD_TAGTEXT|MKD_MATH))
1143
+ #define tag_text(f) (f->flags & MKD_TAGTEXT)
1184
1144
 
1185
1145
 
1186
1146
  static void
1187
1147
  text(MMIOT *f)
1188
1148
  {
1189
- int c, j, escape;
1149
+ int c, j;
1190
1150
  int rep;
1191
1151
  int smartyflags = 0;
1192
1152
 
@@ -1204,16 +1164,16 @@ text(MMIOT *f)
1204
1164
  switch (c) {
1205
1165
  case 0: break;
1206
1166
 
1207
- case 3: Qstring(protected(f) ? " " : "<br/>", f);
1167
+ case 3: Qstring(tag_text(f) ? " " : "<br/>", f);
1208
1168
  break;
1209
1169
 
1210
- case '>': if ( protected(f) )
1170
+ case '>': if ( tag_text(f) )
1211
1171
  Qstring("&gt;", f);
1212
1172
  else
1213
1173
  Qchar(c, f);
1214
1174
  break;
1215
1175
 
1216
- case '"': if ( protected(f) )
1176
+ case '"': if ( tag_text(f) )
1217
1177
  Qstring("&quot;", f);
1218
1178
  else
1219
1179
  Qchar(c, f);
@@ -1221,17 +1181,17 @@ text(MMIOT *f)
1221
1181
 
1222
1182
  case '!': if ( peek(f,1) == '[' ) {
1223
1183
  pull(f);
1224
- if ( protected(f) || !linkylinky(1, f) )
1184
+ if ( tag_text(f) || !linkylinky(1, f) )
1225
1185
  Qstring("![", f);
1226
1186
  }
1227
1187
  else
1228
1188
  Qchar(c, f);
1229
1189
  break;
1230
- case '[': if ( protected(f) || !linkylinky(0, f) )
1190
+ case '[': if ( tag_text(f) || !linkylinky(0, f) )
1231
1191
  Qchar(c, f);
1232
1192
  break;
1233
1193
  /* A^B -> A<sup>B</sup> */
1234
- case '^': if ( (f->flags & (MKD_NOSUPERSCRIPT|MKD_STRICT|MKD_TAGTEXT|MKD_MATH))
1194
+ case '^': if ( (f->flags & (MKD_NOSUPERSCRIPT|MKD_STRICT|MKD_TAGTEXT))
1235
1195
  || (isthisnonword(f,-1) && peek(f,-1) != ')')
1236
1196
  || isthisspace(f,1) )
1237
1197
  Qchar(c,f);
@@ -1280,7 +1240,7 @@ text(MMIOT *f)
1280
1240
  break;
1281
1241
  }
1282
1242
  /* else fall into the regular old emphasis case */
1283
- if ( protected(f) )
1243
+ if ( tag_text(f) )
1284
1244
  Qchar(c, f);
1285
1245
  else {
1286
1246
  for (rep = 1; peek(f,1) == c; pull(f) )
@@ -1289,37 +1249,11 @@ text(MMIOT *f)
1289
1249
  }
1290
1250
  break;
1291
1251
 
1292
- case '$':
1293
- if ( (f->flags & MKD_PROTECTMATH) && !(f->flags & MKD_TAGTEXT)) {
1294
- escape = 1;
1295
- for (j = 1; peek(f,j) == '$';)
1296
- ++j;
1297
- if ( ismathleft(f,j-1) ) {
1298
- for (; (c = peek(f,j)) != EOF; j++) {
1299
- if ((c == '\n' && peek(f,j+1) == '\n')
1300
- || (c == '$' && ismathleft(f,j)))
1301
- break;
1302
- if (c == '$' && ismathright(f,j)) {
1303
- escape = 0;
1304
- f->flags |= MKD_MATH;
1305
- break;
1306
- }
1307
- }
1308
- } else if ( ismathright(f,j-1) ) {
1309
- escape = 0;
1310
- f->flags &= ~MKD_MATH;
1311
- }
1312
- if (escape)
1313
- Qchar('\\', f);
1314
- }
1315
- Qchar('$', f);
1316
- break;
1317
-
1318
- case '~': if ( (f->flags & (MKD_NOSTRIKETHROUGH|MKD_TAGTEXT|MKD_STRICT|MKD_MATH)) || !tickhandler(f,c,2,delspan) )
1252
+ case '~': if ( (f->flags & (MKD_NOSTRIKETHROUGH|MKD_TAGTEXT|MKD_STRICT)) || !tickhandler(f,c,2,delspan) )
1319
1253
  Qchar(c, f);
1320
1254
  break;
1321
1255
 
1322
- case '`': if ( protected(f) || !tickhandler(f,c,1,codespan) )
1256
+ case '`': if ( tag_text(f) || !tickhandler(f,c,1,codespan) )
1323
1257
  Qchar(c, f);
1324
1258
  break;
1325
1259
 
data/ext/markdown.h CHANGED
@@ -98,10 +98,8 @@ typedef struct mmiot {
98
98
  #define MKD_NODIVQUOTE 0x00040000
99
99
  #define MKD_NOALPHALIST 0x00080000
100
100
  #define MKD_NODLIST 0x00100000
101
- #define MKD_PROTECTMATH 0x00200000
102
101
  #define IS_LABEL 0x08000000
103
- #define MKD_MATH 0x10000000
104
- #define USER_FLAGS 0x1FFFFFFF
102
+ #define USER_FLAGS 0x0FFFFFFF
105
103
  #define INPUT_MASK (MKD_NOHEADER|MKD_TABSTOP)
106
104
 
107
105
  Callback_data *cb;
data/ext/mkdio.h CHANGED
@@ -91,7 +91,7 @@ extern char markdown_version[];
91
91
  #define MKD_NODIVQUOTE 0x00040000 /* forbid >%class% blocks */
92
92
  #define MKD_NOALPHALIST 0x00080000 /* forbid alphabetic lists */
93
93
  #define MKD_NODLIST 0x00100000 /* forbid definition lists */
94
- #define MKD_PROTECTMATH 0x00200000 /* forbid definition lists */
94
+ #define MKD_PROTECTMATH 0x00200000 /* treat dollar signs as math */
95
95
  #define MKD_EMBED MKD_NOLINKS|MKD_NOIMAGE|MKD_TAGTEXT
96
96
 
97
97
  /* special flags for mkd_in() and mkd_string()
data/rdiscount.gemspec CHANGED
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'patcito-rdiscount'
3
- s.version = '1.6.8'
3
+ s.version = '1.6.9'
4
4
  s.summary = "Fast Implementation of Gruber's Markdown in C"
5
5
  s.date = '2011-01-25'
6
6
  s.email = 'rtomayko@gmail.com'
7
- s.homepage = 'http://github.com/patcito/rdiscount'
7
+ s.homepage = 'http://github.com/rtomayko/rdiscount'
8
8
  s.authors = ["Ryan Tomayko", "David Loren Parsons", "Andrew White"]
9
9
  # = MANIFEST =
10
10
  s.files = %w[
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patcito-rdiscount
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.8
4
+ version: 1.6.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -59,7 +59,7 @@ files:
59
59
  - test/benchmark.txt
60
60
  - test/markdown_test.rb
61
61
  - test/rdiscount_test.rb
62
- homepage: http://github.com/patcito/rdiscount
62
+ homepage: http://github.com/rtomayko/rdiscount
63
63
  licenses: []
64
64
  post_install_message:
65
65
  rdoc_options: []