From d1fceb47971d47a09371db492b646e220e46d17b Mon Sep 17 00:00:00 2001 From: varshith Date: Wed, 29 May 2024 14:16:38 +0200 Subject: [PATCH 01/11] datafetch keywords --- .gitignore | 3 +- web/content/datasets/_index.md | 2 +- web/layouts/shortcodes/datafetch.html | 57 +++++++++++---------------- 3 files changed, 26 insertions(+), 36 deletions(-) diff --git a/.gitignore b/.gitignore index 49e38a1..41d180c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ web/public/* web/content/datasets/test* web/data/* -dev_utils/config.yaml \ No newline at end of file +dev_utils/config.yaml +web/static/pagefind \ No newline at end of file diff --git a/web/content/datasets/_index.md b/web/content/datasets/_index.md index 3facddc..618f4a7 100644 --- a/web/content/datasets/_index.md +++ b/web/content/datasets/_index.md @@ -1,5 +1,5 @@ --- -title: "Test" +title: "Search" date: 2024-03-20T10:31:33+01:00 layout: test --- diff --git a/web/layouts/shortcodes/datafetch.html b/web/layouts/shortcodes/datafetch.html index e791a51..3f50647 100644 --- a/web/layouts/shortcodes/datafetch.html +++ b/web/layouts/shortcodes/datafetch.html @@ -1,14 +1,28 @@ {{- $variable := .Get "variable" -}} -
+
{{ $data := index .Site.Data.datasets $variable }} {{ if $data }} - {{ $stringAttributes2 := index $data.LANDING_PAGE.ATTRIBUTES.STRING_ATTRIBUTE }} - {{ $rte := where $stringAttributes2 "TAG" "header" }} - {{ range $rte }} -

{{ .VALUE }}

- {{ end }} - - + + {{ $stringAttributes := index $data.LANDING_PAGE.ATTRIBUTES.STRING_ATTRIBUTE }} + {{ $setAttributes := index $data.LANDING_PAGE.ATTRIBUTES.SET_ATTRIBUTE }} + {{ $numAttributes := index $data.LANDING_PAGE.ATTRIBUTES.NUMERIC_ATTRIBUTE }} + + {{ range $rte := where $stringAttributes "TAG" "header" }} +

{{ index $rte "VALUE" }}

+ {{end }} + + {{ $rtes := where $setAttributes "TAG" "keywords"}} + {{range $ty := index $rtes}} + {{range $er := index .VALUE.STRING_ATTRIBUTE }} + {{.VALUE}}, + {{end}} + {{end}} +
+ + {{ range $rte := where $stringAttributes "TAG" "header" }} + + {{end }} + {{ $stringAttributes := index $data.LANDING_PAGE.ATTRIBUTES.STRING_ATTRIBUTE }} {{ $filtered := where $stringAttributes "TAG" "!=" "header" }} {{ $filtered := where $filtered "TAG" "!=" "rems_link" }} @@ -19,36 +33,11 @@

{{ .VALUE }}

{{ end }} - - - {{ range index $data.LANDING_PAGE.ATTRIBUTES.SET_ATTRIBUTE }} - - - - - {{ end }} - - - - - {{ $numAttributes := index $data.LANDING_PAGE.ATTRIBUTES.NUMERIC_ATTRIBUTE }} - {{ range $numAttributes }} - - - - - {{ end }} +
{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ .VALUE.STRING_ATTRIBUTE.VALUE }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ .VALUE }}
{{ else }}

Data for '{{ $variable }}' not found.

{{ end }}

Comments

- {{ $stringAttributes2 := index $data.LANDING_PAGE.ATTRIBUTES.STRING_ATTRIBUTE }} - {{ $rte := where $stringAttributes2 "TAG" "rems_link" }} - {{ range $rte }} -

Apply for access

-

If you are interested to access data, apply through clicking link above

- - {{ end }}
From 88bc2f70ffe67473e91443ba5fda8b7a52b601f0 Mon Sep 17 00:00:00 2001 From: varshith Date: Wed, 29 May 2024 16:29:54 +0200 Subject: [PATCH 02/11] nav bar styling --- web/layouts/partials/nav.html | 32 ++++++++++++++++++------ web/static/css/style.css | 47 ++++++++++++++++++++--------------- 2 files changed, 51 insertions(+), 28 deletions(-) diff --git a/web/layouts/partials/nav.html b/web/layouts/partials/nav.html index c7947d3..7583b1e 100644 --- a/web/layouts/partials/nav.html +++ b/web/layouts/partials/nav.html @@ -1,15 +1,31 @@ -
+ diff --git a/web/static/css/style.css b/web/static/css/style.css index ff12ef1..dd08553 100644 --- a/web/static/css/style.css +++ b/web/static/css/style.css @@ -45,32 +45,39 @@ body { .project-tagline { opacity: 0.9; } - - - - .topnav { - position: relative; - background-color: #fff; - overflow: hidden; - padding: 1rem; - text-align: center; - } +.topnav { + display: flex; + justify-content: space-between; + align-items: center; + width: 100%; + height: 50px; + background-color: #fff; + padding: 0.7rem; + transition: padding 0.9s, background-color 0.9s; + z-index: 1000; /* Ensure it's above other content */ + box-shadow: 0 10px 20px rgba(0,0,0,0.03),0 6px 6px rgba(0,0,0,0.07); +} +.topnav.shrink { + padding: 0.3rem; /* Adjust the padding as needed */ + box-shadow: 0 10px 20px rgba(0,0,0,0.03),0 6px 6px rgba(0,0,0,0.07); +} .topnav a { color:rebeccapurple; padding:20px; font-weight:700; - text-decoration:none + text-decoration:none; } - .topnav { - position:relative; - background-color:white; - overflow:hidden; - padding:1rem; - text-align:center - } - - + .logo-nav-container{ + height: 50px; + } + #nav-logo{ + width: auto; + } + .nav-links{ + display: flex; + align-self: center; + } .heading-for-site{ margin-top: 0.5rem; margin-bottom: 0.5rem; color: #1C007B;} @media screen and (min-width: 64em) { .project-name { font-size: 3.25rem; } } @media screen and (min-width: 42em) and (max-width: 64em) { .project-name { font-size: 2.25rem; } } From ca41431dc9c37f9f1f633163a0594f70e26a0219 Mon Sep 17 00:00:00 2001 From: varshith Date: Thu, 30 May 2024 10:36:47 +0200 Subject: [PATCH 03/11] add more fail safe cases for datafetch template --- web/layouts/shortcodes/datafetch.html | 176 +++++++++++++++++++++++--- 1 file changed, 156 insertions(+), 20 deletions(-) diff --git a/web/layouts/shortcodes/datafetch.html b/web/layouts/shortcodes/datafetch.html index 3f50647..6bcad84 100644 --- a/web/layouts/shortcodes/datafetch.html +++ b/web/layouts/shortcodes/datafetch.html @@ -9,31 +9,167 @@ {{ range $rte := where $stringAttributes "TAG" "header" }}

{{ index $rte "VALUE" }}

- {{end }} + {{end}} - {{ $rtes := where $setAttributes "TAG" "keywords"}} - {{range $ty := index $rtes}} - {{range $er := index .VALUE.STRING_ATTRIBUTE }} - {{.VALUE}}, - {{end}} + {{range $rte := where $setAttributes "TAG" "keywords"}} + {{range $er := index $rte.VALUE.STRING_ATTRIBUTE}}{{.VALUE}},{{end}} {{end}} - - {{ range $rte := where $stringAttributes "TAG" "header" }} - - {{end }} - - {{ $stringAttributes := index $data.LANDING_PAGE.ATTRIBUTES.STRING_ATTRIBUTE }} - {{ $filtered := where $stringAttributes "TAG" "!=" "header" }} - {{ $filtered := where $filtered "TAG" "!=" "rems_link" }} - {{ range $filtered }} - - - + + {{ range $rte := where $stringAttributes "TAG" "dataset_name" }} + + + {{end }} + + {{ range $rte := where $stringAttributes "TAG" "dataset_short_name" }} + + + {{end }} + + + {{ range $rte := where $stringAttributes "TAG" "doi" }} + + + {{end }} + + + {{ range $rte := where $stringAttributes "TAG" "animal_species" }} + + + {{end }} + + + {{ range $rte := where $stringAttributes "TAG" "anatomical_site" }} + + + {{end }} + + {{$medicalDiagnosis := where $stringAttributes "TAG" "medical_diagnosis"}} + {{if gt (len $medicalDiagnosis) 0}} + + + + + {{end}} - {{ end }} - + + {{ range $rte := where $numAttributes "TAG" "number_of_wsis" }} + + + {{end }} + + + {{ range $rte := where $numAttributes "TAG" "number_of_cases" }} + + + {{end }} + + + {{ range $rte := where $numAttributes "TAG" "number_of_biological_beings" }} + + + {{end }} + + + {{ range $rte := where $numAttributes "TAG" "number_of_observations" }} + + + {{end }} + + + {{ range $rte := where $numAttributes "TAG" "dataset_size" }} + + + {{end }} + + + {{ range $rte := where $setAttributes "TAG" "age_at_extractions" }} + + + {{end }} + + + {{ range $rte := where $stringAttributes "TAG" "geographical_area" }} + + + {{end }} + + + {{ range $rte := where $stringAttributes "TAG" "extraction_method" }} + + + {{end }} + + + {{ range $rte := where $stringAttributes "TAG" "specimen_type" }} + + + {{end }} + + + {{ range $rte := where $stringAttributes "TAG" "image_type" }} + + + {{end }} + + + {{ range $rte := where $numAttributes "TAG" "image_resolution" }} + + + {{end }} + + + {{ range $rte := where $numAttributes "TAG" "number_of_annotations" }} + + + {{end }} + + + {{ range $rte := where $numAttributes "TAG" "year_of_submission" }} + + + {{end }} + + + {{ range $rte := where $stringAttributes "TAG" "dataset_version" }} + + + {{end }} + + + {{ range $rte := where $stringAttributes "TAG" "metadata_standard_version" }} + + + {{end }} + + + {{ range $rte := where $stringAttributes "TAG" "center_name" }} + + + {{end }} + + + {{ range $rte := where $stringAttributes "TAG" "cite_as" }} + + + {{end }} + + + {{ range $rte := where $stringAttributes "TAG" "reference" }} + + + {{end }} +
{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ .VALUE }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " (index $medicalDiagnosis 0).TAG }} + {{ $length := len $medicalDiagnosis }} + {{ range $index, $rte := $medicalDiagnosis }} + {{ index $rte "VALUE" }}{{ if ne $index (sub $length 1) }}, {{ end }} + {{ end }} +
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }} + {{ range index $rte.VALUE.STRING_ATTRIBUTE }} + {{.VALUE}} + {{end}} +
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ replaceRE `(_{1,})` " " .TAG }}{{ index $rte "VALUE" }}
{{ else }}

Data for '{{ $variable }}' not found.

From 314074baa648bb40d20d1f4a7313c7d7df37b085 Mon Sep 17 00:00:00 2001 From: varshith Date: Thu, 30 May 2024 10:38:29 +0200 Subject: [PATCH 04/11] added UI elements for search functionality --- web/layouts/_default/baseof.html | 10 +++++----- web/layouts/datasets/list.html | 12 +++++++++--- web/layouts/partials/head.html | 3 +++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/web/layouts/_default/baseof.html b/web/layouts/_default/baseof.html index d759183..bee3ea8 100644 --- a/web/layouts/_default/baseof.html +++ b/web/layouts/_default/baseof.html @@ -1,18 +1,18 @@ + {{ partial "head.html" . }} -{{ partial "nav.html" . }} + + + {{ partial "nav.html" . }} -{{ block "header" .}} -{{ end }} - -
+
{{ block "main" . }} {{ end }} diff --git a/web/layouts/datasets/list.html b/web/layouts/datasets/list.html index 494b337..5b4e787 100644 --- a/web/layouts/datasets/list.html +++ b/web/layouts/datasets/list.html @@ -1,11 +1,17 @@ {{ define "main" }}

Bigpicture Datasets

-
    + + From ae5664b8d5bcf9ff6cf50b71efa1d5640d69a88a Mon Sep 17 00:00:00 2001 From: varshith Date: Tue, 11 Jun 2024 09:58:29 +0200 Subject: [PATCH 06/11] rems link datafetch updated with new schema --- web/layouts/shortcodes/datafetch.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/layouts/shortcodes/datafetch.html b/web/layouts/shortcodes/datafetch.html index 3720a3a..9e2e2ab 100644 --- a/web/layouts/shortcodes/datafetch.html +++ b/web/layouts/shortcodes/datafetch.html @@ -220,4 +220,6 @@

    Terms of use

    {{end }} + +

    Apply for access

From 7bf99539ccc57e7e04ed541c66d0e5032e8d1046 Mon Sep 17 00:00:00 2001 From: varshith Date: Tue, 11 Jun 2024 10:18:29 +0200 Subject: [PATCH 07/11] added header extractor for markdown front mattter --- header_extractor.go | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 header_extractor.go diff --git a/header_extractor.go b/header_extractor.go new file mode 100644 index 0000000..6dc97dc --- /dev/null +++ b/header_extractor.go @@ -0,0 +1,48 @@ +package main + +import ( + "encoding/xml" + "log" + "os" +) + +// Struct definitions +type LandingPageSet struct { + LandingPage LandingPage `xml:"LANDING_PAGE"` +} + +type LandingPage struct { + Attributes Attributes `xml:"ATTRIBUTES"` +} + +type Attributes struct { + StringAttributes []StringAttribute `xml:"STRING_ATTRIBUTE"` +} + +type StringAttribute struct { + Tag string `xml:"TAG"` + Value string `xml:"VALUE"` +} + +// Function to extract header value from XML content +func getHeaderValueFromXMLContent(xmlContent []byte) (string, error) { + var landingPageSet LandingPageSet + err := xml.Unmarshal(xmlContent, &landingPageSet) + if err != nil { + log.Fatal("Unmarshalling XML file for header failed", err) + } + + // Iterate over the string attributes to find the header value + for _, attr := range landingPageSet.LandingPage.Attributes.StringAttributes { + if attr.Tag == "header" { + return attr.Value, nil + } + } + return "sf", err + +} + +// Function to read the XML file and return its content +func readXMLFile(filePath string) ([]byte, error) { + return os.ReadFile(filePath) +} From b17fdbdd94f2793f35d62b6f54bc0915d5d30ae1 Mon Sep 17 00:00:00 2001 From: varshith Date: Tue, 11 Jun 2024 11:19:08 +0200 Subject: [PATCH 08/11] svg mime type fix --- markdown_writer.go | 16 +++++++++++++--- static_files_uploader.go | 3 +++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/markdown_writer.go b/markdown_writer.go index c6676dd..b955cb2 100644 --- a/markdown_writer.go +++ b/markdown_writer.go @@ -35,20 +35,30 @@ func markDownCreator() { // Read XML file name xmlFileName := filepath.Base(xmlFilePath) + fmt.Println(xmlFilePath) + xmlContent, err := readXMLFile(xmlFilePath) + if err != nil { + fmt.Println(err) + } + headerValue, err := getHeaderValueFromXMLContent(xmlContent) + if err != nil { + fmt.Println(err) + } + fmt.Printf("Header value: %s\n", headerValue) // Remove file extension fileNameWithoutExt := strings.TrimSuffix(xmlFileName, filepath.Ext(xmlFileName)) // Markdown content - markdownContent := fmt.Sprintf(` ---- + markdownContent := fmt.Sprintf(`--- +title: "%s" --- {{< datafetch variable="%s" >}} Filename of the associated XML file: %s -`, fileNameWithoutExt, xmlFileName) +`, headerValue, fileNameWithoutExt, xmlFileName) // Create Markdown file mdFileName := filepath.Join(markdownDir, fileNameWithoutExt+".md") diff --git a/static_files_uploader.go b/static_files_uploader.go index 0369b63..e84c324 100644 --- a/static_files_uploader.go +++ b/static_files_uploader.go @@ -50,6 +50,9 @@ func test(DeploymenClient *DeploymentBackend) { if ext == ".css" { contentType = "text/css;" } + if ext == ".svg" { + contentType = "image/svg+xml;" + } if err != nil { log.Fatalln("File bytes empty", path, err) From df574555a761770b1d8ac108063d50f948b29ab6 Mon Sep 17 00:00:00 2001 From: varshith Date: Tue, 11 Jun 2024 12:14:26 +0200 Subject: [PATCH 09/11] added pagefind binary to docker file --- Dockerfile | 3 +++ web/layouts/_default/baseof.html | 1 - web/layouts/datasets/list.html | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0419f24..e4ea1eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,9 @@ RUN go build -o app . FROM alpine:3.17 RUN apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community hugo +RUN wget https://github.com/CloudCannon/pagefind/releases/download/v1.1.0/pagefind-v1.1.0-x86_64-unknown-linux-musl.tar.gz && \ + tar -xvf pagefind-v1.1.0-x86_64-unknown-linux-musl.tar.gz && \ + cp pagefind /usr/bin COPY --from=build /lp_app/app . COPY --from=build /lp_app/web web/ CMD ["./app"] diff --git a/web/layouts/_default/baseof.html b/web/layouts/_default/baseof.html index bee3ea8..6d2e967 100644 --- a/web/layouts/_default/baseof.html +++ b/web/layouts/_default/baseof.html @@ -1,7 +1,6 @@ - {{ partial "head.html" . }} diff --git a/web/layouts/datasets/list.html b/web/layouts/datasets/list.html index 5b4e787..8b6e3fc 100644 --- a/web/layouts/datasets/list.html +++ b/web/layouts/datasets/list.html @@ -9,7 +9,7 @@

Bigpicture Datasets

From a6c1ca72560464220e61507d1e5df626be9104b4 Mon Sep 17 00:00:00 2001 From: varshith Date: Tue, 11 Jun 2024 15:24:24 +0200 Subject: [PATCH 10/11] build pagefind modules --- .gitignore | 3 +-- Dockerfile | 3 ++- main.go | 25 +++++++++++++++++++------ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 41d180c..8c66d00 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ web/public/* web/content/datasets/test* web/data/* -dev_utils/config.yaml -web/static/pagefind \ No newline at end of file +web/static/pagefind/* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e4ea1eb..efff833 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,8 @@ FROM alpine:3.17 RUN apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community hugo RUN wget https://github.com/CloudCannon/pagefind/releases/download/v1.1.0/pagefind-v1.1.0-x86_64-unknown-linux-musl.tar.gz && \ tar -xvf pagefind-v1.1.0-x86_64-unknown-linux-musl.tar.gz && \ - cp pagefind /usr/bin + mv pagefind /usr/bin && \ + rm pagefind-v1.1.0-x86_64-unknown-linux-musl.tar.gz COPY --from=build /lp_app/app . COPY --from=build /lp_app/web web/ CMD ["./app"] diff --git a/main.go b/main.go index 8301cd3..d8d01ad 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + "os" "os/exec" log "github.com/sirupsen/logrus" @@ -11,16 +12,28 @@ func main() { log.Infoln("started app successfully") mConf := getMetadataConfig() Metadataclient := connectMetadatas3(mConf) - log.Infof("Connection to the bucket established") + log.Infof("Writing markdownfiles for respective XMLs") metadataDownloader(Metadataclient) markDownCreator() - cmd := exec.Command("hugo") - cmd.Dir = "./web/" - cmd.Run() + hugo_cmd := exec.Command("hugo") + hugo_cmd.Dir = "./web/" + hugo_cmd.Stdout = os.Stdout + hugo_cmd.Stderr = os.Stderr + err := hugo_cmd.Run() + if err != nil { + log.Fatal(err) + } log.Infof("Hugo successfully built") + pagefind_cmd := exec.Command("pagefind", "--site", "web/public/", "--output-path", "web/static/pagefind/") + pagefind_cmd.Stdout = os.Stdout + pagefind_cmd.Stderr = os.Stderr + pagefind_err := pagefind_cmd.Run() + if pagefind_err != nil { + log.Fatal(pagefind_err) + } + log.Infof("Pagefind modules successfully built") dConf := getDeploymentConfig() DeploymenClient := connectDeployments3(dConf) - log.Infof("Connection to the bucket established") - test(DeploymenClient) + staticSiteUploader(DeploymenClient) } From de09893483fa0d8bd59673232a9855914805842e Mon Sep 17 00:00:00 2001 From: varshith Date: Tue, 11 Jun 2024 15:25:44 +0200 Subject: [PATCH 11/11] fixing error handling and logging of app --- .dockerignore | 2 +- download_metadata.go | 4 +--- markdown_writer.go | 11 ++++++----- static_files_uploader.go | 6 ++++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.dockerignore b/.dockerignore index d913cc9..a6a9bb6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,3 @@ web/content/datasets/* charts/ -dev_utils/ \ No newline at end of file +dev_utils/* \ No newline at end of file diff --git a/download_metadata.go b/download_metadata.go index 374b848..466e3ca 100644 --- a/download_metadata.go +++ b/download_metadata.go @@ -35,11 +35,9 @@ func metadataDownloader(Metadataclient *MetadataBackend) { err := downloadToFile(manager, LocalDirectory, Bucket, aws.ToString(obj.Key)) if err != nil { log.Fatal("Error while downloading metadata files from metadata bucket", err) - } else { - log.Infoln("Completed downloading metadatafiles") - } } + log.Infoln("Completed downloading metadata files") } diff --git a/markdown_writer.go b/markdown_writer.go index b955cb2..a309937 100644 --- a/markdown_writer.go +++ b/markdown_writer.go @@ -35,17 +35,17 @@ func markDownCreator() { // Read XML file name xmlFileName := filepath.Base(xmlFilePath) - fmt.Println(xmlFilePath) + log.Debug(xmlFilePath) xmlContent, err := readXMLFile(xmlFilePath) if err != nil { - fmt.Println(err) + log.Fatalf("Error reading the XML file %V", err) } headerValue, err := getHeaderValueFromXMLContent(xmlContent) if err != nil { - fmt.Println(err) + log.Fatal("Error while getting header value from XML file", err) } - fmt.Printf("Header value: %s\n", headerValue) + log.Debugln("Header value: %V", headerValue) // Remove file extension fileNameWithoutExt := strings.TrimSuffix(xmlFileName, filepath.Ext(xmlFileName)) @@ -76,7 +76,7 @@ Filename of the associated XML file: %s return nil } - log.Infoln("Markdown file %S created successfully!\n", mdFileName) + log.Debug("Markdown file %S created successfully!\n", mdFileName) return nil }) @@ -84,4 +84,5 @@ Filename of the associated XML file: %s if err != nil { log.Fatal("Error walking through directory:", err) } + } diff --git a/static_files_uploader.go b/static_files_uploader.go index e84c324..60c2e16 100644 --- a/static_files_uploader.go +++ b/static_files_uploader.go @@ -14,7 +14,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/s3" ) -func test(DeploymenClient *DeploymentBackend) { +func staticSiteUploader(DeploymenClient *DeploymentBackend) { var ( localPath = "web/public/" bucket = DeploymenClient.Bucket @@ -71,8 +71,10 @@ func test(DeploymenClient *DeploymentBackend) { if err != nil { log.Fatalln("Failed to upload", path, err) } - log.Infoln("Uploaded", path, result.Location) + log.Debugln("Uploaded", path, result.Location) } + log.Infoln("Successfully uploaded built static site to the bucket") + } type fileWalk chan string