<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,11 +1,9 @@
 Backend
 -------
-- Wikify links
-- Auto-link plain-text links
-- Auto-insert newline after h?
+- Auto-insert newline after h*. section headers
 - Add section edit links ?
 - Add diffs to history
 
-ExtJS theme
------------
-- Create
+Themes
+------
+Create an ExtJS theme</diff>
      <filename>TODO</filename>
    </modified>
    <modified>
      <diff>@@ -23,7 +23,7 @@
 	// Helpers
 	// --------------------------------------------------------------------------
 
-	function getHistory($file = &quot;&quot;) {
+	function getGitHistory($file = &quot;&quot;) {
 		$output = array();
 		git(&quot;log --pretty=format:'%H&gt;%T&gt;%an&gt;%ae&gt;%aD&gt;%s' -- $file&quot;, $output);
 		$history = array();
@@ -120,6 +120,7 @@
 			print join(&quot;\n&quot;, $output) . &quot;\n&quot;;
 			//print &quot;Error code: &quot; . $result . &quot;\n&quot;;
 			print &quot;&lt;/pre&gt;&quot;;
+			return 0;
 		}
 		return 1;
 	}
@@ -156,7 +157,15 @@
 	// --------------------------------------------------------------------------
 
 	function wikify($text) {
-		// FIXME: Wikify
+		global $SCRIPT_URL;
+
+		// FIXME: Do not apply this in &lt;pre&gt; and &lt;notextile&gt; blocks.
+
+		// Linkify
+		$text = preg_replace('@[^:](https?://([-\w\.]+)+(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)?)@', '&lt;a href=&quot;$1&quot;&gt;$1&lt;/a&gt;', $text);
+
+		// WikiLinkify
+		$text = preg_replace('@\[([A-Z]\w+)\]@', '&lt;a href=&quot;' . $SCRIPT_URL . '/$1&quot;&gt;$1&lt;/a&gt;', $text);
 
 		// Textilify
 		$textile = new Textile();
@@ -230,6 +239,21 @@
 		return &quot;themes/$THEME&quot;;
 	}
 
+	function getFile() {
+		global $wikiFile;
+		return $wikiFile;
+	}
+
+	function getContent() {
+		global $wikiContent;
+		return $wikiContent;
+	}
+
+	function getRawData() {
+		global $wikiData;
+		return $wikiData;
+	}
+
 	// --------------------------------------------------------------------------
 	// Initialize globals
 	// --------------------------------------------------------------------------
@@ -239,9 +263,7 @@
 	$resource = parseResource($_GET['r']);
 	$wikiPage = $resource[&quot;page&quot;];
 	$wikiSubPage = $resource[&quot;type&quot;];
-
 	$wikiFile = $DATA_DIR . &quot;/&quot; . $wikiPage;
-	$wikiCSS = $CSS;
 
 
 	// --------------------------------------------------------------------------
@@ -282,7 +304,7 @@
 	else {
 		// Global history
 		if ($wikiPage == &quot;history&quot;) {
-			$wikiHistory = getHistory();
+			$wikiHistory = getGitHistory();
 			$wikiPage = &quot;&quot;;
 			include(getThemeDir() . &quot;/history.php&quot;);
 		}
@@ -315,7 +337,7 @@
 		}
 		// History
 		else if ($wikiSubPage == &quot;history&quot;) {
-			$wikiHistory = getHistory($wikiPage);
+			$wikiHistory = getGitHistory($wikiPage);
 			include(getThemeDir() . &quot;/history.php&quot;);
 		}
 		// Specific version</diff>
      <filename>index.php</filename>
    </modified>
    <modified>
      <diff>@@ -18,7 +18,7 @@
 
 		&lt;div id=&quot;form&quot;&gt;
 			&lt;form method=&quot;post&quot; action=&quot;&lt;?php print getPostURL(); ?&gt;&quot;&gt;
-				&lt;p&gt;&lt;textarea name=&quot;data&quot; cols=&quot;80&quot; rows=&quot;20&quot; style=&quot;width: 100%&quot;&gt;&lt;?php print $wikiData; ?&gt;&lt;/textarea&gt;&lt;/p&gt;
+				&lt;p&gt;&lt;textarea name=&quot;data&quot; cols=&quot;80&quot; rows=&quot;20&quot; style=&quot;width: 100%&quot;&gt;&lt;?php print getRawData(); ?&gt;&lt;/textarea&gt;&lt;/p&gt;
 				&lt;p&gt;&lt;input type=&quot;submit&quot; value=&quot;publish&quot; /&gt;&lt;/p&gt;
 			&lt;/form&gt;
 		&lt;/div&gt;</diff>
      <filename>themes/default/edit.php</filename>
    </modified>
    <modified>
      <diff>@@ -20,6 +20,7 @@
 		&lt;/div&gt;
 
 		&lt;div id=&quot;history&quot;&gt;
+			&lt;p&gt;
 			&lt;table&gt;
 				&lt;tr&gt;&lt;th&gt;Date&lt;/th&gt;&lt;th&gt;Author&lt;/th&gt;&lt;th&gt;Page&lt;/th&gt;&lt;th&gt;Message&lt;/th&gt;&lt;/tr&gt;
 			&lt;?php 
@@ -35,6 +36,7 @@
 				}
 			?&gt;
 			&lt;/table&gt;
+			&lt;/p&gt;
 		&lt;/div&gt;
 	&lt;/body&gt;
 &lt;/html&gt;</diff>
      <filename>themes/default/history.php</filename>
    </modified>
    <modified>
      <diff>@@ -115,6 +115,8 @@ acronym, abbr {
 
 #history table {
 	border-collapse: collapse;
+	margin-left: auto;
+	margin-right: auto;
 }
 
 #history td {</diff>
      <filename>themes/default/style.css</filename>
    </modified>
    <modified>
      <diff>@@ -19,11 +19,11 @@
 		&lt;/div&gt;
 
 		&lt;div id=&quot;content&quot;&gt;
-			&lt;?php print $wikiContent; ?&gt;
+			&lt;?php print getContent(); ?&gt;
 		&lt;/div&gt;
 
 		&lt;div id=&quot;footer&quot;&gt;
-			&lt;p&gt;Last modified on &lt;?php print date(&quot;F d Y H:i:s&quot;, filemtime($wikiFile)); ?&gt; &lt;/p&gt;
+			&lt;p&gt;Last modified on &lt;?php print date(&quot;F d Y H:i:s&quot;, filemtime(getFile())); ?&gt; &lt;/p&gt;
 		&lt;/div&gt;
 	&lt;/body&gt;
 &lt;/html&gt;</diff>
      <filename>themes/default/view.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4e3cff1e75ebf19cac4ebe602cc76e5027ecf6e1</id>
    </parent>
  </parents>
  <author>
    <name>Remko Tron&#231;on</name>
    <email>git@el-tramo.be</email>
  </author>
  <url>http://github.com/tommorris/wigit/commit/bc06008eef742e3971fdbe3859c442acdbd4d1a4</url>
  <id>bc06008eef742e3971fdbe3859c442acdbd4d1a4</id>
  <committed-date>2008-07-20T13:04:59-07:00</committed-date>
  <authored-date>2008-07-20T13:04:59-07:00</authored-date>
  <message>Linkifying.
Some more cleanups.</message>
  <tree>9371738ad4574822e6b1b72ba6959ec15dd72a54</tree>
  <committer>
    <name>Remko Tron&#231;on</name>
    <email>git@el-tramo.be</email>
  </committer>
</commit>
