tiddlywiki_cp 0.5.2 → 0.5.3

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.
@@ -1,7 +1,7 @@
1
- == 0.5.2 2008-04-08
1
+ == 0.5.3 2008-04-08
2
2
 
3
- * MarkupPostBody maps to POST-SCRIPT POST-BODY for
4
- tiddlywiki 2.2 and 2.3 compatibility
3
+ * MarkupPostBody maps POST-BODY to POST-SCRIPT for
4
+ tiddlywiki 2.3 and above compatibility
5
5
 
6
6
  == 0.5.1 2008-04-07
7
7
 
@@ -467,15 +467,15 @@ end
467
467
  class TiddlyWiki
468
468
 
469
469
  TIDDLER2MARKUP = {
470
- 'MarkupPreHead' => [ 'PRE-HEAD' ],
471
- 'MarkupPostHead' => [ 'POST-HEAD' ],
472
- 'MarkupPreBody' => [ 'PRE-BODY' ],
473
- 'MarkupPostBody' => [ 'POST-SCRIPT', 'POST-BODY' ],
470
+ 'MarkupPreHead' => 'PRE-HEAD',
471
+ 'MarkupPostHead' => 'POST-HEAD',
472
+ 'MarkupPreBody' => 'PRE-BODY',
473
+ 'MarkupPostBody' => 'POST-BODY',
474
474
  }
475
475
 
476
476
  @@lang_re = /<html(.*?)\s+xml:lang=['"](\w\w)['"]\s+lang=['"](\w\w)['"]/ms
477
477
 
478
- attr_accessor :orig_tiddlers, :tiddlers, :raw, :lang
478
+ attr_accessor :orig_tiddlers, :tiddlers, :raw, :lang, :version
479
479
 
480
480
  # doesn't do much. probably should allow an empty file param
481
481
  def initialize(use_pre=false)
@@ -483,6 +483,7 @@ class TiddlyWiki
483
483
  @tiddlers = []
484
484
  @core_hacks = []
485
485
  @lang = 'en'
486
+ @version = 21
486
487
  end
487
488
 
488
489
  # this should replace all the add_tiddler_from_blah methods
@@ -496,8 +497,10 @@ class TiddlyWiki
496
497
  end
497
498
 
498
499
  def use_pre_from_raw()
499
- if @raw =~ /var version = \{title: "TiddlyWiki", major: 2, minor: [2-9]/
500
+ matches = @raw.match(/var version = \{title: "TiddlyWiki", major: (2), minor: ([2-9])/)
501
+ if matches
500
502
  @use_pre = true
503
+ @version = matches[1].to_i * 10 + matches[2].to_i
501
504
  end
502
505
  end
503
506
 
@@ -724,11 +727,17 @@ class TiddlyWiki
724
727
  #
725
728
  @tiddlers.each do |t|
726
729
  if TIDDLER2MARKUP[t.name]
727
- TIDDLER2MARKUP[t.name].each do |markup|
728
- mstart = "<!--" + markup + "-START-->"
729
- mend = "<!--" + markup + "-END-->"
730
- add_core_hack(/#{mstart}.*#{mend}/m, "#{mstart}\n#{t.fields['text']}\n#{mend}")
730
+ markup = TIDDLER2MARKUP[t.name]
731
+ #
732
+ # in 2.3 POST-BODY was moved to POST-SCRIPT but POST-BODY
733
+ # markup is still present
734
+ #
735
+ if t.name == 'MarkupPostBody' && @version > 22
736
+ markup = 'POST-SCRIPT'
731
737
  end
738
+ mstart = "<!--" + markup + "-START-->"
739
+ mend = "<!--" + markup + "-END-->"
740
+ add_core_hack(/#{mstart}.*#{mend}/m, "#{mstart}\n#{t.fields['text']}\n#{mend}")
732
741
  end
733
742
  end
734
743
  pre_store_hacked = pre_store
@@ -17,7 +17,7 @@ module TiddlywikiCp #:nodoc:
17
17
  module VERSION #:nodoc:
18
18
  MAJOR = 0
19
19
  MINOR = 5
20
- TINY = 2
20
+ TINY = 3
21
21
 
22
22
  STRING = [MAJOR, MINOR, TINY].join('.')
23
23
  end
@@ -421,16 +421,13 @@ class TestTiddlywikiCp < Test::Unit::TestCase
421
421
  [ "#{this_dir(__FILE__)}/content/universe.html",
422
422
  "#{this_dir(__FILE__)}/content/2.3.0.html" ].each do |uri|
423
423
  tw = t.uri2tiddlywiki("#{uri}")
424
- TiddlyWiki::TIDDLER2MARKUP.each_pair do |tiddler, markups|
424
+ TiddlyWiki::TIDDLER2MARKUP.each_pair do |tiddler, markup|
425
425
  mark = "XXX#{tiddler}XXX"
426
426
  tw.add_tiddler_from({ 'tiddler' => tiddler, 'text' => mark})
427
- found = false
428
- markups.each do |markup|
429
- if tw.to_s =~ /#{markup}-START.*#{mark}.*#{markup}-END/sm
430
- found = true
431
- end
427
+ if tiddler == 'MarkupPostBody' && tw.version > 22
428
+ markup = 'POST-SCRIPT'
432
429
  end
433
- assert(found)
430
+ assert_match(/#{markup}-START.*#{mark}.*#{markup}-END/sm, tw.to_s)
434
431
  end
435
432
  end
436
433
  end
@@ -1,7 +1,12 @@
1
1
  {{{
2
- changeset: 82:cf485fdcffcd
2
+ changeset: 83:4e9381f267dd
3
3
  tag: tip
4
4
  user: root@dachary.org
5
+ date: Tue Apr 08 12:47:28 2008 +0000
6
+ summary: change strategy to handle POST-SCRIPT because the POST-BODY markup still exists in tw 2.3 and above
7
+
8
+ changeset: 82:cf485fdcffcd
9
+ user: root@dachary.org
5
10
  date: Tue Apr 08 11:55:27 2008 +0000
6
11
  summary: release 0.5.2
7
12
 
@@ -498,11 +498,16 @@ Also see AdvancedOptions</pre>
498
498
  </div>
499
499
  <!--POST-SHADOWAREA-->
500
500
  <div id="storeArea">
501
- <div title="ChangeLog" modifier="loic" modified="200804081159" created="200707211630" changecount="1">
501
+ <div title="ChangeLog" modifier="loic" modified="200804081248" created="200707211630" changecount="1">
502
502
  <pre>{{{
503
- changeset: 82:cf485fdcffcd
503
+ changeset: 83:4e9381f267dd
504
504
  tag: tip
505
505
  user: root@dachary.org
506
+ date: Tue Apr 08 12:47:28 2008 +0000
507
+ summary: change strategy to handle POST-SCRIPT because the POST-BODY markup still exists in tw 2.3 and above
508
+
509
+ changeset: 82:cf485fdcffcd
510
+ user: root@dachary.org
506
511
  date: Tue Apr 08 11:55:27 2008 +0000
507
512
  summary: release 0.5.2
508
513
 
@@ -1308,7 +1313,7 @@ config.macros.sparkline.handler = function(place,macroName,params)
1308
1313
  }
1309
1314
  //}}}</pre>
1310
1315
  </div>
1311
- <div title="Usage" modifier="loic" modified="200804081159" created="200707211620" changecount="1">
1316
+ <div title="Usage" modifier="loic" modified="200804081248" created="200707211620" changecount="1">
1312
1317
  <pre>{{{
1313
1318
  Usage: tiddlywiki_cp [options] FROM [FROM ...] TO|-
1314
1319
 
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: tiddlywiki_cp
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.2
6
+ version: 0.5.3
7
7
  date: 2008-04-08 00:00:00 +00:00
8
8
  summary: copy tiddlers to files and vice versa
9
9
  require_paths: