]> nuage.metani.fr Git - 3GPP.git/blobdiff - bin/docx2asn.sh
Add command to set git proxy to windows system proxy
[3GPP.git] / bin / docx2asn.sh
index 832f1342570582972a56665fc5ca8e7617692fde..89bb19f1d4a3f3157a94ffea9155947fa690782d 100755 (executable)
@@ -11,12 +11,12 @@ if [[ ! -w . ]] ; then
     exit 1
 fi
 
-echo "platform est $platform"
+platform=$(uname)
 
 case $platform in
     Linux) libreoffice="libreoffice" ;;
     CYGWIN*) libreoffice="soffice" ;;
-    *) print "Unkown platform $platform"
+    *) echo "Unkown platform $platform"
        exit 1;;
 esac
 
@@ -47,6 +47,23 @@ while [ "$#" -gt 0 ]; do
            shift
            continue
        fi
+
+       case $platform in
+           # Replace EN-DASH (UTF-8 encoding) at line start with -
+           Linux) LC_ALL=C sed -i $'s/^\u2013/-/g' "${1%.docx}.txt" ;;
+           
+           # Replace EN-DASH (Windows-1252 encoding) at line start with -
+           # Remove CR (0x0d) put by libreoffice in windows before each LF (0x0a)
+           CYGWIN*) LC_ALL=C sed -i $'s/^\x96/-/g; s/\r$//' "${1%.docx}.txt" ;;
+           *) echo "Unkown platform $platform"
+              exit 1;;
+       esac
+
+       # Changes things that should not be so in the specification
+       # Change "-- Cond N3C MP" to "-- Cond N3C-MP" (to respect condition naming rules)
+       LC_ALL=C sed -i 's/-- Cond N3C MP/-- Cond N3C-MP/' "${1%.docx}.txt"
+       LC_ALL=C sed -i 's/^N3C MP/N3C-MP/' "${1%.docx}.txt"
+       LC_ALL=C sed -i 's/-- Cond HOAndServCellAdd,$/-- Cond HOAndServCellAdd/' "${1%.docx}.txt"
     fi
 
     if [[ -e "${1%.docx}.asn" ]] ; then
@@ -54,7 +71,8 @@ while [ "$#" -gt 0 ]; do
        shift
        continue
     fi
-    
+
+       
     cat "${1%.docx}.txt" | awk '/^-- ASN1START$/,/^-- ASN1STOP$/' | grep -Evxe '-- ASN1ST(ART|OP)' | grep -v '^--' | awk 'NF || p; { p = NF }' p=0 > "${1%.docx}.asn"
 
     if [[ -e "${1%.docx}.asn" ]] ; then