=== added file '.bzrignore'
--- /dev/null	
+++ .bzrignore	
@@ -0,0 +1,1 @@
+./.project

=== modified file 'README'
--- README	
+++ README	
@@ -25,6 +25,9 @@
 3. Kill "instiki"
 4. Install SQLite 3 database engine from http://www.sqlite.org/
 5. Install SQLite 3 driver for Ruby from http://sqlite-ruby.rubyforge.org/
+6. *nix and Mac OS X users must install swig (http://www.swig.org/)
+   DarwinPorts users on Mac OS X can install swig via:
+   sudo port install swig
 6. Install Rake from http://rake.rubyforge.org/
 7. Execute rm -f db/*.db
 8. Execute 'rake environment RAILS_ENV=production migrate'

=== modified file 'lib/chunks/include.rb'
--- lib/chunks/include.rb	
+++ lib/chunks/include.rb	
@@ -23,7 +23,7 @@
   def get_unmask_text_avoiding_recursion_loops
     if refpage
       # TODO This way of instantiating a renderer is ugly.
-      renderer = PageRenderer.new(refpage.current_revision)
+      renderer = PageRenderer.new(refpage.current_revision, @content.options)
       if renderer.wiki_includes.include?(@content.page_name)
         # this will break the recursion
         @content.delete_chunk(self)

=== modified file 'lib/page_renderer.rb'
--- lib/page_renderer.rb	
+++ lib/page_renderer.rb	
@@ -16,8 +16,9 @@
 
   attr_reader :revision
 
-  def initialize(revision = nil)
+  def initialize(revision = nil, render_options={})
     self.revision = revision
+    @render_options = render_options
   end
 
   def revision=(r)
@@ -95,8 +96,9 @@
   private
   
   def render(options = {})
-    rendering_result = WikiContent.new(@revision, @@url_generator, options).render!
-    update_references(rendering_result) if options[:update_references]
+    opts = options.merge( @render_options )
+    rendering_result = WikiContent.new(@revision, @@url_generator, opts).render!
+    update_references(rendering_result) if opts[:update_references]
     rendering_result
   end
   

=== modified file 'test/fixtures/pages.yml'
--- test/fixtures/pages.yml	
+++ test/fixtures/pages.yml	
@@ -52,4 +52,32 @@
   created_at: <%= 10.minutes.ago.to_formatted_s(:db) %>
   updated_at: <%= 10.minutes.ago.to_formatted_s(:db) %>
   web_id: 1
-  name: Elephant
\ No newline at end of file
+  name: Elephant
+
+an_including_page:
+  id: 9
+  created_at: <%= 30.minutes.ago.to_formatted_s(:db) %>
+  updated_at: <%= 30.minutes.ago.to_formatted_s(:db) %>
+  web_id: 1
+  name: AnIncludingPage
+
+an_included_page:
+  id: 10
+  created_at: <%= 23.minutes.ago.to_formatted_s(:db) %>
+  updated_at: <%= 23.minutes.ago.to_formatted_s(:db) %>
+  web_id: 1
+  name: AnIncludedPage
+
+another_included_page:
+  id: 11
+  created_at: <%= 11.minutes.ago.to_formatted_s(:db) %>
+  updated_at: <%= 11.minutes.ago.to_formatted_s(:db) %>
+  web_id: 1
+  name: AnotherIncludedPage
+
+a_missing_include_page:
+  id: 12
+  created_at: <%= 1.day.ago.to_formatted_s(:db) %>
+  updated_at: <%= 1.day.ago.to_formatted_s(:db) %>
+  web_id: 1
+  name: AMissingIncludePage

=== modified file 'test/fixtures/revisions.yml'
--- test/fixtures/revisions.yml	
+++ test/fixtures/revisions.yml	
@@ -81,3 +81,43 @@
   content: "All about elephants.\ncategory: animals"
   author: Guest
   ip: 127.0.0.2
+
+an_including_page_first_revision:
+  id: 10
+  created_at: <%= 30.minutes.ago.to_formatted_s(:db) %>
+  updated_at: <%= 30.minutes.ago.to_formatted_s(:db) %>
+  revised_at: <%= 30.minutes.ago.to_formatted_s(:db) %>
+  page_id: 9
+  content: "Welcome to this page\nAnIncludedPage\n\n[[!include AnIncludedPage]]"
+  author: Guest
+  ip: 127.0.0.1
+
+an_included_page_first_revision:
+  id: 11
+  created_at: <%= 23.minutes.ago.to_formatted_s(:db) %>
+  updated_at: <%= 23.minutes.ago.to_formatted_s(:db) %>
+  revised_at: <%= 23.minutes.ago.to_formatted_s(:db) %>
+  page_id: 10
+  content: "Stuff to _include_...\nAnotherIncludedPage\n\n[[!include AnotherIncludedPage]]"
+  author: Guest
+  ip: 127.0.0.1
+
+another_included_page_first_revision:
+  id: 12
+  created_at: <%= 11.minutes.ago.to_formatted_s(:db) %>
+  updated_at: <%= 11.minutes.ago.to_formatted_s(:db) %>
+  revised_at: <%= 11.minutes.ago.to_formatted_s(:db) %>
+  page_id: 11
+  content: "Another *included* page."
+  author: Guest
+  ip: 127.0.0.1
+  
+a_missing_include_page_first_revision:
+  id: 13
+  created_at: <%= 1.day.ago.to_formatted_s(:db) %>
+  updated_at: <%= 1.day.ago.to_formatted_s(:db) %>
+  revised_at: <%= 1.day.ago.to_formatted_s(:db) %>
+  page_id: 12
+  content: "[[!include ThisPageDoesntExist]]"
+  author: Guest
+  ip: 127.0.0.1

=== modified file 'test/functional/wiki_controller_test.rb'
--- test/functional/wiki_controller_test.rb	
+++ test/functional/wiki_controller_test.rb	
@@ -122,7 +122,7 @@
     begin 
       File.open(@tempfile_path, 'wb') { |f| f.write(r.body); @exported_file = f.path }
       Zip::ZipFile.open(@exported_file) do |zip| 
-        assert_equal %w(Elephant.html FirstPage.html HomePage.html MyWay.html NoWikiWord.html Oak.html SmartEngine.html ThatWay.html index.html), zip.dir.entries('.').sort
+        assert_equal %w(AMissingIncludePage.html AnIncludedPage.html AnIncludingPage.html AnotherIncludedPage.html Elephant.html FirstPage.html HomePage.html MyWay.html NoWikiWord.html Oak.html SmartEngine.html ThatWay.html index.html), zip.dir.entries('.').sort
         assert_match /.*<html .*All about elephants.*<\/html>/, 
             zip.file.read('Elephant.html').gsub(/\s+/, ' ')
         assert_match /.*<html .*All about oak.*<\/html>/, 
@@ -218,11 +218,13 @@
   def test_list
     r = process('list', 'web' => 'wiki1')
 
-    assert_equal ['animals', 'trees'], r.template_objects['categories']
+    assert_equal %w(animals trees), r.template_objects['categories']
     assert_nil r.template_objects['category']
-    assert_equal [@elephant, pages(:first_page), @home, pages(:my_way), pages(:no_wiki_word), 
-                  @oak, pages(:smart_engine), pages(:that_way)], 
-                 r.template_objects['pages_in_category']
+    all_pages = pages(:a_missing_include_page), pages(:an_included_page),
+                pages(:an_including_page), pages(:another_included_page), @elephant,
+                pages(:first_page), @home, pages(:my_way), pages(:no_wiki_word), 
+                @oak, pages(:smart_engine), pages(:that_way)
+    assert_equal all_pages, r.template_objects['pages_in_category']
   end
 
 
@@ -309,7 +311,9 @@
     
     assert_equal %w(animals trees), r.template_objects['categories']
     assert_nil r.template_objects['category']
-    all_pages = @elephant, pages(:first_page), @home, pages(:my_way), pages(:no_wiki_word), 
+    all_pages = pages(:a_missing_include_page), pages(:an_included_page),
+                pages(:an_including_page), pages(:another_included_page), @elephant,
+                pages(:first_page), @home, pages(:my_way), pages(:no_wiki_word), 
                 @oak, pages(:smart_engine), pages(:that_way)
     assert_equal all_pages, r.template_objects['pages_in_category']
     
@@ -337,7 +341,12 @@
     assert_equal %w(animals categorized trees), r.template_objects['categories']
     # no category is specified in params
     assert_nil r.template_objects['category']
-    assert_equal [@elephant, pages(:first_page), @home, pages(:my_way), pages(:no_wiki_word), @oak, page2, pages(:smart_engine), pages(:that_way)], r.template_objects['pages_in_category'],
+    all_pages = pages(:a_missing_include_page), pages(:an_included_page),
+                pages(:an_including_page), pages(:another_included_page), @elephant,
+                pages(:first_page), @home, pages(:my_way), pages(:no_wiki_word), 
+                @oak, page2, pages(:smart_engine), pages(:that_way)
+
+    assert_equal all_pages, r.template_objects['pages_in_category'],
         "Pages are not as expected: " +
         r.template_objects['pages_in_category'].map {|p| p.name}.inspect
     assert_equal 'the web', r.template_objects['set_name']
@@ -350,7 +359,11 @@
     assert_equal ['animals', 'trees'], r.template_objects['categories']
     # no category is specified in params
     assert_nil r.template_objects['category']
-    assert_equal [@elephant, pages(:first_page), @home, pages(:my_way), pages(:no_wiki_word), @oak, pages(:smart_engine), pages(:that_way)], r.template_objects['pages_in_category'], 
+    all_pages = pages(:a_missing_include_page), pages(:an_included_page),
+                pages(:an_including_page), pages(:another_included_page), @elephant,
+                pages(:first_page), @home, pages(:my_way), pages(:no_wiki_word), 
+                @oak, pages(:smart_engine), pages(:that_way)
+    assert_equal all_pages, r.template_objects['pages_in_category'], 
         "Pages are not as expected: " +
         r.template_objects['pages_in_category'].map {|p| p.name}.inspect
     assert_equal 'the web', r.template_objects['set_name']
@@ -392,7 +405,11 @@
 
     assert_success
     pages = r.template_objects['pages_by_revision']
-    assert_equal [@elephant, @oak, pages(:no_wiki_word), pages(:that_way), pages(:smart_engine), pages(:my_way), pages(:first_page), @home], pages,
+    all_pages = @elephant, pages(:another_included_page), pages(:an_included_page),
+                pages(:an_including_page), pages(:a_missing_include_page), @oak,
+                pages(:no_wiki_word), pages(:that_way), pages(:smart_engine), 
+                pages(:my_way), pages(:first_page), @home
+    assert_equal all_pages, pages,
         "Pages are not as expected: #{pages.map {|p| p.name}.inspect}"
     assert !r.template_objects['hide_description']
   end
@@ -418,22 +435,30 @@
 
     assert_success
     pages = r.template_objects['pages_by_revision']
-    assert_equal [@elephant, @title_with_spaces, @oak, pages(:no_wiki_word), pages(:that_way), pages(:smart_engine), pages(:my_way), pages(:first_page), @home], pages, "Pages are not as expected: #{pages.map {|p| p.name}.inspect}"
+    expected  = @elephant, pages(:another_included_page), pages(:an_included_page),
+                pages(:an_including_page), @title_with_spaces, 
+                pages(:a_missing_include_page), @oak,
+                pages(:no_wiki_word), pages(:that_way), pages(:smart_engine), 
+                pages(:my_way), pages(:first_page), @home
+    assert_equal expected, pages, "Pages are not as expected: #{pages.map {|p| p.name}.inspect}"
     assert r.template_objects['hide_description']
     
     xml = REXML::Document.new(r.body)
 
     expected_page_links =
         ['http://localhost:8080/wiki1/show/Elephant',
+         'http://localhost:8080/wiki1/show/AnotherIncludedPage',
+         'http://localhost:8080/wiki1/show/AnIncludedPage',
+         'http://localhost:8080/wiki1/show/AnIncludingPage',
          'http://localhost:8080/wiki1/show/Title+With+Spaces',
+         'http://localhost:8080/wiki1/show/AMissingIncludePage',
          'http://localhost:8080/wiki1/show/Oak',
          'http://localhost:8080/wiki1/show/NoWikiWord',
          'http://localhost:8080/wiki1/show/ThatWay',
          'http://localhost:8080/wiki1/show/SmartEngine',
          'http://localhost:8080/wiki1/show/MyWay',
          'http://localhost:8080/wiki1/show/FirstPage',
-         'http://localhost:8080/wiki1/show/HomePage',
-         ]
+         'http://localhost:8080/wiki1/show/HomePage']
 
     assert_template_xpath_match '/rss/channel/link', 
         'http://localhost:8080/wiki1/show/HomePage'
@@ -455,6 +480,10 @@
 
     expected_page_links =
         ['http://foo.bar.info/wiki1/published/Elephant',
+         'http://foo.bar.info/wiki1/published/AnotherIncludedPage',
+         'http://foo.bar.info/wiki1/published/AnIncludedPage',
+         'http://foo.bar.info/wiki1/published/AnIncludingPage',
+         'http://foo.bar.info/wiki1/published/AMissingIncludePage',
          'http://foo.bar.info/wiki1/published/Oak',
          'http://foo.bar.info/wiki1/published/NoWikiWord',
          'http://foo.bar.info/wiki1/published/ThatWay',
@@ -490,12 +519,12 @@
     r = process 'rss_with_headlines', 'web' => 'wiki1', 'limit' => 'all'
     assert_success
     pages = r.template_objects['pages_by_revision']
-    assert_equal 38, pages.size
+    assert_equal 42, pages.size
     
     r = process 'rss_with_headlines', 'web' => 'wiki1', 'start' => '1976-10-16'
     assert_success
     pages = r.template_objects['pages_by_revision']
-    assert_equal 23, pages.size
+    assert_equal 27, pages.size
     
     r = process 'rss_with_headlines', 'web' => 'wiki1', 'end' => '1976-10-16'
     assert_success
@@ -525,7 +554,7 @@
       test_renderer)
 
     r = process 'rss_with_headlines', 'web' => 'wiki1'
-    assert_template_xpath_match '/rss/channel/item/pubDate[9]', "Thu, 01 Jan 1970 00:00:00 Z"
+    assert_template_xpath_match '/rss/channel/item/pubDate[13]', "Thu, 01 Jan 1970 00:00:00 Z"
   end
   
   def test_save

=== modified file 'test/test_helper.rb'
--- test/test_helper.rb	
+++ test/test_helper.rb	
@@ -22,6 +22,13 @@
 PageObserver.instance
 
 class Test::Unit::TestCase
+  # Instantiated fixtures are slow, but give you @david where otherwise you
+  # would need people(:david).  If you don't want to migrate your existing
+  # test cases which use the @david style and don't mind the speed hit (each
+  # instantiated fixtures translates to a database query per test method),
+  # then set this back to true.
+  self.use_instantiated_fixtures  = false
+
   def create_fixtures(*table_names)
     Fixtures.create_fixtures(File.dirname(__FILE__) + "/fixtures", table_names)
   end

=== modified file 'test/unit/page_renderer_test.rb'
--- test/unit/page_renderer_test.rb	
+++ test/unit/page_renderer_test.rb	
@@ -235,7 +235,14 @@
         '<span class="newWikiWord">Smart Engine GUI</span></p>', 
         test_renderer(@revision).display_content_for_export
   end
-  
+
+  def test_included_content_for_export
+    @page = pages(:an_including_page)
+    @revision = revisions(:an_including_page_first_revision)
+    assert_equal "<p>Welcome to this page<br /><a class=\"existingWikiWord\" href=\"AnIncludedPage.html\">An Included Page</a></p>\n\n\n\t<p>Stuff to <em>include</em>&#8230;<br /><a class=\"existingWikiWord\" href=\"AnotherIncludedPage.html\">Another Included Page</a></p>\n\n\n\t<p>Another <strong>included</strong> page.</p>",
+        test_renderer(@revision).display_content_for_export
+  end
+
   def test_double_replacing
     @revision.content = "VersionHistory\r\n\r\ncry VersionHistory"
     assert_equal '<p><span class="newWikiWord">Version History' +

