-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from NBISweden/search-function
Search function
- Loading branch information
Showing
15 changed files
with
373 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
web/content/datasets/* | ||
charts/ | ||
dev_utils/ | ||
dev_utils/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
web/public/* | ||
web/content/datasets/test* | ||
web/data/* | ||
dev_utils/config.yaml | ||
web/static/pagefind/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: "Test" | ||
title: "Search" | ||
date: 2024-03-20T10:31:33+01:00 | ||
layout: test | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
{{ define "main" }} | ||
<h2> Bigpicture Datasets</h2> | ||
<ul> | ||
|
||
<div id="search"> | ||
<script> | ||
window.addEventListener('DOMContentLoaded', (event) => { | ||
new PagefindUI({ element: "#search", showSubResults: true }); | ||
}); | ||
</script> | ||
<ul data-pagefind-ignore > | ||
{{ range .Pages }} | ||
<a href="{{ .RelPermalink }}"><p>HUS mock dataset</p></a> | ||
<a href="{{ .RelPermalink }}"><p>{{ .Params.title }}</p></a> | ||
|
||
{{ end }} | ||
</ul> | ||
{{ .Params.datasets.name }} | ||
{{ .Content }} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,9 @@ | |
<link rel="canonical" href="{{ .RelPermalink }}"> | ||
|
||
<link rel="stylesheet" href="{{ "css/style.css" | relURL }}"> | ||
<link rel="stylesheet" href="{{ "pagefind/pagefind-ui.css" | relURL}}" > | ||
|
||
<script src="{{ "pagefind/pagefind-ui.js" | relURL}}"></script> | ||
|
||
<!-- Custom Fonts --> | ||
<link href="https://cdn.jsdelivr.net/gh/FortAwesome/[email protected]/css/all.css" rel="stylesheet" type="text/css"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.