This is an automated email from the ASF dual-hosted git repository.

wave pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openoffice-org.git


The following commit(s) were added to refs/heads/main by this push:
     new 4539c83  Script debugging and markdown conversion awk script
4539c83 is described below

commit 4539c83765b18dddbebff672123a3d15a3711a0c
Author: Dave Fisher <d...@davefisher.tech>
AuthorDate: Sat Oct 31 22:07:26 2020 -0700

    Script debugging and markdown conversion awk script
---
 content/porting/topnav.mdtext | 41 -----------------------------------------
 content/style-test.md         |  6 +++---
 tools/convert2md.awk          | 29 +++++++++++++++++++++++++++++
 tools/convert2md.sh           |  8 +++++---
 tools/migration2git.sh        |  8 ++++----
 tools/push2git.sh             |  4 ++--
 6 files changed, 43 insertions(+), 53 deletions(-)

diff --git a/content/porting/topnav.mdtext b/content/porting/topnav.mdtext
deleted file mode 100644
index 91ed30d..0000000
--- a/content/porting/topnav.mdtext
+++ /dev/null
@@ -1,41 +0,0 @@
-type=${1}
-divid = divid: topnava
-divid: topnava
- = 
-
-- [Product][m0] = - [Product][m0]
-- [Product][m0]
-- [Download][m1] = - [Download][m1]
-- [Download][m1]
-- [Support][m2] = - [Support][m2]
-- [Support][m2]
-- [Blog][m3] = - [Blog][m3]
-- [Blog][m3]
-- [Extend][m4] = - [Extend][m4]
-- [Extend][m4]
-- [Develop][m5] = - [Develop][m5]
-- [Develop][m5]
-- [Focus Areas][m6] = - [Focus Areas][m6]
-- [Focus Areas][m6]
-- [Native Language][m7] = - [Native Language][m7]
-- [Native Language][m7]
- = 
-
- = 
-
-[m0] = [m0]:     /product/index.html                                           
"Apache OpenOffice product description"
-[m0]:    /product/index.html                                           "Apache 
OpenOffice product description"
-[m1] = [m1]:     /download/index.html                                          
"Download OpenOffice"
-[m1]:    /download/index.html                                          
"Download OpenOffice"
-[m2] = [m2]:     /support/index.html                                           
"Find Support for OpenOffice"
-[m2]:    /support/index.html                                           "Find 
Support for OpenOffice"
-[m3] = [m3]:     https://blogs.apache.org/ooo/                                 
"Apache OpenOffice Blog"
-[m3]:    https://blogs.apache.org/ooo/                                 "Apache 
OpenOffice Blog"
-[m4] = [m4]:     /extensions/index.html                                        
"Extensions and Templates for OpenOffice"
-[m4]:    /extensions/index.html                                        
"Extensions and Templates for OpenOffice"
-[m5] = [m5]:     https://openoffice.apache.org/get-involved.html               
"Get involved in Apache OpenOffice"
-[m5]:    https://openoffice.apache.org/get-involved.html               "Get 
involved in Apache OpenOffice"
-[m6] = [m6]:     /projects/accepted.html                                       
"Apache OpenOffice development focus areas"
-[m6]:    /projects/accepted.html                                       "Apache 
OpenOffice development focus areas"
-[m7] = [m7]:     /projects/native-lang.html                                    
"Apache OpenOffice in your Native Language"
-[m7]:    /projects/native-lang.html                                    "Apache 
OpenOffice in your Native Language"
diff --git a/content/style-test.md b/content/style-test.md
index 0cd5ae4..169948b 100644
--- a/content/style-test.md
+++ b/content/style-test.md
@@ -1,7 +1,7 @@
-title=This is the title
-notice=http://www.apache.org/licenses/LICENSE-2.0
+type=page
+Title=This is the title
+Notice=https://www.apache.org/licenses/LICENSE-2.0
 ~~~~~~
-
 # This is a level 1 header
 ## This is a level 2 header
 ### This is a level 3 header
diff --git a/tools/convert2md.awk b/tools/convert2md.awk
new file mode 100644
index 0000000..e2f42d3
--- /dev/null
+++ b/tools/convert2md.awk
@@ -0,0 +1,29 @@
+BEGIN {
+    META = 1;
+}
+// {
+    if ( META == 2 ) {
+       M = index($0," ");
+       if ( M == 1 ) next;
+       META = 1;
+    }
+    if ( META > 0 ) {
+       L = index($0,"Notice:");
+       if ( L == 1 ) {
+           META = 2;
+           print "Notice=https://www.apache.org/licenses/LICENSE-2.0";;
+           next;
+       }
+       N = sub(/\:[ \t]*/,"=",$0);
+       if ( N > 0 ) {
+           print $0;
+           next;
+       }
+       META = 0;
+       print "~~~~~~";
+    } else {
+       print $0;
+    }
+}
+END {
+}
diff --git a/tools/convert2md.sh b/tools/convert2md.sh
index e23ed0f..3cf4706 100755
--- a/tools/convert2md.sh
+++ b/tools/convert2md.sh
@@ -23,10 +23,12 @@
 # ${2} Path of mdtext file to convert to md file
 
 if test "$#" != 2; then
-  echo "USAGE: $0 Type Path
+  echo "USAGE: $0 Type Path"
   exit 1
 fi
 
-echo 'type=${1}' > ${GITPATH}/content/${2}
-nawk -f ${GITPATH}/tools/convert2md.awk ${2} >> ${GITPATH}/content/${2}
+MDPATH=${2:0:${#2}-4}
+echo "Convert "${2}" to "${MDPATH}
+echo "type="${1} > ${GITPATH}/content/${MDPATH}
+awk -f ${GITPATH}/tools/convert2md.awk ${2} >> ${GITPATH}/content/${MDPATH}
 
diff --git a/tools/migration2git.sh b/tools/migration2git.sh
index 875c958..1c04c90 100755
--- a/tools/migration2git.sh
+++ b/tools/migration2git.sh
@@ -22,12 +22,12 @@
 # ${1} Site folder to migrate
 
 if test "$#" != 1; then
-  echo "USAGE: $0 Folder
+  echo "USAGE: $0 Folder"
   exit 1
 fi
 
 cd ${SVNPATH}
-echo 'Migrating ${SVNPATH}/${1} to ${GITPATH}
+echo 'Migrating ${SVNPATH}/${1} to ${GITPATH}'
 echo
 # 1 - Tree structure
 echo 'copy directory structure to assets and content trees'
@@ -52,11 +52,11 @@ ${GITPATH}/tools/push2git.sh content ${1} 'html content'
 echo
 # 5 - Brand
 echo 'Convert brand'
-find ${1} -name "brand.mdtext" -type f -exec ${GITPATH}/tools/convert2md.sh 
brand {} \; -exec ${GITPATH}/tools/push2git.sh assets {} 'brand'\;
+find ${1} -name "brand.mdtext" -type f -exec ${GITPATH}/tools/convert2md.sh 
brand {} \; -exec ${GITPATH}/tools/push2git.sh content {} 'brand'\;
 echo
 # 6 - Navigators
 echo 'Convert navigators'
-find ${1} -name "*nav.mdtext" -type f -exec ${GITPATH}/tools/convert2md.sh 
navigator {} \; -exec ${GITPATH}/tools/push2git.sh assets {} 'navigator'\;
+find ${1} -name "*nav.mdtext" -type f -exec ${GITPATH}/tools/convert2md.sh 
navigator {} \; -exec ${GITPATH}/tools/push2git.sh content {} 'navigator'\;
 echo
 # 7 - Markdown
 echo 'Convert markdown pages'
diff --git a/tools/push2git.sh b/tools/push2git.sh
index 61ba3c9..a560363 100755
--- a/tools/push2git.sh
+++ b/tools/push2git.sh
@@ -24,11 +24,11 @@
 # ${3} Description for commit message - 'assets','large asset','html 
content','Markdown pages','brand','navigator'
 
 if test "$#" != 3; then
-  echo "USAGE: $0 Category Path Description
+  echo "USAGE: $0 Category Path Description"
   exit 1
 fi
 
 cd ${GITPATH}
 git add ${1}/${2}
-git commit -m 'Migration of ${2} ${3}'
+git commit -m '"Migration of "${2}" "${3}'
 git push

Reply via email to