Skip to content
Snippets Groups Projects
Commit 155ac5f7 authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

Generate search index

parent 1ab1eb62
No related branches found
No related tags found
2 merge requests!91Develop,!89Search page
Showing
with 497 additions and 185 deletions
#!/bin/bash
DIRECTORY=build
# Install lunr to build the index
npm install lunr@2.3.8
# Go to the directory...
cd $DIRECTORY
printf "Found the following build targets inside: \n$(ls -d */)\n\n"
# ...and loop through all the build targets
for branch in $(ls -d */); do
echo "Entering: $branch";
cd "$branch";
echo "Generating the index..."
cat documents.js | node $CI_PROJECT_DIR/build_index.js > index.js
rm documents.js build_index.js
echo "...should be completed. First 50 characters of the index: "
cat index.js | head -c50
echo ""
cd ..
done
rm $CI_PROJECT_DIR/build_index.js
mkdir -p public
mkdir -p build
artefact="latest"
# loop through all the branches
......@@ -14,14 +14,15 @@ for branch in $(git for-each-ref --format='%(refname:strip=3)' refs/remotes); do
echo $artefact;
git checkout -f $branch
git reset --hard $branch
git pull
# build the website
bundle install
bundle exec jekyll build --baseurl="howto-cards/$artefact" -d "public/$artefact"
bundle exec jekyll build --baseurl="howto-cards/$artefact" -d "build/$artefact"
if [[ $branch == "master" ]]; then
# set the 404
cp howto-cards/$artefact/404.html public/404.html
cp howto-cards/$artefact/404.html build/404.html
fi
done
......@@ -31,4 +32,4 @@ git checkout -f $CI_COMMIT_REF_NAME
git reset --hard origin/$CI_COMMIT_REF_NAME
# set the auto redirection
cp .ci/.autoRedirect public/index.html
cp .ci/.autoRedirect build/index.html
# In case something goes horribly wrong, you can fall back to `image: ruby:2.5`
image: git-r3lab.uni.lu:4567/r3/docker/jekyll-lcsb:1.1
variables:
JEKYLL_ENV: production
stages:
- build
- generate_index
- deploy
build_pages:
stage: build
before_script:
- apt-get -qq update
- apt-get install -y -qq git-lfs
- gem install bundler:2.0.2 && bundle install
script:
- bash .ci/deploy.sh
variables:
JEKYLL_ENV: production
artifacts:
expire_in: 1 day
paths:
- build
before_script:
- apt-get -qq update
- apt-get install -y -qq git-lfs
- gem install bundler:2.0.2 && bundle install
generate the search index:
stage: generate_index
image: node:13.8.0-slim
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_BRANCH == "develop"
script:
- bash .ci/build_indices.sh
- mv build processed_build
artifacts:
expire_in: 1 day
paths:
- processed_build
pages:
image: alpine:3.11.3
stage: deploy
only:
- develop
- master
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_BRANCH == "develop"
script:
- bash .ci/deploy.sh
- mv processed_build public
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_BRANCH == "develop"
artifacts:
expire_in: 1 week
paths:
......
......@@ -66,6 +66,7 @@ defaults:
path: "external/*"
values:
include_link: true
searchable: 1.0
# Exclude from processing. (no need to touch these)
......
var lunr = require('lunr'),
stdin = process.stdin,
stdout = process.stdout,
buffer = [];
stdin.resume();
stdin.setEncoding('utf8');
stdin.on('data', function (data) {
buffer.push(data);
});
stdin.on('end', function () {
var documents = JSON.parse(buffer.join(''))
var idx = lunr(function () {
this.ref('id')
this.field('title', { boost: 10 })
this.field('url')
this.field('content')
documents.forEach(function (doc) {
this.add(doc)
}, this)
})
stdout.write(JSON.stringify(idx))
});
---
---
{% assign the_cards = site.pages | where_exp:"card","card.searchable >= 1.0" %}
[ {% for card in the_cards %} {
"id": "{{ card.url | slugify }}",
"title": "{{ card.shortcut | xml_escape }}",
"content": {{ card.content | markdownify | strip_html | jsonify }},
"url": "{{ card.url | xml_escape | relative_url }}"
} {% unless forloop.last %},{% endunless %} {% endfor %}
]
......@@ -32,35 +32,24 @@ Markdown is a lightweight markup language with plain text formatting syntax whic
<img src="img/visual-code_img_10.png">
- **tips to write in markdown:**
<img src="img/visual-code_img_18.png">
**insert pictures:**
<img src="img/visual-code_img_19.png" width="1000">
**create a table**
<img src="img/visual-code_img_20.png">
## Syntax
## Tips to write in markdown:
<table>
<thead>
<tr>
<th>Markdown</th>
<th>Rendered Output</th>
</tr>
<tr>
<th>Markdown</th>
<th>Rendered Output</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>
<pre>
# Header 1<br>
## Header 2<br>
### Header 3 <br>
#### Header 4
</code>
</pre>
</td>
<td>
<h1>Header 1</h1><br>
......@@ -68,107 +57,194 @@ Markdown is a lightweight markup language with plain text formatting syntax whic
<h3>Header 3</h3><br>
<h4>Header 4</h4>
</td>
</tr>
<tr>
<td>
<code>
To **bold** text, add **two asterisks** or __underscores__ before and after a word or phrase.</br>
To make text **italic** text, add *one asterisks* or _underscores_.
</code>
</td>
<td>
To make phrase <strong>bold</strong> text, add <strong>two asterisks</strong> or <strong>underscores</strong> before and after a word or phrase.</br>
To make text <i>italic</i>, add <i>one asterisks</i> or <i>underscores</i>.
</td>
</tr>
<tr>
<td>
<code>
Use numbers for ordered lists: <br />
1. First item<br />
2. Second item<br />
3. Third item<br />
&nbsp;&nbsp;&nbsp;&nbsp;1. Indented item<br />
&nbsp;&nbsp;&nbsp;&nbsp;2. Indented item<br />
4. Fourth item
</code>
</td>
<td>
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item
<ol>
<li>Indented item</li>
<li>Indented item</li>
</ol>
</li>
<li>Fourth item</li>
</ol>
</td>
</tr>
<tr>
<td>
<code>
For unordered lists
* First item<br />
* Second item<br />
* Third item<br />
* Fourth item
</code>
</td>
<td>
<ul>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
<li>Fourth item</li>
</ul>
</td>
</tr>
<tr>
<td>
<code>
Include links referring to a web [page](https://www.markdownguide.org/)
</code>
</td>
<td>
Include links referring to a web <a href="https://www.markdownguide.org/">page</a>
</td>
</tr>
<tr>
<td>
<code>
Include local pictures: ![My awesome picture](img/r3_logo.png)
</code>
</td>
<td>
Include local pictures: <img src="img/img.png">
</td>
</tr>
<tr>
<td>
<code>
Include code blocks! </br>
```</br>
myAwesomeFunction <- function(x) x+1;</br>
# Apply function </br>
myAwesomeFunction(2);</br>
```
</code>
</td>
<td>
Include code blocks! </br>
</tr>
<tr>
<td>
<pre>
To make a text **bold**, use **double asterisk** or __underscores__ before and after a word or phrase.
To make a text **italic**, use *one asterisk* or _underscore_.
</pre>
</td>
<td>
To make a text <strong>bold</strong>, use <strong>double asterisk</strong> or <strong>underscores</strong> before and after a word or phrase.<br>
To make text <i>italic</i>, use <i>one asterisk</i> or <i>underscore</i>.
</td>
</tr>
<tr>
<td>
<pre>
Use numbers for ordered lists:
1. First item
2. Second item
3. Third item
&nbsp;&nbsp;&nbsp;&nbsp;1. Indented item
&nbsp;&nbsp;&nbsp;&nbsp;1. Indented item
4. Fourth item
</pre>
</td>
<td>
Use numbers for ordered lists:
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item
<ol>
<li>Indented item</li>
<li>Indented item</li>
</ol>
</li>
<li>Fourth item</li>
</ol>
</td>
</tr>
<tr>
<td>
<pre>
For unordered lists use asterisk, minus or plus
- First item
- Second item
* Third item
&nbsp;&nbsp;&nbsp;&nbsp;* Indented item
&nbsp;&nbsp;&nbsp;&nbsp;+ Indented item
* Fourth item
</pre>
</td>
<td>
For unordered lists use asterisk, minus or plus
<ul>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
<ul>
<li>Indented item</li>
<li>Indented item</li>
</ul>
<li>Fourth item</li>
</ul>
</td>
</tr>
<tr>
<td>
<pre>
Include links referring to a web [page](https://www.markdownguide.org/)
</pre>
</td>
<td>
Include links referring to a web <a href="https://www.markdownguide.org/">page</a>
</td>
</tr>
<tr>
<td>
<pre>
Include local pictures using markdown:
![My awesome picture](img/r3_logo.png)
</pre><br>
<pre>
Or use HTML tag allowing you to alter the image properties (e.g. size):
&lt;img src="img/r3_logo.png" width="40"&gt
</pre>
</td>
<td>
Include local pictures using markdown: <br>
<img src="img/r3_logo.png"> <br>
Or use HTML tag allowing you to alter the image properties (e.g. size):<br>
<img src="img/r3_logo.png" width="40">
</td>
</tr>
<tr>
<td>
<pre>
Include code blocks!
```
def myAwesomeFunction(x):
x+1
myAwesomeFunction(2)
```
</pre>
</td>
<td>
Include code blocks! <br>
<code>
myAwesomeFunction <- function(x) x+1;</br>
# Apply function</br>
myAwesomeFunction(2);
def myAwesomeFunction(x):<br>
x+1<br>
myAwesomeFunction(2)
</code>
</td>
</tr>
</td>
</tr>
<tr>
<td>
<pre>
Create table:
| Tables | Are | Cool |
|------------|:------:|:-----:|
| value one | blue | $1024 |
| value two | red | $256 |
| value three| green | $128 |
</pre>
</td>
<td>
Create table:
<div>
<table>
<thead>
<tr>
<th>
Tables
</th>
<th>
Are
</th>
<th>
Cool
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
value one
</td>
<td>
blue
</td>
<td>
$1024
</td>
</tr>
<tr>
<td>
value two
</td>
<td>
red
</td>
<td>
$256
</td>
</tr>
<tr>
<td>
value tree
</td>
<td>
green
</td>
<td>
$128
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
This is an overview of basic Markdown features. For more in-build features, please see various online [documentation](https://www.markdownguide.org/basic-syntax/).
### Advanced formatting
......@@ -185,55 +261,53 @@ Another big advantage of Markdown is that it can contain HTML tags, which makes
* **Blogging and tutorials** - structured document with chunks of code, pictures and results of the analyses can be easily converted to HTML format and posted on personal/team websites.
* **Notes and meeting minutes** - you can use following template for simple and nicely structured meeting notes:
<table>
<thead>
<tr>
<th>Markdown</th>
<th>Markdown template</th>
<th>Rendered Output</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>
# DocTitle</br>
### Attendees:</br>
### Location:</br>
## Objective / Agenda</br>
## Meeting Notes</br>
* first note </br>
* second note </br>
* ...</br>
</br>
## Actions</br>
- [ ] Josh, Alice and Cindy will do this.</br>
- [x] Bob stops doing that.</br>
- [ ] Will and Tom will take care of those
</code>
</td>
<td>
<code>
<h1>DocTitle</h1></br>
<h3> Attendees:<h3></br>
<h3> Location:</h3></br>
<h2> Objective / Agenda</h2></br>
<h2> Meeting Notes</h2></br>
<ul>
<li> first note</li>
<li>second note</li>
<li>...</li>
</ul>
<h2> Actions</h2></br>
<input type="checkbox" > Josh, Alice and Cindy will do this.</input></br>
<input type="checkbox" checked="checked"> Bob stops doing that.</input></br>
<input type="checkbox" > Vanessa and Tom will take care of those</input></br>
</code>
</td>
</tr>
</tbody>
<tr>
<td>
<pre>
# DocTitle
### Attendees:
### Location:
## Objective / Agenda
## Meeting Notes
* first note
* second note
* ...
## Actions
- [ ] Josh, Alice and Cindy will do this.
- [x] Bob stops doing that.
- [ ] Will and Tom will take care of those
</pre>
</td>
<td>
<h1>DocTitle</h1><br>
<h3> Attendees:</h3><br>
<h3> Location:</h3><br>
<h2> Objective / Agenda</h2><br>
<h2> Meeting Notes</h2><br>
<ul>
<li> first note</li>
<li>second note</li>
<li>...</li>
</ul>
<h2> Actions</h2><br>
<input type="checkbox"> Josh, Alice and Cindy will do this.<br>
<input type="checkbox" checked="checked"> Bob stops doing that.<br>
<input type="checkbox"> Vanessa and Tom will take care of those<br>
</td>
</tr>
</tbody>
</table>
* **Analyses,reports and papers** - embedding [R markdown](https://rmarkdown.rstudio.com/) in an R project allows you to include executable code and related text in the very same document. This brings unprecedented level of consistency, shareability and reproducibility into the workflows.
* **Analyses, reports and papers** - embedding [R markdown](https://rmarkdown.rstudio.com/) in an R project allows you to include executable code and related text in the very same document. This brings unprecedented level of consistency, shareability and reproducibility into the workflows.
* **Online discussion forums** - many scientific and non-scientific discussion forums and social networks support Markdown for formatting the content of messages (e.g. [StackOverflow](https://stackoverflow.com/editing-help), [GitHub](https://help.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax), Reddit or even Facebook)
......
---
layout: page
permalink: /external/exchange-channels/duma/
shortcut: exchange-channels:duma
permalink: /external/exchange-channels/asperaweb/
shortcut: exchange-channels:asperaweb
redirect_from:
- /cards/exchange-channels:duma
- /external/cards/exchange-channels:duma
- /cards/exchange-channels:asperaweb
- /external/cards/exchange-channels:asperaweb
---
# AsperaWEB Quick Guide
......@@ -33,7 +33,7 @@ An access link can be reached via standard web browsers. Data can be transferred
* Through the web browser by visiting the link, which is our recommended way of data transfer, described in this [section of the guide](#ASPERAWEB_WEB)
* Through the use of a command line tool. If your data sits in an environment, where you can not launch a web browser, then you may use use a command line client tool to reach an access link. This process is described in this [section of this guide](#ASPERAWEB_CLI).
The use of DUMA is mediated by LCSB's data stewards. If you require assistance in using DUMA, you should send an email to the [LCSB datastewards](mailto:lcsb-datastewards@uni.lu).
The use of AsperaWEB is mediated by LCSB's data stewards. If you require assistance in using AsperaWEB, you should send an email to the [LCSB datastewards](mailto:lcsb-datastewards@uni.lu).
<a name="ASPERAWEB_WEB"></a>
## Accessing AsperaWEB via Web Interface
......@@ -41,14 +41,14 @@ The use of DUMA is mediated by LCSB's data stewards. If you require assistance i
In the following steps we provide instructions on how to use AsperaWEB web interface.
1. Once you receive your **access link** and **password** from the LCSB, visit the link using a standard web browser. Firefox 66.x (or higher) recommended, but others should also work. You will be prompted for your password (see below).<br/>
![Alt](img/duma_1.png "Title")
![Alt](img/asperaweb_1.png "Title")
2. When you visit a AsperaWEB access link for the very first time, you will be prompted to install or update **IBM Aspera Connect** client.
* click **Download** or **Download the App** buttons (see below). <br/>![Alt](img/duma_2.png "Title")
* click **Download** or **Download the App** buttons (see below). <br/>![Alt](img/asperaweb_2.png "Title")
* wait for the download to finish, the prompt should go to step 3. <br/>![Alt](img/duma_3.png "Title")
* wait for the download to finish, the prompt should go to step 3. <br/>![Alt](img/asperaweb_3.png "Title")
* open the installer just downloaded and start the installer. <br/>![Alt](img/duma_4.png "Title")
* open the installer just downloaded and start the installer. <br/>![Alt](img/asperaweb_4.png "Title")
* close the installer, the Aspera Connect should try to open - *depending on your Operating System you may be asked if you are sure to open it* -
......@@ -58,7 +58,7 @@ In the following steps we provide instructions on how to use AsperaWEB web inter
3. The **access link** page will display a **File Browser** section. Depending on the settings per access link, users can create or delete folders in the File Browser and upload and/or download data.<br/>
![Alt](img/duma_6.png "Title")
![Alt](img/asperaweb_6.png "Title")
4. Clicking **Upload** or **Download** will launch the **IBM Aspera Connect** client on your computer. You first will be asked whether you allow the client to connect to aspera.lcsb.uni.lu. Choose **Allow**.
......@@ -66,14 +66,14 @@ In the following steps we provide instructions on how to use AsperaWEB web inter
5. At any time you can launch **IBM Aspera Connect** to display the status of uploads to or downloads from your computer. <br/>
![Alt](img/duma_8.png "Title")
![Alt](img/asperaweb_8.png "Title")
6. All data are encrypted on server side and they stay encrypted also upon download. For decryption, you have to navigate into your **IBM Aspera Connect** window and click "**Unlock encrypted files**". <br/>
![Alt](img/duma_9.png "Title") <br/>
![Alt](img/asperaweb_9.png "Title") <br/>
You will be prompted for encryption passphrase which is present on the file browser. <br/>
![Alt](img/duma_10.png "Title") <br/>
![Alt](img/asperaweb_10.png "Title") <br/>
Encrypted files are by default kept on your disc after decryption. If you want to change this behaviour, navigate to Options->Settings and check "Delete encrypted files when finished" box.
......@@ -85,8 +85,8 @@ Encrypted files are by default kept on your disc after decryption. If you want t
Go to the help section of your access link
<br/> ![Alt](img/duma_help_link.png "Title") <br/><br/><br/>
<br/> ![Alt](img/asperaweb_help_link.png "Title") <br/><br/><br/>
And follow the steps in the **Using the command line** section.
<br/> ![Alt](img/duma_cli_tokens.png "Title") <br/><br/><br/>
<br/> ![Alt](img/asperaweb_cli_tokens.png "Title") <br/><br/><br/>
......@@ -31,7 +31,7 @@ The How-to cards are intended to provide practical guidance in implementing Data
### Exchange channels
* [AsperaWEB Quick Guide](./external/exchange-channels/duma/)
* [AsperaWEB Quick Guide](./external/exchange-channels/asperaweb/)
* [Owncloud](./external/exchange-channels/owncloud/)
* [Sharing calendar in Microsoft Exchange](./external/exchange-channels/calendar/)
......
search.md 0 → 100644
---
layout: page
title: Search
permalink: /search
order: 4
---
<link rel="prefetch" href="index.js" />
<style>
#search_query {
border: solid 2px #eee;
padding: 8px;
height: 20px;
font-size: 20px;
width: 500px;
min-width: 400px;
}
button.search[type=submit] {
border: solid 2px #eee;
padding: 1px;
height: 35px;
width: 150px;
font-size: 20px;
color: #4c4c4c;
background: #efefef;
border-radius: 8px;
margin-top: 3px;
}
#search_header {
margin-top: 50px;
display: none
}
#search_results_table {
margin-top: 20px;
width: 100%;
}
#search_results_placeholder_td {
border: none;
}
h3.result {
font-size: large;
}
</style>
<form>
<input class="search" placeholder="What are you looking for?" name="search_query" id="search_query" /><br />
<button class="search" type="submit">Find it</button>
</form>
<h1 id="search_header">Results of your query:</h1>
<table id="search_results_table">
<tbody id="search_results_tbody">
<tr id="search_results_placeholder" style="display: none">
<td id="search_results_placeholder_td"><h3>Please wait, search is in progress...</h3></td>
</tr>
</tbody>
</table>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lunr.js/2.3.8/lunr.min.js" integrity="sha256-34Si1Y6llMBKM3G0jQILVeoQKEwuxjbk4zGWXXMT4ps=" crossorigin="anonymous"></script>
<script>
var el_table_body = document.getElementById('search_results_tbody');
var el_input_query = document.getElementById('search_query');
var el_tr_placeholder = document.getElementById('search_results_placeholder');
var el_header = document.getElementById('search_header');
var url_params = new URLSearchParams(window.location.search);
var search_term = url_params.get('search_query') || "";
if (!!search_term.length) {
el_input_query.value = search_term;
el_header.style.display = "block";
el_tr_placeholder.style.display = "block";
}
var construct_cell = function(title, content, link) {
if (link == '#') {
return '<td><h3 class="result">' + title + '</h3><p>' + content + '</p></td>';
} else {
return '<td><h3><a href="' + link + '">' + title + '</a></h3><p>' + content + '</p></td>';
}
}
var capitalize = function(text) {
return text.charAt(0).toUpperCase() + text.slice(1);
}
var prettify = function(text) {
return text.split(':').map(capitalize).join(' &raquo; ');
}
{% assign the_cards = site.pages | where_exp:"card","card.searchable >= 1.0" %}
window.content = { {% for card in the_cards %}
"{{ card.url | slugify }}": {
"title": "{{ card.shortcut | xml_escape }}",
"content": {{ card.content | strip_html | strip_newlines | jsonify }},
"url": "{{ card.url | xml_escape | relative_url }}"
} {% unless forloop.last %},{% endunless %} {% endfor %}
};
fetch('{{ "index.js" | relative_url }}').then(response => response.text()).then((data) => {
var the_index = JSON.parse(data);
window.search_index = lunr.Index.load(the_index);
if (search_term != "") {
var results = window.search_index.search(search_term);
for (var i = 0; i < results.length; i++) {
var node = document.createElement("tr");
node.innerHTML = construct_cell(prettify(window.content[results[i].ref].title),
window.content[results[i].ref].content.substring(0, 125) + '...',
window.content[results[i].ref].url);
el_table_body.appendChild(node);
}
if (results.length == 0) {
var node = document.createElement("tr");
node.innerHTML = construct_cell("No results",
'Sorry, we were unable to find anything that matches your query',
"#");
el_table_body.appendChild(node);
}
}
el_tr_placeholder.style.display = "none";
})
</script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment