Ignore:
Timestamp:
08/20/07 16:03:17 (17 years ago)
Author:
pinsard
Message:

improvment of links in idldoc outputs by modification of shell script and some pro files. add test for pro2href.sh. see 62

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/Documentation/xmldoc/pro2href.sh

    r253 r259  
    88# update : 
    99# $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 
    1014#++ still not working perfectly because path of links on the different occurences of <pro>...</pro> may not be the same  
    1115# ex: see restoreboxparam.pro : domdef and saveboxparam 
     
    2933   for file_html in ${list_html_pro} 
    3034   do 
     35#      echo "file_html ${file_html}" 
     36#      read a 
    3137       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} 
    3442       do 
    3543          # replace <pro>something</pro> by 
    3644          #<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:]" ) 
    4248          # lpath is the path on module relatively to the location of 
    4349          # the html file containing the <pro>...</pro> 
     
    4652          then 
    4753             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}" 
    4955          else 
    5056             lpath=$(dirname ${lpath} | sed -e "s+\(${output}/\)\(.*\)+\2+") 
     
    6773             fi 
    6874#echo "relpath ${relpath}" 
    69              sed -e "${line}s+\(<pro>\)\([^<]*\)\(</pro>\)+<a href=\"${relpath}/\\2.html\">\2</a>+g" \ 
     75             cat <<EOF > /tmp/pro2href${$}.sed 
     761{x;s@^@first@;x;} 
     771,/<pro>${link}<\/pro>/{x;/first/s///;x;s@<pro>${link}<\/pro>@<a href="${relpath}/${link}.html">${link}<\/a>@;} 
     78EOF 
     79             sed -f /tmp/pro2href${$}.sed \ 
    7080             ${file_html} > ${file_html}_modify 
    7181             mv ${file_html}_modify ${file_html} 
     82             rm /tmp/pro2href${$}.sed 
    7283          fi 
    7384       done 
Note: See TracChangeset for help on using the changeset viewer.