Changeset 259 for trunk/SRC/Documentation/xmldoc/pro2href.sh
- Timestamp:
- 08/20/07 16:03:17 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Documentation/xmldoc/pro2href.sh
r253 r259 8 8 # update : 9 9 # $Id$ 10 # fplod 2007-08-20T11:25:39Z aedon.locean-ipsl.upmc.fr (Darwin) 11 # correction from 12 # 4.11. How do I match only the first occurrence of a pattern? 13 # in sed faq http://www.student.northpark.edu/pemente/sed/sedfaq4.html#s4.11 10 14 #++ still not working perfectly because path of links on the different occurences of <pro>...</pro> may not be the same 11 15 # ex: see restoreboxparam.pro : domdef and saveboxparam … … 29 33 for file_html in ${list_html_pro} 30 34 do 35 # echo "file_html ${file_html}" 36 # read a 31 37 fpath=$(dirname ${file_html} | sed -e "s+\(${output}/\)\(.*\)+\2+") 32 list_llink=$(grep -n "<pro>.*</pro>" ${file_html} | awk -F ":" '{print $1}') 33 for line in ${list_llink} 38 list_link=$(tr -s " " "\n" < ${file_html} | grep "<pro>.*</pro>" | sed -e "s/^.*<pro>//" -e "s/<\/pro>.*$//") 39 # echo "liste link" ${list_link} 40 # read a 41 for link in ${list_link} 34 42 do 35 43 # replace <pro>something</pro> by 36 44 #<a href="something.html">something</a> 37 # module is the html file name to be used 38 module=$(sed -ne "${line},${line}p" ${file_html} | \ 39 grep "<pro>.*</pro>" | \ 40 sed -e "s+\(.*<pro>\)\([^<]*\)\(</pro>.*\)+\\2.html+g") 41 modulemin=$(echo ${module} | tr "[:upper:]" "[:lower:]" ) 45 # modulehtml is the html file name to be used 46 modulehtml=${link}.html 47 modulemin=$(echo ${modulehtml} | tr "[:upper:]" "[:lower:]" ) 42 48 # lpath is the path on module relatively to the location of 43 49 # the html file containing the <pro>...</pro> … … 46 52 then 47 53 echo "eee : path of ${modulemin} not found under ${output}" 48 echo "eee : ${ module} is used in ${file_html}"54 echo "eee : ${link} is used in ${file_html}" 49 55 else 50 56 lpath=$(dirname ${lpath} | sed -e "s+\(${output}/\)\(.*\)+\2+") … … 67 73 fi 68 74 #echo "relpath ${relpath}" 69 sed -e "${line}s+\(<pro>\)\([^<]*\)\(</pro>\)+<a href=\"${relpath}/\\2.html\">\2</a>+g" \ 75 cat <<EOF > /tmp/pro2href${$}.sed 76 1{x;s@^@first@;x;} 77 1,/<pro>${link}<\/pro>/{x;/first/s///;x;s@<pro>${link}<\/pro>@<a href="${relpath}/${link}.html">${link}<\/a>@;} 78 EOF 79 sed -f /tmp/pro2href${$}.sed \ 70 80 ${file_html} > ${file_html}_modify 71 81 mv ${file_html}_modify ${file_html} 82 rm /tmp/pro2href${$}.sed 72 83 fi 73 84 done
Note: See TracChangeset
for help on using the changeset viewer.