<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,13 +3,16 @@ NAME
 
 SYNOPSIS
 	&lt;bashpress&gt;/bin/new &lt;title&gt;
-	&lt;bashpress&gt;/bin/publish &lt;path&gt;
+	&lt;bashpress&gt;/bin/publish [-c] &lt;path&gt;
 
 DESCRIPTION
 	Bashpress is a rebellion against browser-based blogging engines,
 	WYSIWYG editors, and relational databases.  It is command-line only,
 	has no user accounts, and doesn't use a database.  It loves Smarty.
 
+		-c	This option, available to bin/publish and bin/republish
+			will disable commenting no matter the default state.
+
 INSTALLATION
 	Download or checkout Bashpress.  Use the included httpd.conf file to
 	setup a VirtualHost rooted at &lt;bashpress&gt;/public.  Create</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -1,37 +1,43 @@
 #!/usr/bin/env php
 &lt;?php
 
-# The only argument must be a valid and existing post
-if (2 != sizeof($argv)) { 
-	echo &quot;Usage: {$argv[0]} &lt;post&gt;\n&quot;;
+require_once dirname(__FILE__) . '/../include/init.php';
+
+if (3 == sizeof($argv) &amp;&amp; '-c' == $argv[1]) {
+	$comments = false;
+	$arg = $argv[2];
+} else if (2 == sizeof($argv)) {
+	$comments = $COMMENTS;
+	$arg = $argv[1];
+} else {
+	echo &quot;Usage: {$argv[0]} [-c] &lt;post&gt;\n&quot;;
 	exit(1);
 }
-if (!file_exists($argv[1])) {
-	echo &quot;[publish] can't find a post at {$argv[1]}\n&quot;;
+if (!file_exists($arg)) {
+	echo &quot;[publish] can't find a post at $arg\n&quot;;
 	exit(1);
 }
 $base = realpath(dirname(__FILE__) . '/../posts');
-if ($base != substr(realpath($argv[1]), 0, strlen($base))) {
+if ($base != substr(realpath($arg), 0, strlen($base))) {
 	echo &quot;[publish] can only publish from the posts/ directory\n&quot;;
 	exit(1);
 }
 
-require_once dirname(__FILE__) . '/../include/init.php';
 loadlib('blog_publish');
 loadlib('input');
 
 # Check if this post has already been published
 #   Don't allow republishing, instead, send them to the bin/republish script
 $path = str_replace(realpath(dirname(__FILE__) . '/../posts'), '',
-	realpath($argv[1]));
+	realpath($arg));
 if (file_exists(&quot;{$smarty-&gt;template_dir}/.posts$path.html&quot;)) {
-	echo &quot;[publish] can't republish {$argv[1]}\n[publish] try bin/republish\n&quot;;
+	echo &quot;[publish] can't republish $arg\n[publish] try bin/republish\n&quot;;
 	exit(1);
 }
 
 # Move this post up to today if necessary
 $parts = explode('/', str_replace(
-	realpath(dirname(__FILE__) . '/../posts') . '/', '', realpath($argv[1])));
+	realpath(dirname(__FILE__) . '/../posts') . '/', '', realpath($arg)));
 $file = array_pop($parts);
 if (date('Y-m-d') != implode('-', $parts)) {
 	$path = blog_publish_dir(dirname(__FILE__) . '/../posts',
@@ -41,15 +47,15 @@ if (date('Y-m-d') != implode('-', $parts)) {
 	# Delete empty directories in the date hierarchy to keep things tidy
 	$ii = sizeof($parts);
 	for ($i = 0; $i &lt; $ii; ++$i) {
-		if (!@rmdir($argv[1] = dirname($argv[1]))) { break; }
+		if (!@rmdir($arg = dirname($arg))) { break; }
 	}
 
-	$argv[1] = dirname(__FILE__) . &quot;/../posts/$path/$file&quot;;
+	$arg = dirname(__FILE__) . &quot;/../posts/$path/$file&quot;;
 }
 
 # Create directories for the &lt;year&gt;/&lt;month&gt;/&lt;day&gt;
 $parts = explode('/', str_replace(
-	realpath(dirname(__FILE__) . '/../posts') . '/', '', realpath($argv[1])));
+	realpath(dirname(__FILE__) . '/../posts') . '/', '', realpath($arg)));
 $file = array_pop($parts);
 $path = blog_publish_dir(&quot;{$smarty-&gt;template_dir}/.posts&quot;, $parts);
 
@@ -79,9 +85,10 @@ file_put_contents(&quot;{$smarty-&gt;template_dir}/.posts$path/$file.date&quot;,
 
 # Write the post's Smarty template
 list($title, $tags, $body) = preg_split(&quot;!\r?\n\r?\n!&quot;,
-	file_get_contents($argv[1]), 3);
+	file_get_contents($arg), 3);
 $tags = preg_split('!\s+!', $tags);
-blog_publish_smarty($path, $file, $timestamp, $title, $tags, $body);
+blog_publish_smarty($path, $file, $timestamp, $title, $tags, $body,
+	$comments);
 echo &quot;[publish] created the post's Smarty template\n&quot;;
 
 # Update the homepage</diff>
      <filename>bin/publish</filename>
    </modified>
    <modified>
      <diff>@@ -1,26 +1,28 @@
 #!/usr/bin/php
 &lt;?php
 
-#
-# The only argument must be a valid and existing post
-#   TODO: Make sure it was previously published
-#
+require_once dirname(__FILE__) . '/../include/init.php';
 
-if (2 != sizeof($argv)) { 
-	echo &quot;Usage: {$argv[0]} &lt;post&gt;\n&quot;;
+if (3 == sizeof($argv) &amp;&amp; '-c' == $argv[1]) {
+	$comments = false;
+	$arg = $argv[2];
+} else if (2 == sizeof($argv)) {
+	$comments = $COMMENTS;
+	$arg = $argv[1];
+} else {
+	echo &quot;Usage: {$argv[0]} [-c] &lt;post&gt;\n&quot;;
 	exit(1);
 }
-if (!file_exists($argv[1])) {
-	echo &quot;[publish] can't find a post at {$argv[1]}\n&quot;;
+if (!file_exists($arg)) {
+	echo &quot;[publish] can't find a post at $arg\n&quot;;
 	exit(1);
 }
 $base = realpath(dirname(__FILE__) . '/../posts');
-if ($base != substr(realpath($argv[1]), 0, strlen($base))) {
+if ($base != substr(realpath($arg), 0, strlen($base))) {
 	echo &quot;[publish] can only publish from the posts/ directory\n&quot;;
 	exit(1);
 }
 
-require_once dirname(__FILE__) . '/../include/init.php';
 loadlib('blog_publish');
 
 
@@ -31,7 +33,7 @@ loadlib('blog_publish');
 
 # Get the path to the post
 $parts = explode('/', str_replace(
-	realpath(dirname(__FILE__) . '/../posts') . '/', '', realpath($argv[1])));
+	realpath(dirname(__FILE__) . '/../posts') . '/', '', realpath($arg)));
 $file = array_pop($parts);
 $path = '/' . implode('/', $parts);
 
@@ -41,9 +43,10 @@ $timestamp = strtotime(file_get_contents(
 
 # Rewrite the post's Smarty template
 list($title, $tags, $body) = preg_split(&quot;!\r?\n\r?\n!&quot;,
-	file_get_contents($argv[1]), 3);
+	file_get_contents($arg), 3);
 $tags = preg_split('!\s+!', $tags);
-blog_publish_smarty($path, $file, $timestamp, $title, $tags, $body);
+blog_publish_smarty($path, $file, $timestamp, $title, $tags, $body,
+	$comments);
 echo &quot;[publish] recreated the post's Smarty template\n&quot;;
 
 </diff>
      <filename>bin/republish</filename>
    </modified>
    <modified>
      <diff>@@ -5,11 +5,13 @@ $TITLE = 'Richard Crowley&amp;#8217;s blog';
 $FQDN = 'bashpress.rcrowley.org';
 $AUTHOR = 'Richard Crowley';
 $MAIL = 'r@rcrowley.org';
+$COMMENTS = false;
 
 # Expose some site parameters to the templates
 assign('TITLE');
 assign('FQDN');
 assign('AUTHOR');
+assign('COMMENTS');
 
 # Date formats
 $DATEFORMAT_POST = 'Y/m/d';</diff>
      <filename>include/config.php</filename>
    </modified>
    <modified>
      <diff>@@ -6,13 +6,15 @@ loadlib('input');
 # Write the post's Smarty template
 #   The &quot;special&quot; string is safe because you should be escaping your
 #   HTML anyway
-function blog_publish_smarty($path, $file, $timestamp, $title, $tags, $body) {
+function blog_publish_smarty($path, $file, $timestamp, $title, $tags,
+	$body, $comments) {
 	assign('path');
 	assign('file');
 	assign('date', date($GLOBALS['DATEFORMAT_POST'], $timestamp));
 	assign('title', input_sanitize_smarty($title));
 	assign('tags', input_sanitize_smarty($tags));
 	assign('body', input_sanitize_smarty($body));
+	assign('comments', $comments);
 	global $smarty;
 	file_put_contents(&quot;{$smarty-&gt;template_dir}/.posts$path/$file.html&quot;,
 		$smarty-&gt;fetch('post.smarty'), LOCK_EX);</diff>
      <filename>include/lib_blog_publish.php</filename>
    </modified>
    <modified>
      <diff>@@ -11,10 +11,15 @@
 &lt;/ul&gt;
 {$body}
 {ldelim}if !$page{rdelim}
+{if $comments}
 &lt;p&gt;&lt;a href=&quot;{$path}/{$file}#comments&quot;&gt;Comments ({ldelim}blog_comment_count tpl=$smarty.template{rdelim})&lt;/a&gt;&lt;/p&gt;
+{else}
+&lt;p&gt;&lt;a href=&quot;{$path}/{$file}&quot;&gt;#&lt;/a&gt;&lt;/p&gt;
+{/if}
 {ldelim}/if{rdelim}
 &lt;/div&gt;
 {ldelim}if $page{rdelim}
+{if $comments}
 {ldelim}if !$preview{rdelim}
 &lt;div id=&quot;comments&quot;&gt;
 &lt;h1&gt;Comments &lt;small&gt;({ldelim}blog_comment_count{rdelim})&lt;/small&gt;&lt;/h1&gt;
@@ -22,7 +27,10 @@
 {ldelim}include file=&quot;.posts{$path}/{$file}.comments.html&quot;{rdelim}
 &lt;/ol&gt;
 &lt;/div&gt;
+{ldelim}if $COMMENTS{rdelim}
 {ldelim}include file=&quot;_comment.html&quot;{rdelim}
 {ldelim}/if{rdelim}
+{ldelim}/if{rdelim}
+{/if}
 {ldelim}include file=&quot;_foot.html&quot;{rdelim}
 {ldelim}/if{rdelim}</diff>
      <filename>templates/post.smarty</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1ba1ff2e1388b9f7ffb6a666cadb6799179c954d</id>
    </parent>
  </parents>
  <author>
    <name>Richard Crowley</name>
    <email>r@rcrowley.org</email>
  </author>
  <url>http://github.com/rcrowley/bashpress/commit/d2d2483ac727a95746dd36219a14b0e15f5821a5</url>
  <id>d2d2483ac727a95746dd36219a14b0e15f5821a5</id>
  <committed-date>2009-02-26T23:22:41-08:00</committed-date>
  <authored-date>2009-02-26T23:22:41-08:00</authored-date>
  <message>Turn comments on and off.</message>
  <tree>1132ec430c28b0abfb400e7419b44c4e85c33a6b</tree>
  <committer>
    <name>Richard Crowley</name>
    <email>r@rcrowley.org</email>
  </committer>
</commit>
