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 @ 10568

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

Fix for a consistent output of the index entries to review in the NEMO manual

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