#/bin/bash # Copyright (c) 2005 MichalDominik (AT) gmail (DOT) com ; MIT X11 license # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT # SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR # THE USE OR OTHER DEALINGS IN THE SOFTWARE. ######################### MODIFY HERE FOR YOUR NEEDS ######################## EXTENSIONS="*.c *.h *.cs" # Files to parse AFTERLINES=10 # Number of context lines after BEFORELINES=3 # Number of context lines before PROJECT="Project" NOTE="This file was generated by fixme2html. You can customize this note" ################################## BANNER ################################### echo echo "/- fixme2html by MDK ---------------------------------------" echo "|" echo "| Generates a nice DOM HTML file out of the FIXMEs contained" echo "| in source files. Modify this script to fit your needs." echo "|" if [ -z "$1" ] ; then echo "| Usage: fixme2hmtl.sh outputfile" echo "|" echo "| You should run this script in the root directory of your" echo "| project" echo exit fi echo ############################# MAIN PROCESSING ################################# # Poormans method of clearing a file echo "" > $1 # Find files for each extension for extension in $EXTENSIONS do OLDIFS=$IFS IFS=: FILES="" FILES=`find ./ -iname "$extension" -printf "%p$IFS"` if [ -n "$FILES" ] ; then ALLFILES="$FILES$IFS$ALLFILES" ; fi IFS=$OLDIFS done OLDIFS=$IFS IFS=: ID=1 # For each file find fixmes for file in $ALLFILES do if [ -z "$file" ] ; then continue; fi FIXMES=`grep 'FIXME' $file` if [ -z "$FIXMES" ] ; then continue; fi echo "

$file

" >>$1 IFS=" " for fix in $FIXMES do MESSAGE="$fix" CONTEXT=`grep -n -A "$AFTERLINES" -B "$BEFORELINES" "$fix" $file` echo "
" >>$1 echo "

$fix

" >>$1 echo "
" >>$1 echo "
" >>$1
                echo "$CONTEXT" >>$1
                echo "
" >>$1 echo "
" >>$1 echo "
" >>$1 let "ID=ID+1" done IFS=: done ################################ HTML STUFF ################################### CONTENT=`cat $1` echo '

'"$PROJECT"'

'"$NOTE""$CONTENT" > $1