Wiki2Go 1.14.0 → 1.14.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/Wiki2Go/Install/make_site.rb +1 -1
- data/lib/Wiki2Go/WikiFormatter.rb +36 -28
- metadata +2 -2
@@ -348,36 +348,34 @@ module Wiki2Go
|
|
348
348
|
end
|
349
349
|
|
350
350
|
def format_wiki_markup(line)
|
351
|
+
line = escape_wiki_markers(line)
|
352
|
+
|
351
353
|
if line =~ /^(.*)<(\S.*)\>(.*)$/ then
|
352
354
|
before,match,after = $1,$2,$3
|
353
|
-
|
355
|
+
line = append(format_wiki_markup(before),escape_url_markers(format_tag(match)),format_wiki_markup(after))
|
356
|
+
elsif line =~ /^(.*)\{([^\}]*)\}(.*)$/ then
|
357
|
+
before,match,after = $1,$2,$3
|
358
|
+
line = append(format_wiki_markup(before),escape_url_markers(format_forced_link(match)),format_wiki_markup(after))
|
359
|
+
elsif line =~ /^(.*)\%([^\%]*)\%(.*)$/ then
|
360
|
+
before,match,after = $1,$2,$3
|
361
|
+
line = append(format_wiki_markup(before),escape_url_markers(format_forced_link(match)),format_wiki_markup(after))
|
362
|
+
elsif line =~ /^(.*)((http|ftp|gopher|news|https)\:(\w|\/|\.|_|-|\?|\=|&|;|\~|#|,)+)(.*)$/ then
|
363
|
+
before,match,after = $1,$2,$5
|
364
|
+
line = append(format_wiki_markup(before),escape_url_markers(external_link(match)),format_wiki_markup(after))
|
365
|
+
elsif line =~ /^(.*)mailto\:([a-zA-Z0-9\-\_\.]+@[a-zA-Z0-9\-\_\.]+)(.*)$/ then
|
366
|
+
before,match,after = $1,$2,$3
|
367
|
+
line = append(format_wiki_markup(before),escape_url_markers(encode_mail_to(match)),format_wiki_markup(after))
|
354
368
|
else
|
355
|
-
line =
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
line = append(format_wiki_markup(before),external_link(match),format_wiki_markup(after))
|
366
|
-
elsif line =~ /^(.*)mailto\:([a-zA-Z0-9\-\_\.]+@[a-zA-Z0-9\-\_\.]+)(.*)$/ then
|
367
|
-
before,match,after = $1,$2,$3
|
368
|
-
line = append(format_wiki_markup(before),encode_mail_to(match),format_wiki_markup(after))
|
369
|
-
else
|
370
|
-
line = format_brackets(line)
|
371
|
-
line = format_entities(line)
|
372
|
-
line = format_bullets(line)
|
373
|
-
line = formatMarkup(line)
|
374
|
-
line = format_table(line)
|
375
|
-
line = recognize_wiki_words(line)
|
376
|
-
end
|
377
|
-
line = remove_markers(line)
|
378
|
-
return line
|
379
|
-
end
|
380
|
-
end
|
369
|
+
line = format_brackets(line)
|
370
|
+
line = format_entities(line)
|
371
|
+
line = recognize_wiki_words(line)
|
372
|
+
end
|
373
|
+
line = format_bullets(line)
|
374
|
+
line = format_markup(line)
|
375
|
+
line = format_table(line)
|
376
|
+
line = remove_markers(line)
|
377
|
+
return line
|
378
|
+
end
|
381
379
|
|
382
380
|
def formatted_output(line)
|
383
381
|
output = @pre_line + line + @post_line
|
@@ -401,6 +399,16 @@ module Wiki2Go
|
|
401
399
|
line = line.gsub(/\}\}/,"&closingbrace;")
|
402
400
|
end
|
403
401
|
|
402
|
+
def escape_url_markers(line)
|
403
|
+
line = line.gsub(/%/ ,'&percent;')
|
404
|
+
line = line.gsub(/\{/,'&openingbrace;')
|
405
|
+
line = line.gsub(/\}/,'&closingbrace;')
|
406
|
+
line = line.gsub(/~/ ,'˜')
|
407
|
+
line = line.gsub(/\*/,'&asterisk;')
|
408
|
+
line = line.gsub(/_/ ,'&underscore;')
|
409
|
+
return line
|
410
|
+
end
|
411
|
+
|
404
412
|
def remove_markers(line)
|
405
413
|
line = line.gsub(/&percent;/,"%")
|
406
414
|
line = line.gsub(/&openingbrace;/,"{")
|
@@ -428,7 +436,7 @@ module Wiki2Go
|
|
428
436
|
return line
|
429
437
|
end
|
430
438
|
|
431
|
-
def
|
439
|
+
def format_markup(line)
|
432
440
|
line = line.gsub(/\*\*([^\*]*)\*\*/,"<h2>\\1<\/h2>")
|
433
441
|
line = line.gsub(/\*([^\*]+)\*/,"<STRONG>\\1<\/STRONG>")
|
434
442
|
line = line.gsub(/\b_([^_]*)_/,"<EM>\\1<\/EM>")
|