<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -98,19 +98,13 @@ class UrlGenerator &lt; AbstractUrlGenerator
       end
     when :publish
       if known_page
-        href = @controller.url_for :controller =&gt; 'wiki', :web =&gt; web_address, :action =&gt; 'published', 
-            :id =&gt; name, :only_path =&gt; true
-        %{&lt;a class=&quot;existingWikiWord&quot; href=&quot;#{href}&quot;&gt;#{text}&lt;/a&gt;}
+        wikilink_for(mode, name, text, web_address)
       else 
         %{&lt;span class=&quot;newWikiWord&quot;&gt;#{text}&lt;/span&gt;} 
       end
     when :show
       if known_page
-        web = Web.find_by_address(web_address)
-        action = web.published? &amp;&amp; web != @web ? 'published' : 'show'
-        href = @controller.url_for :controller =&gt; 'wiki', :web =&gt; web_address, :action =&gt; action, 
-            :id =&gt; name, :only_path =&gt; true
-        %{&lt;a class=&quot;existingWikiWord&quot; href=&quot;#{href}&quot;&gt;#{text}&lt;/a&gt;}
+        wikilink_for(mode, name, text, web_address)
       else 
         href = @controller.url_for :controller =&gt; 'wiki', :web =&gt; web_address, :action =&gt; 'new', 
             :id =&gt; name, :only_path =&gt; true
@@ -118,11 +112,7 @@ class UrlGenerator &lt; AbstractUrlGenerator
       end
     else 
       if known_page
-        web = Web.find_by_address(web_address)
-        action = web.published? ? 'published' : 'show'
-        href = @controller.url_for :controller =&gt; 'wiki', :web =&gt; web_address, :action =&gt; action, 
-            :id =&gt; name, :only_path =&gt; true
-        %{&lt;a class=&quot;existingWikiWord&quot; href=&quot;#{href}&quot;&gt;#{text}&lt;/a&gt;}
+        wikilink_for(mode, name, text, web_address)
       else 
         href = @controller.url_for :controller =&gt; 'wiki', :web =&gt; web_address, :action =&gt; 'new', 
             :id =&gt; name, :only_path =&gt; true
@@ -190,5 +180,14 @@ class UrlGenerator &lt; AbstractUrlGenerator
       %{&lt;span class=&quot;deleteWikiWord&quot;&gt;[[#{name}:delete]]&lt;/span&gt;}
     end
   end
-  
+
+  private
+
+    def wikilink_for(mode, name, text, web_address)
+      web = Web.find_by_address(web_address)
+      action = web.published? &amp;&amp; !(web == @web &amp;&amp; mode != :publish) ? 'published' : 'show'
+      href = @controller.url_for :controller =&gt; 'wiki', :web =&gt; web_address, :action =&gt; action, 
+            :id =&gt; name, :only_path =&gt; true
+      %{&lt;a class=&quot;existingWikiWord&quot; href=&quot;#{href}&quot;&gt;#{text}&lt;/a&gt;}
+    end  
 end</diff>
      <filename>lib/url_generator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -88,6 +88,6 @@ liquor_first_revision:
   updated_at: &lt;%= 40.minutes.ago.to_formatted_s(:db) %&gt;
   revised_at: &lt;%= 40.minutes.ago.to_formatted_s(:db) %&gt;
   page_id: 9
-  content: &quot;[[!redirects booze]]\n Drinky-poo.&quot;
+  content: &quot;[[!redirects booze]]\n Drinky-poo.  [[Instiki:HomePage|go there]]&quot;
   author: Guest
-  ip: 127.0.0.2
+  ip: 127.0.0.2
\ No newline at end of file</diff>
      <filename>test/fixtures/revisions.yml</filename>
    </modified>
    <modified>
      <diff>@@ -329,6 +329,52 @@ class WikiControllerTest &lt; ActionController::TestCase
     assert_response(:success)
     assert_equal @home, r.template_objects['page']
     assert_match /&lt;a class='existingWikiWord' href='\/wiki1\/show\/ThatWay'&gt;That Way&lt;\/a&gt;/, r.body
+
+    r = process 'save', 'web' =&gt; 'instiki', 'id' =&gt; 'HomePage', 'content' =&gt; 'Contents of a new page', 
+      'author' =&gt; 'AuthorOfNewPage'
+    assert_equal Web.find_by_address('instiki').has_page?('HomePage'), true
+
+    r = process('published', 'web' =&gt; 'wiki1', 'id' =&gt; 'liquor')
+
+    assert_response(:success)
+    assert_equal @liquor, r.template_objects['page']
+    assert_match /&lt;a class='existingWikiWord' href='\/instiki\/show\/HomePage'&gt;go there&lt;\/a&gt;/, r.body
+
+    r = process('show', 'web' =&gt; 'wiki1', 'id' =&gt; 'liquor')
+
+    assert_response(:success)
+    assert_equal @liquor, r.template_objects['page']
+    assert_match /&lt;a class='existingWikiWord' href='\/instiki\/show\/HomePage'&gt;go there&lt;\/a&gt;/, r.body
+
+    Web.find_by_address('instiki').update_attribute(:published, true)
+
+    r = process('published', 'web' =&gt; 'wiki1', 'id' =&gt; 'liquor')
+
+    assert_response(:success)
+    assert_equal @liquor, r.template_objects['page']
+    assert_match /&lt;a class='existingWikiWord' href='\/instiki\/published\/HomePage'&gt;go there&lt;\/a&gt;/, r.body
+
+    r = process('show', 'web' =&gt; 'wiki1', 'id' =&gt; 'liquor')
+
+    assert_response(:success)
+    assert_equal @liquor, r.template_objects['page']
+    assert_match /&lt;a class='existingWikiWord' href='\/instiki\/published\/HomePage'&gt;go there&lt;\/a&gt;/, r.body
+
+    set_web_property :published, false
+
+    r = process('show', 'web' =&gt; 'wiki1', 'id' =&gt; 'liquor')
+
+    assert_response(:success)
+    assert_equal @liquor, r.template_objects['page']
+    assert_match /&lt;a class='existingWikiWord' href='\/instiki\/published\/HomePage'&gt;go there&lt;\/a&gt;/, r.body
+
+    Web.find_by_address('instiki').update_attribute(:published, false)
+
+    r = process('show', 'web' =&gt; 'wiki1', 'id' =&gt; 'liquor')
+
+    assert_response(:success)
+    assert_equal @liquor, r.template_objects['page']
+    assert_match /&lt;a class='existingWikiWord' href='\/instiki\/show\/HomePage'&gt;go there&lt;\/a&gt;/, r.body
   end
 
 </diff>
      <filename>test/functional/wiki_controller_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>97a35e280b4e27e5508d79dae93ae1a94c8183be</id>
    </parent>
  </parents>
  <author>
    <name>Jacques Distler</name>
    <email>distler@golem.ph.utexas.edu</email>
  </author>
  <url>http://github.com/parasew/instiki/commit/761f8bbb51380b7ca1ef0944b5ff0d8d0c0e6d08</url>
  <id>761f8bbb51380b7ca1ef0944b5ff0d8d0c0e6d08</id>
  <committed-date>2009-10-22T15:57:13-07:00</committed-date>
  <authored-date>2009-10-22T15:57:13-07:00</authored-date>
  <message>Links From Published Webs

Damn, but it's hard to get this right.
I think I've finally done it, though.
We'll see ...</message>
  <tree>6225b14138cf4878b6ce42f4aff542b70f9a16d9</tree>
  <committer>
    <name>Jacques Distler</name>
    <email>distler@golem.ph.utexas.edu</email>
  </committer>
</commit>
