From 0b4dbd7a4fb24e0a2fd0300729774f364da7459d Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Wed, 20 Jul 2011 11:52:37 +0200 Subject: [PATCH] script to manage recipes and fixed the older ones syntax accordingly --- pmwiki_recipes/graphformatexporter.php | 4 +-- pmwiki_recipes/groupstats.php | 4 ++- shell_scripts/pmwiki_recipes_info_listing | 43 +++++++++++++++++++++++ 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100755 shell_scripts/pmwiki_recipes_info_listing diff --git a/pmwiki_recipes/graphformatexporter.php b/pmwiki_recipes/graphformatexporter.php index 1893baf..b5de8e7 100644 --- a/pmwiki_recipes/graphformatexporter.php +++ b/pmwiki_recipes/graphformatexporter.php @@ -3,7 +3,7 @@ ## give a visual representation of pages and group $RecipeInfo['GraphCSV']['Version'] = '2010-04-11'; -SDV($HandleActions['graphcsv'],'GraphCSV'); +SDV($HandleActions['graphcsv'], 'GraphCSV'); SDV($HandleAuth['graphcsv'],'view'); function GraphCSV($pagename, $auth){ @@ -72,7 +72,7 @@ function GraphCSV($pagename, $auth){ return ; } -SDV($HandleActions['graphvan'],'GraphVAN'); +SDV($HandleActions['graphvan'], 'GraphVAN'); SDV($HandleAuth['graphvan'],'view'); function GraphVAN($pagename, $auth){ diff --git a/pmwiki_recipes/groupstats.php b/pmwiki_recipes/groupstats.php index c588d61..0601558 100644 --- a/pmwiki_recipes/groupstats.php +++ b/pmwiki_recipes/groupstats.php @@ -7,7 +7,9 @@ $RecipeInfo['GroupStats']['Version'] = '2011-08-06'; -$HandleActions['GroupStats'] = 'GroupStats'; # if url contains action=myaction call HandleMyAction timely + +SDV($HandleActions['GroupStats'], 'GroupStats'); +# if url contains action=myaction call HandleMyAction timely $HandleAuth['GroupStats'] = 'read'; # authorization level $auth for HandleMyAction function GroupStats($pagename, $auth){ diff --git a/shell_scripts/pmwiki_recipes_info_listing b/shell_scripts/pmwiki_recipes_info_listing new file mode 100755 index 0000000..74b793e --- /dev/null +++ b/shell_scripts/pmwiki_recipes_info_listing @@ -0,0 +1,43 @@ +#! /usr/bin/env bash + +# format the recipes in a repository or cookbook directory +# note that it requires a pretty strict and coherent syntax +# this is intended to be imported to a dedicated page +# e.g. pmwiki_recipes_info_listing > ~/www/devpim/import/Recipes.CurrentlyInstalled +# or manually pmwiki_recipes_info_listing | xclip +# +# TODO +# clean trailing comments +# s/#.*$// or s/\/\/.*$// +# add a hook (locally and/or remotely) to generate this after each commit + +WIKIPAGENAME=Recipes +RECIPESPATH=/home/fabien/repository/pmwiki_recipes +REPOSITORYURL="http://fabien.benetou.fr/repository/?p=.git;a=blob;f=pmwiki_recipes" + +echo "[[#RecipeMenuStart]]"; +for SCRIPT in `ls $RECIPESPATH`; +do + SCT=`echo $SCRIPT|sed "s/\.php//"` + echo "* [[$WIKIPAGENAME#$SCRIPT|$SCT]]"; +done +echo "[[#RecipeMenuEnd]]"; +echo "%comment%facilitate include in other pages%%"; +echo -e "\n----\n" +for SCRIPT in `ls $RECIPESPATH`; +do + echo -n '!'; + echo "[[#$SCRIPT]][[$REPOSITORYURL/$SCRIPT|$SCRIPT]]"; + grep RecipeInfo $SCRIPT | sed "s/.*= '\(.*\)';.*/* version (or date) \1/" ; + grep HandleAction $SCRIPT | sed "s/.*], '\(.*\)');.*/* action [[Path:?action=\1]]/" ; + grep ^Markup $SCRIPT | sed "s/.*:\(.*\):.*/* markup [@(:\1:)@]/" ; + echo "* functions"; + for FUNCTION in `grep ^function $SCRIPT | sed "s/^function \(.*\)(.*/\1/"` + do + PARAMS=`grep "^function $FUNCTION" $SCRIPT | sed "s/^function $FUNCTION(\(.*\)).*/\1/"` + FUNCTIONLINE=`grep -n "^function $FUNCTION" $SCRIPT | sed "s/:.*//"`; + echo "** [[$REPOSITORYURL#l$FUNCTIONLINE|$FUNCTION($PARAMS)]]"; + done + echo ""; +done +echo "%comment%generated via shell_scripts/pmwiki_recipes_info_listing%%";