Skip to content

Commit

Permalink
Merge pull request galaxyproject#3878 from galaxyproject/snippet-incl…
Browse files Browse the repository at this point in the history
…uding

Fix box titles in included snippets
  • Loading branch information
hexylena authored Feb 7, 2023
2 parents f6b4e64 + 0828405 commit 96e0180
Show file tree
Hide file tree
Showing 21 changed files with 125 additions and 74 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/monthly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ jobs:
- name: Release Name
id: release_name
run: |
echo "::set-output name=title::$(LC_ALL=C date '+%Y %B %d')"
echo "::set-output name=tag::$(LC_ALL=C date -I)"
echo "release_title=$(LC_ALL=C date '+%Y %B %d')" >> $GITHUB_ENV
echo "release_tag=$(LC_ALL=C date -I)" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.release_name.outputs.tag }}
tag_name: ${{ env.release_tag }}
commitish: main
release_name: Release ${{ steps.release_name.outputs.title }}
release_name: Release ${{ env.release_title }}
body: "Monthly release of the GTN materials"
draft: false
prerelease: false
Expand Down Expand Up @@ -86,12 +86,12 @@ jobs:
curl --retry 5 https://gallantries.github.io/video-library/api/sessions.json > metadata/session-library.json
JEKYLL_ENV=production bundle exec jekyll build --strict_front_matter -d _site/training-material
env:
SOURCE_TAG: ${{ steps.release_name.outputs.tag }}
SOURCE_TAG: ${{ env.release_tag }}
GTN_FORK: ${{ github.repository_owner }}

- name: Deploy 🚀
run: |
pip install awscli
./bin/publish-archive
env:
SOURCE_TAG: ${{ steps.release_name.outputs.tag }}
SOURCE_TAG: ${{ env.release_tag }}
4 changes: 2 additions & 2 deletions .github/workflows/video.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
- name: Previous build ID
id: build_id
run: |
echo "::set-output name=commit::$(curl https://galaxy-training.s3.amazonaws.com/videos/topics/last-commit -f 2>/dev/null || echo none)"
echo "commit=$(curl https://galaxy-training.s3.amazonaws.com/videos/topics/last-commit -f 2>/dev/null || echo none)" >> $GITHUB_ENV
# The actual compilation process deposits everything in the ./videos/ folder.
- name: Build Videos
Expand All @@ -90,7 +90,7 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_POLLY_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_POLLY_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
PREVIOUS_COMMIT_ID: ${{ steps.build_id.outputs.commit }}
PREVIOUS_COMMIT_ID: ${{ env.commit }}

# Deploy step, scary.
- uses: jakejarvis/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion _layouts/faq.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h1>{{page.title}}</h1>
{{ page.description }}


{{ content | regex_replace: '<hr.*—<\/p>', '' }}
{{ content | fix_box_titles:page.lang,page.path | regex_replace: '<hr.*—<\/p>', '' }}

</div>
<div class="col-md-4">
Expand Down
14 changes: 14 additions & 0 deletions _plugins/gtn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ def how_many_tutorial_feedbacks(feedback, name)
feedback.select{|x| x["tutorial"] == name}.length
end

def fix_box_titles(content, lang, key)
Gtn::Boxify.replace_elements(content, lang, key)
end

def filter_authors(contributors, contributions)
if not contributors.nil?
return contributors
Expand All @@ -98,6 +102,16 @@ def filter_authors(contributors, contributions)
end
end

def regex_replace(str, regex_search, value_replace)
regex = /#{regex_search}/m
return str.gsub(regex, value_replace)
end

def regex_replace_once(str, regex_search, value_replace)
regex = /#{regex_search}/m
return str.sub(regex, value_replace)
end

def get_default_link(material)
url = nil

Expand Down
16 changes: 15 additions & 1 deletion _plugins/gtn/boxify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def self.get_id(box_type, title, path)
end

def self.format_box_title(title, box_type, lang="en")
if lang == "" or lang.nil? then lang = "en" end
title_fmted = ((!title.nil?) && title.length > 0 ? ": #{title}" : "")
"#{@@BOX_TITLES[lang][box_type]}#{title_fmted}"
end
Expand Down Expand Up @@ -178,7 +179,20 @@ def self.generate_box(box_type, title, lang="en", key)
).split(/\n/).map{|x| x.lstrip.rstrip}.join("").lstrip.rstrip
end


def self.replace_elements(text, lang="en", key)
# We want to replace any `<x-title>(.*)</x-title>` bits
# And replace them one by one with "proper" boxes, based on generate_title.
#
# We're going to rely on never having two on one line
text.split("\n").map{|line|
line.gsub(/<(?<type>[a-z-]*)-title>(?<title>.*?)<\/[a-z-]*-title>/){|m|
title = Regexp.last_match[:title]
type = Regexp.last_match[:type]
_, box = self.generate_title(type, title, lang=lang, key)
box
}
}.join("\n")
end
end
end

Expand Down
19 changes: 6 additions & 13 deletions _plugins/snippet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def render(context)
z = z.gsub(/\R/,"\n> ")
#puts box_start+y+box_end
end

#if z =~ /contribute/
#puts "=== step 3 ===\n#{z}\n\n"
#puts "=== MARKDOWN ===\n#{box_start+z+box_end}\n\n"
Expand Down Expand Up @@ -135,20 +136,12 @@ def add_include_to_dependency(inclusion, context)
end
end
end
end

module RegexReplace
def regex_replace(str, regex_search, value_replace)
regex = /#{regex_search}/m
return str.gsub(regex, value_replace)
end
Liquid::Template.register_tag("snippet", Jekyll::Tags::SnippetIncludeTag)

def regex_replace_once(str, regex_search, value_replace)
regex = /#{regex_search}/m
return str.sub(regex, value_replace)
end
Jekyll::Hooks.register :pages, :post_render do |page|
if page.output =~ /-title>/
page.output = Gtn::Boxify.replace_elements(page.output, page.data.fetch('lang', 'en'), page.path)
end

end

Liquid::Template.register_tag("snippet", Jekyll::Tags::SnippetIncludeTag)
Liquid::Template.register_filter(Jekyll::RegexReplace)
16 changes: 14 additions & 2 deletions assets/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ $tutorial-box-spacing: 1rem;
--navbar-item-background: transparent;
--navbar-item-hover: transparent;

// Basically only for the breadcrumbs.
--secondary-color: #e9ecef;
--secondary-color-text: #000;

// A11y
--outline-color: red;

Expand Down Expand Up @@ -805,6 +809,7 @@ a {
}
.gitter-open-chat-button {
background-color: var(--brand-color) !important;
color: var(--brand-color-contrast) !important;
}


Expand Down Expand Up @@ -1153,7 +1158,7 @@ $btn-pink:$keypoints-color;

.btn-purple{
background-color: $btn-purple;
color: white;
color: black;
}

.btn-pink{
Expand Down Expand Up @@ -1286,7 +1291,14 @@ ul.text-list, ol.text-list {
}
.dropdown-item:focus-visible {
}
.dropdown-item:focus, .dropdown-item:hover

ol.breadcrumb {
background: var(--secondary-color);

.breadcrumb-item.active {
color: var(--secondary-color-text);
}
}



Expand Down
12 changes: 12 additions & 0 deletions assets/css/themes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ body.theme-night {
--hyperlink-hover: #fff;
--brand-color: #424a66;
--slide-heading-color: var(--text-color);

--secondary-color: #222;
--secondary-color-text: #fff;
}

body.theme-midnight {
Expand All @@ -18,6 +21,9 @@ body.theme-midnight {
--text-color: #eee;
--slide-heading-color: #eee;
--slide-heading-color: var(--text-color);

--secondary-color: #222;
--secondary-color-text: var(--text-color);
}

body.theme-blm {
Expand All @@ -36,6 +42,9 @@ body.theme-blm {
--text-color: #eee;
--slide-heading-color: #eee;
--slide-heading-color: var(--text-color);

--secondary-color: #222;
--secondary-color-text: var(--text-color);
}

body.theme-halloween {
Expand All @@ -51,6 +60,9 @@ body.theme-halloween {
--h1-theme-after: " 🎃 ";
--h2-theme-before: " 👻 ";
--h2-theme-after: " 👻 ";

--secondary-color: #402900;
--secondary-color-text: var(--text-color);
}

body.theme-progress, body.theme-rainbow {
Expand Down
8 changes: 3 additions & 5 deletions faqs/galaxy/interactive_tools_jupyter_launch.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ layout: faq
contributors: [annefou,shiltemann,nomadscientist]
---

> ### {% icon tip %} Tip: Launch JupyterLab in Galaxy
> <tip-title>Launch JupyterLab in Galaxy</tip-title>
> Currently JupyterLab in Galaxy is available on [Live.useGalaxy.eu](https://live.usegalaxy.eu), [usegalaxy.org](https://usegalaxy.org) and [usegalaxy.eu](https://usegalaxy.eu).
>
> > ### {% icon hands_on %} Hands-on: Run JupyterLab
> > <hands-on-title>Run JupyterLab</hands-on-title>
> >
> > 1. {% tool [Interactive Jupyter Notebook](interactive_tool_jupyter_notebook) %}:
> > 2. Click Run Tool
Expand All @@ -20,10 +20,8 @@ contributors: [annefou,shiltemann,nomadscientist]
> {: .hands_on}
{: .tip}

> ### {% icon tip %} Tip: Launch Try JupyterLab if not available on Galaxy
> <tip-title>Launch Try JupyterLab if not available on Galaxy</tip-title>
>
> If JupyterLab is not available on the Galaxy instance:
> 1. Start [Try JupyterLab](https://mybinder.org/v2/gh/jupyterlab/jupyterlab-demo/try.jupyter.org?urlpath=lab)
{: .tip}

<!-- GTN:IGNORE:010 -->
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
{% endif %}

# Introduction
{:.no_toc}

Genome annotation of eukaryotes is a little more complicated than for prokaryotes: eukaryotic genomes are usually larger than prokaryotes, with more genes. The sequences determining the beginning and the end of a gene are generally less conserved than the prokaryotic ones. Many genes also contain introns, and the limits of these introns (acceptor and donor sites) are not highly conserved.

Expand All @@ -19,7 +18,7 @@ Maker uses ab-initio predictors (like [Augustus](http://bioinf.uni-greifswald.de

In this tutorial you will learn how to perform a genome annotation, and how to evaluate its quality. {% unless include.short %}You will see how training ab-initio predictors is an important step to produce good results. {% endunless %}Finally, you will learn how to use the [JBrowse](http://jbrowse.org/) genome browser to visualise the results.

More information about Maker can be found [here](http://www.yandell-lab.org/software/maker.html).
More information about Maker can be found [on their website](http://www.yandell-lab.org/software/maker.html).

This tutorial was inspired by the MAKER Tutorial for [WGS Assembly and Annotation Winter School 2018](http://weatherby.genetics.utah.edu/MAKER/wiki/index.php/MAKER_Tutorial_for_WGS_Assembly_and_Annotation_Winter_School_2018), don't hesitate to consult it for more information on Maker, and on how to run it with command line.

Expand Down Expand Up @@ -685,7 +684,6 @@ You will now see new tracks displaying all the evidences used by Maker to genera
{% endunless %}
# Conclusion
{:.no_toc}
Congratulations, you finished this tutorial! You learned how to annotate an eukaryotic genome using Maker, how to evaluate the quality of the annotation, and how to visualize it using the JBrowse genome browser.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ subtopic: eukaryote
priority: 4
---

{% include {{ page.dir }}content.md short=false %}
{% include topics/genome-annotation/tutorials/annotation-with-maker/content.md short=false %}
2 changes: 1 addition & 1 deletion topics/genome-annotation/tutorials/functional/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ We will annotate a small set of **protein sequences**. These sequences were pred
>
{: .hands_on}
{% include {{ page.dir }}content.md short=true %}
{% include topics/genome-annotation/tutorials/functional/content.md short=true %}
# Conclusion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ contributors:
---

# Descripción General
{:.no_toc}

* Esta es una breve introducción a la interfaz de usuario de Galaxy - La página web con la que vas a interactuar.
* En este tutorial vamos a cubrir tareas clave en Galaxy: cargar archivos, uso de herramientas y visualización de historiales.

Expand Down Expand Up @@ -306,6 +306,5 @@ Tu ventana principal de Galaxy mostrará el historia actual como "Nuevo-Analisis
Puedes regresar a la página "View all histories" en cualquier momento para cambiar de historial.

# Conclusión
{:.no_toc}

{% icon trophy %} ¡Bien hecho! Has completado el tutorial de Breve introducción a Galaxy, donde aprendiste a nombrar un historial, cargar un archivo, utilizar una herramienta y visualizar los resultados. Hay tutoriales adicionales disponibles para una introducción más detallada a las funciones de Galaxy.
2 changes: 0 additions & 2 deletions topics/metagenomics/tutorials/metatranscriptomics/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ In this tutorial we will perform a metatranscriptomics analysis based on the ASA
{: .comment}

# Introduction
{:.no_toc}

Microbiomes play a critical role in host health, disease, and the environment. The study of microbiota and microbial communities has been facilitated by the evolution of technologies, specifically the sequencing techniques. We can now study the microbiome dynamics by investigating the DNA content (metagenomics), RNA expression (metatranscriptomics), protein expression (metaproteomics) or small molecules (metabolomics):

Expand Down Expand Up @@ -1141,7 +1140,6 @@ Hungateiclostridium 94.67418 Hungateiclostridium_thermocellum 94.67418 UniRef90_
We could now apply the same tool to the pathways and run similar analysis.
# Conclusion
{:.no_toc}
In this tutorial, we analyzed one metatranscriptomics sample from raw sequences to community structure, functional profiling. To do that, we:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,4 @@ contributors:

---




{% include {{ page.dir }}content.md short=false %}
{% include topics/metagenomics/tutorials/metatranscriptomics/content.md short=false %}
2 changes: 1 addition & 1 deletion topics/metagenomics/tutorials/mothur-miseq-sop/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ taxonomy files. In the following exercise, we will create a Krona plot with per-
> >
> > <br> The final result should look something like this (switch between samples via the list on the left): <br><br>
> >
> > <iframe id="krona" src="krona_multisample.html" frameBorder="0" width="100%" height="900px"> ![Krona](../../images/krona_multisample.png) </iframe>
> > <iframe id="krona" src="krona_multisample.html" frameBorder="0" width="100%" height="900px"></iframe>
> >
> {: .solution }
{: .question}
Expand Down
2 changes: 1 addition & 1 deletion topics/metagenomics/tutorials/mothur-miseq-sop/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ contributors:
- tnabtaf
---

{% include {{ page.dir }}content.md short=false %}
{% include topics/metagenomics/tutorials/mothur-miseq-sop/content.md short=false %}
14 changes: 14 additions & 0 deletions topics/teaching/tutorials/hybrid-training/tutorial.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@article{Hall_2021,
doi = {10.1371/journal.pcbi.1008715},
url = {https://doi.org/10.1371%2Fjournal.pcbi.1008715},
year = 2021,
month = {mar},
publisher = {Public Library of Science ({PLoS})},
volume = {17},
number = {3},
pages = {e1008715},
author = {Christina R. Hall and Philippa C. Griffin and Andrew J. Lonie and Jeffrey H. Christiansen},
editor = {Patricia M. Palagi},
title = {Application of a bioinformatics training delivery method for reaching dispersed and distant trainees},
journal = {PLoS Comput Biol}
}
Loading

0 comments on commit 96e0180

Please sign in to comment.