Skip to content

Commit

Permalink
Unify many notice styles to a single include
Browse files Browse the repository at this point in the history
And update the documentation accordingly.

See #35.
  • Loading branch information
ctrueden committed May 20, 2021
1 parent fc56b1d commit 43d50d7
Show file tree
Hide file tree
Showing 88 changed files with 405 additions and 533 deletions.
26 changes: 0 additions & 26 deletions _includes/ambox

This file was deleted.

16 changes: 0 additions & 16 deletions _includes/fiji

This file was deleted.

25 changes: 0 additions & 25 deletions _includes/imagej1

This file was deleted.

2 changes: 1 addition & 1 deletion _includes/importing-classes
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
To reference Java classes from {{include.lang}} you will need to import them.
<br>
{% include warning-box content='Unlike [ImageJ 1.x](/software/imagej1), [ImageJ2](/software/imagej2) (and therefore [Fiji](/fiji)) does not automatically import any classes. Consequently, scripts written for ImageJ 1.x will not run in ImageJ2 without adding the proper imports. The rationale is that the auto-import feature is not safe. What if two classes of the same name live in two different packages? Or if a new class is introduced that makes formerly unique names ambiguous? All of a sudden, all of the scripts that reference the original class no longer work. In short: auto-imports are dangerously imprecise.' %}
{% include notice icon="warning" content='Unlike [ImageJ 1.x](/software/imagej1), [ImageJ2](/software/imagej2) (and therefore [Fiji](/fiji)) does not automatically import any classes. Consequently, scripts written for ImageJ 1.x will not run in ImageJ2 without adding the proper imports. The rationale is that the auto-import feature is not safe. What if two classes of the same name live in two different packages? Or if a new class is introduced that makes formerly unique names ambiguous? All of a sudden, all of the scripts that reference the original class no longer work. In short: auto-imports are dangerously imprecise.' %}
<br>

{%- comment -%}
Expand Down
26 changes: 0 additions & 26 deletions _includes/linux

This file was deleted.

26 changes: 0 additions & 26 deletions _includes/macos

This file was deleted.

71 changes: 71 additions & 0 deletions _includes/notice
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{%- comment -%}
Adds a stylized notice.
{%- endcomment -%}

{%- assign content = include.content | markdownify -%}
{%- assign icon = include.icon -%}
{%- assign glyph = include.glyph -%}
{%- assign glyph-classes = include.class | default: "" -%}
{%- assign background-color = include.background-color -%}
{%- assign highlight-color = include.highlight-color -%}

{%- comment -%} Infer glyph from common icons. {%- endcomment -%}
{%- unless glyph -%}
{%- capture glyph -%}
{%- case icon -%}
{%- when "tip" -%} &#128161;
{%- endcase -%}
{%- endcapture -%}
{%- endunless -%}

{%- comment -%} Infer background color from common icons. {%- endcomment -%}
{%- unless background-color -%}
{%- capture background-color -%}
{%- case icon -%}
{%- when "info" -%} #ebf2f8
{%- when "tip" -%} #dedede
{%- when "warning" -%} #ffcccb
{%- else -%} #e6e6e6
{%- endcase -%}
{%- endcapture -%}
{%- endunless -%}

{%- comment -%} Infer highlight color from common icons. {%- endcomment -%}
{%- unless highlight-color -%}
{%- capture highlight-color -%}
{%- case icon -%}
{%- when "android" -%} #a4c639
{%- when "fiji" -%} #65a4e3
{%- when "imagej" -%} #fadd8d
{%- when "imagej1" -%} #fadd8d
{%- when "imagej2" -%} #fadd8d
{%- when "info" -%} #67a1fe
{%- when "linux" -%} black
{%- when "tech" -%} #bdbdbd
{%- when "tip" -%} #7e7e7e
{%- when "warning" -%} #f57900
{%- when "windows" -%} #00adef
{%- else -%} gold
{%- endcase -%}
{%- endcapture -%}
{%- endunless -%}

<div class="notice" style="background: {{background-color}}; border-left: 10px solid {{highlight-color}}">
{%- if glyph != "" or glyph-classes != "" -%}
<div class="notice-icon"><span class="{{glyph-classes}}">{{glyph}}</span></div>
{%- elsif icon and icon != "" -%}
{%- capture src -%} {%- include util/find-icon path=icon -%} {%- endcapture -%}
{%- assign extension = src | slice: -4, 4 | downcase -%}
{%- if extension == '.svg' -%}
{%- comment -%} Vector images need an explicit width. {%- endcomment -%}
<div class="notice-icon"><img src="{{src}}" width="32"></div>
{%- else -%}
<div class="notice-icon"><img src="{{src}}"></div>
{%- endif -%}
{%- endif -%}
<div class="notice-content">{{content}}</div>
</div>

{%- comment -%}
# vi:syntax=liquid
{%- endcomment -%}
15 changes: 1 addition & 14 deletions _includes/outdated
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
<div class="note">
<table class="table-warning warning-notice">
<tbody>
<tr>
<td>
<img src="/media/icons/warning.png">
</td>
<td>
This section is out of date, potentially misleading or invalid. Be careful with any instructions here. When in doubt, <a href="/help">ask for help from the community</a>.
</td>
</tr>
</tbody>
</table>
</div>
{% include notice icon="warning" content="This section is out of date, potentially misleading or invalid. Be careful with any instructions here. When in doubt, [ask for help from the community](/help)." %}

{%- comment -%}
# vi:syntax=liquid
Expand Down
2 changes: 1 addition & 1 deletion _includes/sntdeprecation
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% include warning-box content="This page is outdated and and likely irrelevant. The latest SNT documentation can be found [here](/plugins/snt)" %}
{% include notice icon="warning" content="This page is outdated and and likely irrelevant. The latest SNT documentation can be found [here](/plugins/snt)" %}

{%- comment -%}
# vi:syntax=liquid
Expand Down
2 changes: 1 addition & 1 deletion _includes/stub
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This page is empty! Please help fill it in.
{% include notice icon="info" content="This page is empty! Please help fill it in." %}

{%- comment -%}
# vi:syntax=liquid
Expand Down
26 changes: 0 additions & 26 deletions _includes/tech-box

This file was deleted.

27 changes: 0 additions & 27 deletions _includes/tip

This file was deleted.

2 changes: 1 addition & 1 deletion _includes/unmaintained
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% include warning-box content="This page describes a [plugin](/plugins) which is **_UNMAINTAINED_**! While the plugin and documentation remain available for use, no one is pledged to fix bugs or respond to support questions about it. You can try [asking for help from the community](/help), but your mileage may vary." %}
{% include notice icon="warning" content="This page describes a [plugin](/plugins) which is **_UNMAINTAINED_**! While the plugin and documentation remain available for use, no one is pledged to fix bugs or respond to support questions about it. You can try [asking for help from the community](/help), but your mileage may vary." %}

{%- comment -%}
# vi:syntax=liquid
Expand Down
2 changes: 1 addition & 1 deletion _includes/updatesiteswarning-box
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% include warning-box content="Update sites are a fantastic way to get new functionality in your ImageJ app.<br>Unfortunately they are also one of the easiest ways to break an installation, by adding an update site that clashes with another update site, or even the ImageJ core.<br>So, before enabling a new update site, it's safest to [back up your installation](/plugins/make-fiji-package)" %}
{% include notice icon="warning" content="Update sites are a fantastic way to get new functionality in your ImageJ app.<br>Unfortunately they are also one of the easiest ways to break an installation, by adding an update site that clashes with another update site, or even the ImageJ core.<br>So, before enabling a new update site, it's safest to [back up your installation](/plugins/make-fiji-package)" %}

{%- comment -%}
# vi:syntax=liquid
Expand Down
19 changes: 0 additions & 19 deletions _includes/warning-box

This file was deleted.

26 changes: 0 additions & 26 deletions _includes/windows

This file was deleted.

3 changes: 2 additions & 1 deletion _includes/wip
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% include warning-box content="This page or section is a WORK IN PROGRESS, and still unfinished!" %}
{% include notice icon="warning" content="This page or section is a WORK IN PROGRESS, and still unfinished!" %}

{%- comment -%}
# vi:syntax=liquid
{%- endcomment -%}
2 changes: 1 addition & 1 deletion _pages/ImgLibProcessor.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: ImgLibProcessor
categories: [ImageJ2,Development]
---

{% include warning-box content='The following article describes a method of ImageJ1/ImageJ2 integration we explored in 2010, revolving around an `ij.process.ImageProcessor` extension called `ImgLibProcessor` which would enable additional transparent usage of [ImgLib2](/libs/imglib2) from within ImageJ1, thus greatly expanding the available pixel types and storage strategies. However, after discussion with [Wayne Rasband](/users/rasband), we settled on a different method of backwards compatibility known as [ImageJ Legacy](/libs/imagej-legacy). The text below is preserved only for historical reasons.' %}
{% include notice icon="warning" content='The following article describes a method of ImageJ1/ImageJ2 integration we explored in 2010, revolving around an `ij.process.ImageProcessor` extension called `ImgLibProcessor` which would enable additional transparent usage of [ImgLib2](/libs/imglib2) from within ImageJ1, thus greatly expanding the available pixel types and storage strategies. However, after discussion with [Wayne Rasband](/users/rasband), we settled on a different method of backwards compatibility known as [ImageJ Legacy](/libs/imagej-legacy). The text below is preserved only for historical reasons.' %}


## Design
Expand Down
2 changes: 1 addition & 1 deletion _pages/Installing_3rd_party_plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ It will ask you for the file name of the plugin, and install the given file.

## For developers

{% include warning-box content='This section is out of date, potentially misleading or invalid. Be careful with any instructions here. When in doubt, [ask for help from the community](/help).' %}
{% include notice icon="warning" content='This section is out of date, potentially misleading or invalid. Be careful with any instructions here. When in doubt, [ask for help from the community](/help).' %}

Please try to avoid closed-source plugins.

Expand Down
2 changes: 1 addition & 1 deletion _pages/about/contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ categories: [community]

# Who we are

{% include ambox text="This list is only irregularly updated." %}
{% include notice icon="info" content="This list is only irregularly updated." %}

<div style="display: flex; flex-wrap: wrap">

Expand Down
2 changes: 1 addition & 1 deletion _pages/develop/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ There are two easy ways of going about this:

In the case of Eclipse, you may need to "Update Maven project" in order to see the snapshot couplings go into effect; the shortcut {% include key keys='Alt|F5' %} while selecting the affected project(s) accomplishes this quickly.

{% include warning-box content='**Current versions of the Eclipse Maven integration (tested with Eclipse Mars) fail to correctly resolve the `LATEST` version tag to `SNAPSHOT`s. Use the command-line client instead.**' %}
{% include notice icon="warning" content='**Current versions of the Eclipse Maven integration (tested with Eclipse Mars) fail to correctly resolve the `LATEST` version tag to `SNAPSHOT`s. Use the command-line client instead.**' %}

Either way, ***be sure to work on a topic branch while developing code in this fashion.*** You will need to clean up your Git history afterwards before merging things to the `master` branch, in order to achieve [reproducible builds](#reproducible-builds).

Expand Down
Loading

0 comments on commit 43d50d7

Please sign in to comment.