From b97c6125c55be46890189d73ecd9efcd2bb485dc Mon Sep 17 00:00:00 2001 From: Jose Miguel Guzman Date: Mon, 7 Jun 2021 13:35:43 -0400 Subject: [PATCH 1/4] Improve scripts --- README.md | 7 +------ fix_cross_references.sh | 10 +++++++++ upload-doc.sh | 45 ++++++++++++++++++++++++++++++++--------- 3 files changed, 46 insertions(+), 16 deletions(-) create mode 100755 fix_cross_references.sh diff --git a/README.md b/README.md index ebbf539..1fd90fe 100644 --- a/README.md +++ b/README.md @@ -24,14 +24,9 @@ Before proceeding, **make sure that there are no uncommitted changes in your wor Then run: ```bash -# Clean previous html make clean -# Fix references to sections in other docs -for i in [0-1]*.md; do sed -i "s/\.md\#/\.html\#/g" $i; done -# Build html documentation make html -# Restore the markdown files to their previous state -git reset --hard +./fix_cross_references.sh ``` The generated HTML output is stored in `_build/html`. You can go to that folder and publish the content locally with a Simple HTTP Server in Python. diff --git a/fix_cross_references.sh b/fix_cross_references.sh new file mode 100755 index 0000000..ab23e75 --- /dev/null +++ b/fix_cross_references.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# +# This is needed to fix a bug in sphinx +# Otherwise, cross-references in html will point to a .md file +# +for file in $(find _build -name "*.html") +do + sed -r -E -i "s/href=\"(.*)\.md\#/href=\"\1.html#/g" ${file} +done + diff --git a/upload-doc.sh b/upload-doc.sh index 3a19fef..3e2e369 100755 --- a/upload-doc.sh +++ b/upload-doc.sh @@ -1,18 +1,43 @@ #!/bin/bash +# +# Script to upload documentation to ETSI site +# + +SERVER="ftp://osm-download.etsi.org" +FOLDER="user-guid" +FTP_OPTS="" +# +# Generate Statit Site +# make clean -for i in [0-1]*.md; do sed -i "s/\.md\#/\.html\#/g" $i; done make html -read -p "Please enter your username for FTP server (ETSI On Line account): " USER_INPUT -read -sp "Please enter your password for FTP server: " PASSWORD_INPUT -echo -lftp -u $USER_INPUT,$PASSWORD_INPUT ftp://osm-download.etsi.org << ! + +# +# Fix cross-references +# +./fix_cross_references.sh + +# +# Get credentias (file or interactive) +# +if [ local/.credentials ]; then + source local/.credentials + echo SERVER=${SERVER} + echo USERNAME=${USERNAME} +else + echo "Enter credentials for ${SERVER} (ETSI On Line account)" + read -p "Username: " USERNAME + read -sp "Password: " PASSWORD +fi + +lftp ${FTP_OPTS} -u ${USERNAME},${PASSWORD} ${SERVER} << ! set ftp:ssl-allow no lcd _build cd Documentation - mirror -R html user-guide-new - rm -r user-guide - mv user-guide-new user-guide + + mirror -R html ${FOLDER}-new + rm -r ${FOLDER}-old + mv ${FOLDER} ${FOLDER}-old + mv ${FOLDER}-new ${FOLDER} bye ! -git reset --hard - -- GitLab From 0e65830beb7f1df37e9619111042844d34e73129 Mon Sep 17 00:00:00 2001 From: Jose Miguel Guzman Date: Mon, 7 Jun 2021 13:38:28 -0400 Subject: [PATCH 2/4] Fix typo --- upload-doc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upload-doc.sh b/upload-doc.sh index 3e2e369..07d4cca 100755 --- a/upload-doc.sh +++ b/upload-doc.sh @@ -4,7 +4,7 @@ # SERVER="ftp://osm-download.etsi.org" -FOLDER="user-guid" +FOLDER="user-guide" FTP_OPTS="" # # Generate Statit Site -- GitLab From fe8b54e9612d808cf6e7603b381d23c98485be3f Mon Sep 17 00:00:00 2001 From: Jose Miguel Guzman Date: Sat, 12 Jun 2021 15:38:00 -0400 Subject: [PATCH 3/4] improve scripts --- .gitignore | 3 ++- env | 9 +++++++++ updater.sh | 13 +++++++++++++ upload-doc.sh | 5 ++--- 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 env create mode 100755 updater.sh diff --git a/.gitignore b/.gitignore index e35d885..6a35bda 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -_build +_build*/ +local/ diff --git a/env b/env new file mode 100644 index 0000000..df7a01d --- /dev/null +++ b/env @@ -0,0 +1,9 @@ +#!/bin/bash +SERVER="ftp://osm-download.etsi.org" +FOLDER="user-guide" +FTP_OPTS="" + +# Define your FTP credentials in a separate (private file) +# local/.credentials +# USERNAME= +# PASSWORD= diff --git a/updater.sh b/updater.sh new file mode 100755 index 0000000..c0c2df7 --- /dev/null +++ b/updater.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# URL References +for file in *.md; +do + echo ${file} + sed -i "s/\/ReleaseNINE/\/ReleaseTEN/g" ${file}; + sed -i "s/\/osm-9.0-nine\//\/osm-10.0-ten\//g" ${file}; + sed -i "s/releasenine/releaseten/g" ${file}; +done + +# Special +sed -i "s/NINE/TEN/g" 01-quickstart.md diff --git a/upload-doc.sh b/upload-doc.sh index 07d4cca..e7dc23e 100755 --- a/upload-doc.sh +++ b/upload-doc.sh @@ -3,9 +3,8 @@ # Script to upload documentation to ETSI site # -SERVER="ftp://osm-download.etsi.org" -FOLDER="user-guide" -FTP_OPTS="" +source ./env + # # Generate Statit Site # -- GitLab From a5b78e0f6eb5e6f5b51e61df2507cc098b8b94f2 Mon Sep 17 00:00:00 2001 From: Jose Miguel Guzman Date: Sat, 12 Jun 2021 17:02:45 -0400 Subject: [PATCH 4/4] README: public URL --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1fd90fe..22b043c 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ This document collects Open Source MANO User Guide. +It is published at [https://osm.etsi.org/docs/user-guide/](https://osm.etsi.org/docs/user-guide/) + ## Guidelines for contributors - OSM [Workflow for documentation production](https://osm.etsi.org/gitlab/osm-doc/documentation-how-to/blob/master/Workflow%20for%20documentation%20production%20in%20OSM.md#guide-for-contributors) must be used. -- GitLab