changeset 11:0b097770061d

Improve content hiding functionality.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 11 Aug 2015 12:24:54 +0300
parents d63d2f0307b0
children 79987aa7ee9a
files mgtool.php
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mgtool.php	Sat Jun 13 15:21:47 2015 +0300
+++ b/mgtool.php	Tue Aug 11 12:24:54 2015 +0300
@@ -238,11 +238,11 @@
     // Ignore comments and empty lines
     if ($str != "#" && $str != "")
     {
-      if (preg_match("/^(#?)\s*(\S+?)\s+(.+)$/", $str, $m))
-        $captions[$m[2]] = array("caption" => $m[3], "hide" => ($m[1] == "#"), "used" => FALSE);
+      if (preg_match("/^([#%]?)\s*(\S+?)\s+(.+)$/", $str, $m))
+        $captions[$m[2]] = array("caption" => $m[3], "hide" => ($m[1] == "#"), "hide_contents" => ($m[1] == "%"), "used" => FALSE);
       else
-      if (preg_match("/^(#?)\s*(\S+?)$/", $str, $m))
-        $captions[$m[2]] = array("hide" => ($m[1] == "#"), "used" => FALSE);
+      if (preg_match("/^([#%]?)\s*(\S+?)$/", $str, $m))
+        $captions[$m[2]] = array("hide" => ($m[1] == "#"), "hide_contents" => ($m[1] == "%"), "used" => FALSE);
     }
   }
 
@@ -500,6 +500,7 @@
         mgCopyEntryData($edata, $tmp, MG_STR, "caption", "fallback_caption");
         mgCopyEntryData($edata, $tmp, MG_STR, "caption", "title");
         mgCopyEntryData($edata, $tmp, MG_BOOL, "hide", "hide", FALSE);
+        mgCopyEntryData($edata, $tmp, MG_BOOL, "hide_contents", "hide_contents", FALSE);
       }
     }