Subversion Repositories wimsdev

Rev

Rev 9828 | Rev 13292 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#! /bin/sh

cd `dirname $0`
cd ..
WIMS_HOME=`pwd`
if [ -f ../../log/wims.conf ] ; then
 language=`awk -F= '$1=="site_languages" {print $2;exit}' ../../log/wims.conf`
fi
if [ -z "$language" ] ; then
 language="en fr nl it es cn ca si"
fi
cd $WIMS_HOME/slib

cat <<@ >index.phtml
!! This file is automatically generated! Do not edit it.
!! Edit the script 'mkindex'.

!if adm/createxo isin \$module
  !set slib_cmd=help
!endif
!read tabletheme
!read lang/slib.phtml.\$lang
!if \$slib_lang_exists!=yes
  !read lang/slib.phtml.en
!endif
!default slib_cmd=resume
!default slib_detname=special_cmd
!set slib_detail=\$(\$slib_detname)

!if \$slib_detail!=\$empty
 !readproc slib/\$slib_detail slib_header
 !reset slib_lang_exists_tmp
 !readproc help/\$lang/slib/\$slib_detail
 !if \$slib_lang_exists_tmp!=yes
  !readproc help/en/slib/\$slib_detail
 !endif
 !distribute lines \$slib_parms into slpcnt,slp1,slp2,slp3,slp4,slp5,slp6,slp7,slp8,slp9,slp10,slp11,slp12
 !for i=1 to \$slpcnt
  !set slpdflt\$i=!item 1 of \$(slp\$i)
  !set slp\$i=!item 2 to -1 of \$(slp\$i)
 !next i
 !readproc namewriting.phtml \$slib_author
 !set slib_author=\$script_out
 !reset table_center
 \$table_header
 <caption>\$wims_name_slib</caption>
 \$table_tr<th>\$wims_name_name</th><td class="tt">\$slib_detail</td></tr>
 \$table_tr<th>\$wims_name_title</th><td>\$slib_title</td></tr>
 \$table_tr<th>\$wims_name_Author</th><td>\$slib_author</td></tr>
 \$table_tr<th>\$wims_name_call1</th><td class="tt">!readproc slib/\$slib_detail [parameters]
 <br />(\$wims_name_result slib_out) </td></tr>
 \$table_tr<th>\$wims_name_call2</th><td class="tt">slib(\$slib_detail [parameters])</td></tr>
 \$table_tr<th>\$wims_name_Parameters</th><td>
 !if \$slpcnt>1
  !if + isin \$slpcnt
   \$wims_name_variable_list
  !else
   \$wims_name_upto
  !endif
 !else
  \$slpcnt
 !endif
 </td></tr>
 !for i=1 to \$slpcnt
  \$table_tr<th>\$wims_name_Parameter \$i
  !ifval \$i=\$slpcnt and + isin \$slpcnt
   and up
  !endif
  </th>
  <td>\$(slp\$i)
  !if \$(slpdflt\$i)!=\$empty
   <em>(\$wims_name_default: \$(slpdflt\$i))</em>
  !endif
  </td></tr>
 !next i
 \$table_tr<th>\$wims_name_Output</th><td>\$slib_out</td></tr>
 !if \$slib_comment!=\$empty
  \$table_tr<th>\$wims_name_comment</th><td>\$slib_comment</td></tr>
 !endif
 !if \$slib_require!=\$empty
    \$table_tr<th>\$wims_name_Required_Software</th><td class="tt">\$slib_require</td></tr>
 !endif
 !if \$slib_example!=\$empty
!set excnt=!linecnt \$slib_example
  \$table_tr<th>\$wims_name_Example OEF </th><td>
  !for i=1 to \$excnt
 !set  slib_exemple=!line \$i of \$slib_example
 <hr />
<p class="tt spacer">\text{A=slib(\$slib_detail \$slib_exemple)}</p>
  !set slib_wims_backslash=\$wims_backslash_insmath
  !set wims_backslash_insmath=yes
  !readproc  slib/\$slib_detail \$slib_exemple
   <p>\$wims_name_Output:</p>
  !if table notin \$slib_out and object notin \$slib_out and bubble notin \$slib_out and geogebra notin \$slib_detail
   <pre>\$slib_out</pre>
  !else
   \$slib_out
  !endif
  !set wims_backslash_insmath=\$slib_wims_backslash
  !reset slib_wims_backslash
  !next i
  !reset slib_exemple
  </td></tr>
 !endif

 \$table_end
 !reset \$slib_detname
 !exit
!endif
\$wims_name_instruction

!read slib/index.phtml.\$lang
@
for ll in $language
do
  echo  "!! This file is automatically generated! Do not edit it.
!! Edit the script 'mkindex'.

!reset table_center
<h2>\$wims_name_listslib</h2>
<div id='listslib'>
   <ul>" > index.phtml.$ll
  echo  "" > index.phtml.temp
  cnt_slib_tot=0

  for categorie in `find . -maxdepth 1 -type d | sed 's!^\./!!g' |  egrep -v '\/\.svn\/'  | sort`
  do
    if [ "$categorie" = "." ];then
      cat_name="\$wims_name_All"
    else
      cat_name="$categorie"
    fi
    cat <<@ >>index.phtml.temp
    <div id="content_$categorie">
    \$table_header
    <caption>$cat_name</caption>
    \$table_tr<th>\$wims_name_name</th><th>\$wims_name_Output</th></tr>
@
    cnt_slib=0
    for f in `find ./$categorie -type f | sed 's!^\./!!g' | sed 's!^\./!!g' | grep ./ |  egrep -v '\/\.svn\/' |  egrep -v '\.html'| sort`
    do
      if [ -f "$WIMS_HOME/help/$ll/slib/$f" ]; then
        tit=`awk -F= '$1=="slib_title" {print $2; exit}' $WIMS_HOME/help/$ll/slib/$f`
      fi
      if [ -z "$tit" ]; then
        if [ -f "$WIMS_HOME/help/en/slib/$f" ]; then
          tit=`awk -F= '$1=="slib_title" {print $2; exit}' $WIMS_HOME/help/en/slib/$f`
        else
         tit=`awk -F= '$1=="slib_title" {print $2; exit}' $f`
        fi
      fi
      if [ -n "$tit" ]; then
        #echo $f
        cnt_slib=`expr $cnt_slib + 1`
        if [ $cnt_slib -ge 1 ]; then
        cat <<@ >>index.phtml.temp
        \$table_tr<td class="tt wims_code_words">$f</td><td>$tit
        !href cmd=\$slib_cmd&special_parm=slib&\$slib_detname=$f\$slib_detailanchor [\$wims_name_detail]
        </td></tr>
@
        fi;
        tit=''
      fi
    done
    echo "'$cat_name' done ($cnt_slib)"
    cat <<@ >>index.phtml.temp
    \$table_end
    </div>
@

  cat <<@ >>index.phtml.$ll
      <li>
       <a href="#content_$categorie">
         $cat_name ($cnt_slib)</a>
      </li>
@
  cnt_slib_tot=`expr $cnt_slib_tot + $cnt_slib`
  done

  cat <<@ >>index.phtml.$ll
      </ul>
@

  cat index.phtml.temp >>index.phtml.$ll
  cat <<@ >>index.phtml.$ll
      </div>
      !!# Si les librairies Jquery sont chargées, on affiche des onglets.
      !if \$jquery_defined=yes
        <script type="text/javascript">
          /*<![CDATA[*/ jQuery(function(jq) {
            jq( "#listslib" ).tabs().addClass( "ui-tabs-vertical ui-helper-clearfix" );
            jq( "#listslib li" ).removeClass( "ui-corner-top" ).addClass( "ui-corner-left" );
            jq( "#listslib li a" ).click(function() {
              //get the top offset of the target anchor
              var target_offset = jq("#listslib").offset();
              var target_top = target_offset.top;
              //goto that anchor by setting the body scroll top to anchor top
              jq('html, body').animate({scrollTop:target_top});
            });
          }); /*]]>*/
        </script>

        <style type='text/css'>
          /*.ui-tabs-vertical { width: 55em; }*/
          .ui-tabs-vertical .ui-tabs-nav { padding: .2em .1em .2em .2em; float: left; /*width: 12em;*/ }
          .ui-tabs-vertical .ui-tabs-nav li { clear: left; width: 100%; border-bottom-width: 1px !important; border-right-width: 0 !important; margin: 0 -1px .2em 0; }
          .ui-tabs-vertical .ui-tabs-nav li a { display:block; }
          .ui-tabs-vertical .ui-tabs-nav li.ui-tabs-active { padding-bottom: 0; padding-right: .1em; border-right-width: 1px; }
          .ui-tabs-vertical .ui-tabs-panel { margin-left: 1em; float: left; width: 70%;}
          .ui-tabs-vertical .ui-tabs-panel .wimstable { width: 100%;}
        </style>

      !endif
@

  echo "*** '$ll' done ($cnt_slib_tot)"
  echo
done
echo
echo Indexed $cnt_slib_tot scripts.
echo