Commit 1757192b authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Renaming index.htm to index.html

parent f18ab7ed
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -87,10 +87,10 @@ pages:
    - |
     curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/updateIndex%2Epy/raw?ref=using_pages" >> updateIndex.py
    - |
     curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/index%2Ehtm/raw?ref=using_pages" >> index.htm
     curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/index%2Ehtml/raw?ref=using_pages" >> index.html
  script:
    - echo 'Publishing on pages'
    - ./publish_on_pages.sh updateIndex.py $CI_PAGES_URL ${CI_PROJECT_NAME} $CI_COMMIT_REF_NAME index.htm
    - ./publish_on_pages.sh updateIndex.py $CI_PAGES_URL ${CI_PROJECT_NAME} $CI_COMMIT_REF_NAME index.html $CLEAN_WEB_PAGES
  artifacts:
    paths:
      - public
 No newline at end of file
+0 −0

File moved.

+9 −2
Original line number Diff line number Diff line
@@ -17,10 +17,17 @@ if [ -e "content.zip" ]; then unzip "content.zip"; rm "content.zip"; fi
set -e

echo "------ Add/update content --------"
if [ $6 == 'true' ]; then 
    echo 'Removing all web pages content...'
	rm -r public/*;
else
	ls public/
fi

mkdir -p "public/$4"
cp -r -f "$3_$4.docx" public/$3
cp -r -f "$3_$4.docx" public/$4

docker run --rm -u $(id -u):$(id -g) "$DOCKER_IMAGE" $1 "$3_$4" "$4/$3_$4.docx" "$5"
docker run --rm -v $(pwd):/tmp -w /tmp "$DOCKER_IMAGE" pip install bs4 && python3 $1 "$3_$4" "$4/$3_$4.docx" "$5"
#echo "<a href="${CI_COMMIT_REF_NAME}/${CI_PROJECT_NAME}_${CI_COMMIT_TAG}.docx" target="_blank">$CI_COMMIT_REF_NAME</a>" >> "public/index.html"


+20 −18
Original line number Diff line number Diff line
@@ -7,17 +7,18 @@
#	License: BSD 3-Clause License. See the LICENSE file for further details.
#
from bs4 import BeautifulSoup
import argparse, os

def updateIndex(args:argparse.Namespace) -> None:
    
    # Check if index.htm exists
    if not os.path.exists('public/index.htm'):
        print("'index.htm' does not exist yet, using template")
    if not os.path.exists('public/index.html'):
        print("'index.html' does not exist yet, using template")
        with open(args.indexTemplate, 'r', encoding='utf-8') as file:
            html_content = file.read()
    else:
        # Read index HTML
        with open('index.htm', 'r', encoding='utf-8') as file:
        with open('public/index.html', 'r', encoding='utf-8') as file:
            html_content = file.read()

    # Analyze index content with BeautifulSoup
@@ -28,6 +29,7 @@ def updateIndex(args:argparse.Namespace) -> None:
    document_list = soup.find('ul', id='document-list')

    # Add the new element <li> for the new document
    if args.documentLink is not None and args.documentName is not None:
        li = soup.new_tag('li')
        a = soup.new_tag('a', href=args.documentLink)
        a.string = args.documentName
@@ -35,10 +37,10 @@ def updateIndex(args:argparse.Namespace) -> None:
        document_list.append(li)

    # Guarda el archivo HTML actualizado
    with open('index.htm', 'w', encoding='utf-8') as file:
    with open('public/index.html', 'w', encoding='utf-8') as file:
        file.write(str(soup))

    print("Index.htm updated")
    print("Index.html updated")