New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
manuals_checking.sh in NEMO/trunk/doc/bin – NEMO

source: NEMO/trunk/doc/bin/manuals_checking.sh @ 10550

Last change on this file since 10550 was 10550, checked in by nicolasmartin, 5 years ago

Modify script checking the LaTeX files to report the ones to be updated

  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#!/bin/sh
2
3#set -evx
4
5if [[ $* != '' ]]; then
6    if [[ $1 = 'all' ]]; then models='NEMO SI3 TOP'; else models=$1; fi
7else
8    models='NEMO'
9fi
10
11extract_arg() {
12    ## $1: macro name, $2: prefix for filtering args (optional)
13    eval grep -Poh "\\$1{\\$2\\\K[^}]+" ${tex_files} | tr -d '\\' | sort -u
14}
15
16for model in $models; do
17    [[ $model =~ ^(SI3|TOP)$ ]] && continue
18
19    tex_files=$( find latex/$model -type f -name *.tex )
20
21    echo '¤ Missing namelist groups in '$model' manual'
22
23    for nlst in $( ls namelists ); do
24        [[ ! $( grep \\nlst{$nlst} ${tex_files} ) ]] && printf '%s ' $nlst
25    done
26
27    echo; echo
28    echo '¤ Chapters with vanished entries in '$model' manual (\{hf,jp,key,mdl,ngn,nlst,np,rou}{...})'
29
30    for file in ${tex_files}; do
31
32        items=$( grep -Eho "(hf|jp|key|mdl|ngn|nlst|np|rou){[a-zA-Z0-9_\]*}" $file | sort -u )
33
34        [[ $items == '' ]] && continue
35
36        printf $file': '
37
38        for item in $items; do
39
40            if [[ ( $item =~ 'hf'   && ! $( find ../src -type f -name   $arg.h90               ) ) || \
41                  ( $item =~ 'jp'   && ! $( grep ":: *$arg"             ../src/OCE/par_oce.F90 ) ) || \
42                  ( $item =~ 'key'  && ! $( grep -ri "#if .* $arg"      ../src                 ) ) || \
43                  ( $item =~ 'mdl'  && ! $( find ../src -type f -name   $arg.[Ff]90            ) ) || \
44                  ( $item =~ 'ngn'  && ! $( grep \&$arg                 namelists/*            ) ) || \
45                  ( $item =~ 'nlst' && ! -f namelists/$arg                                       ) || \
46                  ( $item =~ 'np'   && ! $( grep " $arg *="             namelists/*            ) ) || \
47                  ( $item =~ 'rou'  && ! $( grep -ri "SUBROUTINE *$arg" ../src                 ) )      ]]; then
48                printf $item' '
49            fi
50
51        done
52
53        echo
54
55    done
56
57done
58
59echo
60echo '¤ Namelist parameters unfollowing naming conventions (^[cdlnr]n_* or uppercase somewhere)'
61
62for nlst in $( ls namelists ); do
63    np_list=$( sed '/^ *[!/&]/d; s|[!/&].*||' namelists/$nlst | tr -d ' ' | cut -d= -f1 )
64    array=()
65
66    for np in ${np_list}; do
67
68        if [[ ! ${np:0:3} =~ ^[cdlnr]n_$ || $( echo $np | grep [A-Z] ) ]]; then
69            array+=$np' '
70        fi
71
72    done
73
74    if (( ${#array[@]} != 0 )); then
75        printf '%15s: ' $nlst
76        echo ${array[@]}
77    fi
78
79done
80
81exit 0
Note: See TracBrowser for help on using the repository browser.