Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GO REFs page #513

Merged
merged 6 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ tramp
.org-id-locations
*_archive

## Other IDEs
.vscode
.idea

###
### From upstream jekyll theme.
###
Expand All @@ -42,3 +46,6 @@ _site
vendor/bundle

_algolia_api_key

## Transient data
_data/gorefs.yaml
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ group :jekyll_plugins do
gem "jekyll-redirect-from"
gem "jekyll-seo-tag"
gem 'jekyll-algolia', '~> 1.0'
gem 'jekyll-datapage-generator'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem "rinku", "~> 2.0"
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ GEM
nokogiri (~> 1.6)
progressbar (~> 1.9)
verbal_expressions (~> 0.1.5)
jekyll-datapage-generator (1.4.0)
jekyll-feed (0.11.0)
jekyll (~> 3.3)
jekyll-redirect-from (0.16.0)
Expand Down Expand Up @@ -65,6 +66,7 @@ GEM
rb-fsevent (0.11.0)
rb-inotify (0.10.1)
ffi (~> 1.0)
rinku (2.0.6)
rouge (1.11.1)
safe_yaml (1.0.5)
sass (3.7.4)
Expand All @@ -81,10 +83,12 @@ PLATFORMS
DEPENDENCIES
jekyll (= 3.4.3)
jekyll-algolia (~> 1.0)
jekyll-datapage-generator
jekyll-feed
jekyll-redirect-from
jekyll-seo-tag
jekyll-sitemap
rinku (~> 2.0)
tzinfo-data
webrick

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.PHONY: _data/gorefs.yaml

_data/gorefs.yaml:
wget -O $@ https://raw.githubusercontent.com/geneontology/go-site/master/metadata/gorefs.yaml
9 changes: 6 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ gems:
- jekyll-redirect-from
- jekyll-seo-tag
- jekyll-sitemap
- jekyll-datapage-generator

exclude:
- Gemfile
Expand Down Expand Up @@ -60,9 +61,6 @@ collections:
permalink: /blog/:year/:month/:day/:title/
output: true

plugins_dir:
- jekyll-redirect-from

sass:
sass_dir: _sass

Expand All @@ -81,3 +79,8 @@ algolia:
- covid-19.html
# nodes_to_index: 'article' # elements to be indexed
nodes_to_index: 'p,blockquote,li,div,paragraph,td,span,h1,h2,h3'

page_gen:
- data: gorefs
template: goref
name: id
42 changes: 42 additions & 0 deletions _includes/goref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<div>
<span class="label label-primary">{{ include.goref.id }}</span>
{% if include.goref.is_obsolete %}
<span class="label label-danger text-uppercase">obsolete</span>
{% endif %}
</div>
<h2>{{ include.goref.title }}</h2>
<p>{{ include.goref.authors }}; {{ include.goref.year }}</p>
<p>{{ include.goref.description | markdownify | autolinkify }}</p>

{% if include.goref.comments %}
<h3>Comments</h3>
<ul>
{% for comment in include.goref.comments %}
<li>{{ comment | markdownify | autolinkify }}</li>
{% endfor %}
</ul>
{% endif %}

{% if include.goref.citation %}
<div class="row">
<div class="col-sm-2"><b>Citation</b></div>
<div class="col-sm-10">
<a href="http://www.ncbi.nlm.nih.gov/pubmed/{{ include.goref.citation | remove_first: 'PMID:' }}" target="_blank">
{{ include.goref.citation }}
</a>
</div>
</div>
{% endif %}

{% if include.goref.external_accession %}
<div class="row">
<div class="col-sm-2"><b>External xrefs</b></div>
<div class="col-sm-10">
<ul class="list-unstyled">
{% for xref in include.goref.external_accession %}
<li>{{ xref }}</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
5 changes: 5 additions & 0 deletions _includes/goref_toc_list_item.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<li>
<a class="u-margin-bottom-xsmall" href="{{ include.goref.id | datapage_url: 'gorefs' }}">
[{{ include.goref.id }}] {{ include.goref.title }}
</a>
</li>
13 changes: 13 additions & 0 deletions _layouts/goref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
layout: default
---

<div class="container">
<div class="u-margin-bottom-medium">
<a href="{{ '/gorefs.html' | relative_url }}">
<i class="fa fa-chevron-left" aria-hidden="true"></i>
All GO REFs
</a>
</div>
{% include goref.html goref=page %}
</div>
11 changes: 11 additions & 0 deletions _plugins/autolinkify.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'rinku'

module Jekyll
module AutolinkifyFilter
def autolinkify(input)
Rinku.auto_link(input, :all, 'target="_blank"')
end
end
end

Liquid::Template.register_filter(Jekyll::AutolinkifyFilter)
70 changes: 50 additions & 20 deletions _sass/custom/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,59 @@ a {
text-decoration: none;
}

a:not(.btn):not(.yasr_btn):not(.list-group-item):not(.dropdown-menu__item__link):not(.go-link):not(.basic-link) {
color: $color-primary;
text-decoration: none !important;
display: inline-block;
.permalink {
font-family: inherit;
position: relative;

&:hover::before {
content: '#';
position: absolute;
left: -0.8em;
top: 0.2em;
font-size: 0.8em;
opacity: 0.7;
}
}

a:not(.btn):not(.yasr_btn):not(.list-group-item):not(.dropdown-menu__item__link):not(.go-link):not(.basic-link):after {
background: none repeat scroll 0 0 transparent;
bottom: 0;
content: "";
.permalink-anchor {
// Account for the fixed header
display: block;
height: 2px;
left: 50%;
position: absolute;
background: $color-primary;
transition: width 0.3s ease 0s, left 0.3s ease 0s;
width: 0;
position: relative;
top: -65px;
visibility: hidden;
}

a:not(.btn):not(.list-group-item):not(.dropdown-menu__item__link):not(.go-link):not(.basic-link):hover:after {
width: 100%;
left: 0;
a:not(.btn):not(.yasr_btn):not(.list-group-item):not(.dropdown-menu__item__link):not(.go-link):not(.basic-link):not(.permalink) {
color: $color-primary;
text-decoration: none !important;
display: inline-block;
position: relative;

&::after {
background: none repeat scroll 0 0 transparent;
bottom: 0;
content: "";
display: block;
height: 2px;
left: 50%;
position: absolute;
background: $color-primary;
transition: width 0.3s ease 0s, left 0.3s ease 0s;
width: 0;
}

&:hover::after {
width: 100%;
left: 0;
}

// Because these links are inline-block elements, in a <li> element the ::marker next to one
// would be aligned to the bottom by default if it wraps across multiple lines. This looks
// weird. So if the link is a direct child of a list item, set the vertical-align to top.
// Re funky syntax: https://github.com/sass/sass/issues/1425
@at-root li > #{&} {
vertical-align: top;
}
}

.btn {
Expand Down Expand Up @@ -107,10 +137,10 @@ a:not(.btn):not(.list-group-item):not(.dropdown-menu__item__link):not(.go-link):
padding: 8px 6px;
text-decoration: none;
font-weight: 400 !important;
width: 100%;
width: 100%;
transition: padding 0.2s;
// transition: 0.15s text-align ease;

&:hover {
text-decoration: none;
font-weight: 400 !important;
Expand Down Expand Up @@ -207,7 +237,7 @@ a:not(.btn):not(.list-group-item):not(.dropdown-menu__item__link):not(.go-link):
}

.fa {
text-shadow: rgba(0, 0, 0, 0.25) 1.5px 1.5px 5px;
text-shadow: rgba(0, 0, 0, 0.25) 1.5px 1.5px 5px;
}

.input_hint {
Expand Down
39 changes: 39 additions & 0 deletions gorefs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
# Note that when developing locally, this page must be reached by visiting /gorefs.html. Without
# the .html extension (/gorefs), an index page for the gorefs directory generated by the
# jekyll-datapage-generator plugin will be displayed instead. This is a quirk of the Jekyll
# development web server. When deployed on GitHub pages, this page will be available at /gorefs
# without the .html extension.

layout: default
---

<div class="container">
<h1>GO REFs</h1>
<p>This is a collection of references used by the GO Consortium</p>

{% if jekyll.environment == "development" %}
{% unless site.data.gorefs %}
<div class="alert alert-warning">
<strong>Warning!</strong> No GO_REFs found. Did you run <code>make _data/gorefs.yml</code>?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pkalita-lbl Technically, this should never be an issue as it's handled automatically, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automatic in the production build and deploy workflow, yes (as outlined in #507). It's not as easy to automate it for a local development environment. I looked into ways to hook into Jekyll's build process to make it fully automatic, full stop, but it felt a bit like overkill. In the end I figured that requiring a developer to run one make command if they want to work on that page isn't a bad compromise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes perfect sense--I just wanted to make sure we weren't going to panic Suzi.

</div>
{% endunless %}
{% endif %}

<ul>
{% for goref in site.data.gorefs %}
{% unless goref.is_obsolete %}
{% include goref_toc_list_item.html goref=goref %}
{% endunless %}
{% endfor %}
</ul>

<h2>Obsolete GO REFs</h2>
<ul>
{% for goref in site.data.gorefs %}
{% if goref.is_obsolete %}
{% include goref_toc_list_item.html goref=goref %}
{% endif %}
{% endfor %}
</ul>
</div>