Subversion Repositories wimsdev

Rev

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

mailchar=.-@_$alnum

!if $modreq!=$empty
modreq=!word 1 of $modreq
!if / isin $modreq or .. isin $modreq
 modreq=
!endif
mtest=!filelist $devdir/$modreq
!if $mtest=$empty and ($modreq!=.new or $inddef=$empty)
 modreq=
!endif
!if $modreq=$empty
 job=modname
 !changeto $job.proc
!endif

!read scripts/getindex $modreq
!if $title=$empty and $inddef=$empty
 job=modname
 modreq=
 !changeto $job.proc
!endif

mod=$modreq

!if $inddef!=$empty
 inddef=
 !if $mod=.new
  !read scripts/target
  !if $error!=$empty or $target=$empty
   job=create
   !distribute item $target1,$t2,$t3,$target4 into o1,o2,o3,o4
   !changeto create.proc
  !endif
  mod=$target
 !endif
 !for i in title, description, category
  i_$i=!trim $(i_$i)
  !if $(i_$i)=$empty
   error=empty_data
   empty_data=$i
   job=index
   mod=
   !exit
  !endif
 !next i
 !if exercise isitemof $i_category or oef isitemof $i_category or\
        deductio isitemof $i_category
  !if exercise notitemof $i_category
   i_category=$i_category, exercise
  !endif
  !if oef isitemof $i_category or $deductio isitemof $i_category
   default=yes
  !else
   default=no
  !endif
  !bound i_scoring within yes, no default $default
 !else
  i_scoring=no
 !endif
 !if deductio isitemof $i_category
  i_vardef=deduc/var.def
 !endif
 !if oef isitemof $i_category
  i_vardef=oef/var.def
 !endif
 !if document isitemof $i_category
  i_vardef=docu/var.def
 !endif
 c=!char 1 of $i_description
 c=!lower $c
 i_description=!replace char number 1 by $c in $i_description
 c=!char -1 of $i_description
 !if $c!=.
  i_description=$i_description.
 !endif
 !bound i_language within $langlist default $module_language
 i_level=!listintersect $i_level and $levellist
 !default i_level=$levellist
 i_copyright=$copyright
 !default i_copyright=$gnu
 !if $year notwordof $i_copyright
  i_copyright=$i_copyright $year
 !endif
 i_require=!listintersect $i_require and $swlist
 !default i_author=$auth_name
 i_author=!char 1 to 100 of $i_author
 !if , notin in $i_author
   author1=!word 1 of $i_author
   author2=!word 2 to -1 of $i_author
   i_author=$author1, $author2
!endif
 !default i_address=$auth_email
 i_address=!items2words $i_address
 !!i_address=!word 1 of $i_address
 i_address=!words2items $i_address
 i_address=!text select ;,$mailchar in $i_address
 i_translator=!char 1 to 100 of $i_translator
 i_translator_address=!word 1 of $i_translator_address
 i_translator_address=!text select $mailchar in $i_translator_address
 i_version=!word 1 of $i_version
 i_wims_version=!word 1 of $i_wims_version
 !default i_version=1.00
 !default i_wims_version=$wims_version
 ###add fields not accessible by the interface for the moment
 ### will be useful in case of translation in the module itself
 deflist1=translation_language
 trans_lang=!words2items $translation_language
 trans_lang=!listintersect $trans_lang and $langlist
 !for l in $(trans_lang)
   deflist1=!append item title_$l to $deflist1
   deflist1=!append item description_$l to $deflist1
 !next
 !for l in $deflist1
  i_$l=$($l)
 !next
 i_translation_language=!items2words $i_translation_language
 #####
 i_mod_related=!words2items $i_mod_related
 i_mod_related=!text select _.-/,$alnum in $i_mod_related
 !default i_mod_related=$mod_related
 !if .. isin $i_mod_related
   i_mod_related=
 !endif
!! ### faut il faire une autre vérification ?
 #####
 !default i_data=$data
 !if .. isin $i_data
  i_data=
 !endif
 ind=# This file is automatically generated by $module_title $module_version.\
# Do not edit by hand.\
\

!if dialog isitemof $category
  i_category=exercise,dialog
!endif
!if scenario isitemof $category
  i_category=exercise,scenario
!endif
 cat1=!item 1 of $i_category
 !if document isin $i_category
  i_category=document
  cat1=doc
 !endif

 !for i in $deflist,$deflist1
  ind=$ind$i=$(i_$i)\

 !next i
 !if $cat1=exercise and , isin $i_category
  cat1=!item 2 of $i_category
 !endif
 !if $cat1=recreation
  cat1=exercise
 !endif
 dest=$devdir/$mod
 src=modules/template/$cat1.$i_language
 !sh if [ ! -e "$dest" ]; then\
   mkdir -p $dest\
   cp -pR $src/* $dest\
   if [ "$cat1" = "doc" ]; then\
    echo '*' >$dest/doc/1/.code\
    cat >$dest/doc/1/.def <<@\
tit=$i_title\
author=$i_author\
email=$i_address\
copyright=gnu\
dlang=$i_language\
docopen=yes\
header=\
@\
   fi\
  fi\
  echo "$ind" >$dest/INDEX
 !read scripts/getindex $mod
 wims_module_log=$mod/INDEX
!endif

!read files