Wiki2Go 1.14.0 → 1.14.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.
@@ -5,7 +5,7 @@ require 'fileutils'
5
5
  require 'optparse'
6
6
 
7
7
  require 'rubygems'
8
- WIKI2GO_VERSION = '0.1.14'
8
+ WIKI2GO_VERSION = '1.14'
9
9
  require_gem "Wiki2Go","=#{WIKI2GO_VERSION}"
10
10
 
11
11
  require 'Wiki2Go/PublicWikiConfig'
@@ -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
- return append(format_wiki_markup(before),format_tag(match),format_wiki_markup(after))
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 = escape_wiki_markers(line)
356
-
357
- if line =~ /^(.*)\{([^\}]*)\}(.*)$/ then
358
- before,match,after = $1,$2,$3
359
- line = append(format_wiki_markup(before),format_forced_link(match),format_wiki_markup(after))
360
- elsif line =~ /^(.*)\%([^\%]*)\%(.*)$/ then
361
- before,match,after = $1,$2,$3
362
- line = append(format_wiki_markup(before),format_forced_link(match),format_wiki_markup(after))
363
- elsif line =~ /^(.*)((http|ftp|gopher|news|https)\:(\w|\/|\.|_|-|\?|\=|&|;|\~|#|,)+)(.*)$/ then
364
- before,match,after = $1,$2,$5
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(/~/ ,'&tilde;')
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 formatMarkup(line)
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>")
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.3
3
3
  specification_version: 1
4
4
  name: Wiki2Go
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.14.0
7
- date: 2005-06-05
6
+ version: 1.14.1
7
+ date: 2005-06-08
8
8
  summary: Wiki2Go is a Ruby Wiki
9
9
  require_paths:
10
10
  - lib