|
|
|
#! /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
|
|
|
|
# directly generate and overwrite a PmWiki file in the right location rather than rely on import
|
|
|
|
# echo -e -n 'version=urlencoded=1\ntext=' > ~/www/devpim/wiki.d/Recipes.RecipesTest && ../shell_scripts/pmwiki_recipes_info_listing | sed "s/%/%25/g" | sed -e '{:q;N;s/\n/%0a/g;t q}' >> ~/www/devpim/wiki.d/Recipes.RecipesTest
|
|
|
|
|
|
|
|
WIKIPAGENAME=Recipes
|
|
|
|
RECIPESPATH=/home/fabien/repository/pmwiki_recipes
|
|
|
|
REPOSITORYURL="http://fabien.benetou.fr/repository/?p=.git;a=blob;f=pmwiki_recipes"
|
|
|
|
|
|
|
|
cd $RECIPESPATH
|
|
|
|
echo "[[#RecipeMenuStart]]";
|
|
|
|
for SCRIPT in `ls`;
|
|
|
|
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`;
|
|
|
|
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/$SCRIPT#l$FUNCTIONLINE|$FUNCTION($PARAMS)]]";
|
|
|
|
done
|
|
|
|
echo "";
|
|
|
|
done
|
|
|
|
echo "%comment%generated via shell_scripts/pmwiki_recipes_info_listing%%";
|