File indexing completed on 2024-11-16 09:02:54
0001
0002
0003
0004 detector_file="./epic.xml"
0005
0006
0007
0008
0009
0010 get_includes() {
0011 local input_file="${1}"
0012
0013 local filelist=$(xmllint --format --xpath '//include/@ref' ${input_file} | sed 's/ref=\"//g' | sed 's/\"//g' )
0014 for afile in $filelist ; do
0015 xmllint --format --xpath '//include/@ref' ${input_file} &> /dev/null
0016 local res="$?"
0017 if [ "${res}" == "0" ] ; then
0018 local subincluded=$(xmllint --format --xpath '//include/@ref' ${input_file} 2> /dev/null | sed 's/ref=\"//g' | sed 's/\"//g' )
0019 filelist="${filelist} ${subincluded}"
0020
0021 fi
0022 done
0023
0024 local otherfiles=$(xmllint --format --xpath '//includes/file/@ref | //includes/gdmlFile/@ref' ${input_file} | sed 's/ref=\"//g' | sed 's/\"/\n/g' )
0025
0026 filelist=$(echo "${filelist} ${otherfiles}" | sed 's/ /\n/g' | sort | uniq )
0027 echo "$input_file $filelist"
0028 }
0029
0030
0031 xml_files=$(get_includes ${detector_file})
0032
0033
0034 get_doc_levels() {
0035
0036 local levels=0
0037 for afile in $xml_files ; do
0038 xmllint --format --xpath '//documentation/@level' $afile &> /dev/null
0039 local res="$?"
0040 if [ "${res}" == "0" ] ; then
0041 local new_levels=$(xmllint --format --xpath '//documentation/@level' $afile 2> /dev/null | sed 's/level=\"/ /g' | sed 's/\"//g' )
0042 levels="${levels} ${new_levels}"
0043 fi
0044
0045 xmllint --format --xpath '//documentation[not(@level)]' $afile &> /dev/null
0046 if [ "${?}" == "0" ] ; then
0047
0048 levels="${levels} 100"
0049 fi
0050 done
0051 echo "$levels" | sed 's/ /\n/g' | sort | uniq
0052 }
0053
0054 all_levels=$(get_doc_levels ${xml_file_array})
0055
0056
0057
0058 for alevel in $(echo ${all_levels} | sed 's/ /\n/g' | sort -n | uniq ) ; do
0059
0060 for afile in $(echo $xml_files | sed 's/ / \n/g') ; do
0061
0062
0063 level_doc=$(xmllint --format --xpath '//documentation[@level="'$alevel'"]' ${afile} 2> /dev/null )
0064 if [ "$?" -eq "0" ] ; then
0065 xmllint --format --xpath '//documentation[@level="'$alevel'"]/text()' ${afile} | sed -re 's/<\/?\w+>//g' | sed 's/^[[:space:]]*#/#/g'
0066 fi
0067
0068 xmllint --format --xpath '//documentation[not(@level)]/text()' ${afile} &> /dev/null
0069 if [ "$?" -eq "0" ] ; then
0070 if [ "$alevel" -eq "100" ] ; then
0071 xmllint --format --xpath '//documentation[not(@level)]/text()' ${afile} | sed -re 's/<\/?\w+>//g' | sed 's/^[[:space:]]*#/#/g'
0072 fi
0073 fi
0074 done
0075 done
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089