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.
- data/History.txt +3 -3
- data/lib/tiddlywiki_cp/r4tw.rb +19 -10
- data/lib/tiddlywiki_cp/version.rb +1 -1
- data/test/test_tiddlywiki_cp.rb +4 -7
- data/website/files/ChangeLog.tiddler +6 -1
- data/website/index.html +8 -3
- metadata +1 -1
data/History.txt
CHANGED
data/lib/tiddlywiki_cp/r4tw.rb
CHANGED
@@ -467,15 +467,15 @@ end
|
|
467
467
|
class TiddlyWiki
|
468
468
|
|
469
469
|
TIDDLER2MARKUP = {
|
470
|
-
'MarkupPreHead' =>
|
471
|
-
'MarkupPostHead' =>
|
472
|
-
'MarkupPreBody' =>
|
473
|
-
'MarkupPostBody' =>
|
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
|
-
|
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]
|
728
|
-
|
729
|
-
|
730
|
-
|
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
|
data/test/test_tiddlywiki_cp.rb
CHANGED
@@ -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,
|
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
|
-
|
428
|
-
|
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
|
-
|
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:
|
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
|
|
data/website/index.html
CHANGED
@@ -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="
|
501
|
+
<div title="ChangeLog" modifier="loic" modified="200804081248" created="200707211630" changecount="1">
|
502
502
|
<pre>{{{
|
503
|
-
changeset:
|
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="
|
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
|
|