Skip to content

Commit

Permalink
Merge pull request #1152 from EricFromCanada/master
Browse files Browse the repository at this point in the history
drop usage of `formula_path`
  • Loading branch information
MikeMcQuaid authored May 2, 2024
2 parents abe0566 + b19c37d commit 714cfbe
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion _includes/formula.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

<td><a href="{{ site.baseurl }}/{{ include.formula_path || default: "formula" }}/{{ include.formula.name | uri_escape }}"
<td><a href="{{ site.baseurl }}/formula/{{ include.formula.name | uri_escape }}"
{%- if include.formula.disabled %} class="disabled" title="This formula has been disabled"
{%- elsif include.formula.deprecated %} class="deprecated" title="This formula has been deprecated"
{%- endif -%}
Expand Down
10 changes: 4 additions & 6 deletions _includes/formulae.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{%- if include.formulae.size > 0 %}
<p>{{ include.description }}:</p>
<table>
{%- assign formula_path = include.formula_path -%}
{%- for full_name in include.formulae -%}
<tr>
{%- assign data_name = full_name | remove: "@" | remove: "." | replace: "+", "_" -%}
{%- assign formula = site.data[formula_path][data_name] -%}
{%- assign formula = site.data.formula[data_name] -%}
{%- unless formula -%}
{%- assign canonical_map = formula_path | append: "_canonical" -%}
{%- assign data_name = site.data[canonical_map][full_name] | remove: "@" | remove: "." | replace: "+", "_" -%}
{%- assign formula = site.data[formula_path][data_name] -%}
{%- assign data_name = site.data.formula_canonical[full_name] | remove: "@" | remove: "." | replace: "+", "_" -%}
{%- assign formula = site.data.formula[data_name] -%}
{%- endunless -%}
{%- include formula.html formula_path=formula_path formula=formula -%}
{%- include formula.html formula=formula -%}
</tr>
{%- endfor -%}
</table>
Expand Down
5 changes: 2 additions & 3 deletions _layouts/cask.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
permalink: :title
---
{%- assign full_name = page.title -%}
{%- assign formula_path = "formula" -%}
{%- assign data_name = full_name | remove: "@" | remove: "." | replace: "+", "_" -%}
{%- assign c = site.data.cask[data_name] -%}
<h2
Expand Down Expand Up @@ -36,7 +35,7 @@

{%- if c.depends_on.size > 0 -%}
{%- include casks.html casks=c.depends_on.cask description="Depends on casks" -%}
{%- include formulae.html formula_path=formula_path formulae=c.depends_on.formula description="Depends on" -%}
{%- include formulae.html formulae=c.depends_on.formula description="Depends on" -%}
{%- assign requirements = "" -%}
{%- if c.depends_on.macos -%}
{%- capture requirements -%}
Expand Down Expand Up @@ -65,7 +64,7 @@
{%- include casks.html casks=c.conflicts_with.cask description="Conflicts with casks" -%}

{%- assign conflicts_with_formula = c.conflicts_with.formula | where_exp: "f", "site.data.formula[f]" -%}
{%- include formulae.html formula_path=formula_path formulae=conflicts_with_formula description="Conflicts with" -%}
{%- include formulae.html formulae=conflicts_with_formula description="Conflicts with" -%}

{%- if c.caveats -%}
{%- capture soft_indent %}
Expand Down
19 changes: 9 additions & 10 deletions _layouts/formula.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
permalink: :title
---
{%- assign full_name = page.title -%}
{%- assign formula_path = "formula" -%}
{%- assign data_name = full_name | remove: "@" | remove: "." | replace: "+", "_" -%}
{%- assign f = site.data[formula_path][data_name] -%}
{%- assign f = site.data.formula[data_name] -%}
<h2
{%- if f.disabled %} class="disabled" title="This formula has been disabled since {{ f.disable_date | escape }} because it {{ f.disable_reason | escape }}"
{%- elsif f.deprecated %} class="deprecated" title="This formula has been deprecated since {{ f.deprecation_date | escape }} because it {{ f.deprecation_reason | escape }}"
Expand Down Expand Up @@ -40,7 +39,7 @@
</p>
{%- endif %}

<p>Formula JSON API: <a href="{{ site.baseurl }}/api/{{ formula_path }}/{{ f.name | uri_escape }}.json"><code>/api/{{ formula_path }}/{{ f.name | escape }}.json</code></a></p>
<p>Formula JSON API: <a href="{{ site.baseurl }}/api/formula/{{ f.name | uri_escape }}.json"><code>/api/formula/{{ f.name | escape }}.json</code></a></p>

<p>Formula code: <a target="_blank" href="{{ site.taps.core.remote }}/blob/{{ f.tap_git_head | url_encode }}/{{ f.ruby_source_path | uri_escape }}"><code>{{ f.name | escape }}.rb</code></a> on GitHub</p>

Expand Down Expand Up @@ -116,7 +115,7 @@
{%- endif %}
</table>

{%- include formulae.html formula_path=formula_path formulae=f.versioned_formulae description="Other versions" -%}
{%- include formulae.html formulae=f.versioned_formulae description="Other versions" -%}

{%- if f.revision > 0 %}
<p>Revision: <strong>{{ f.revision }}</strong></p>
Expand All @@ -138,10 +137,10 @@
</table>
{%- endif -%}

{%- include formulae.html formula_path=formula_path formulae=f.dependencies description="Depends on" -%}
{%- include formulae.html formula_path=formula_path formulae=f.recommended_dependencies description="Depends on recommended" -%}
{%- include formulae.html formula_path=formula_path formulae=f.optional_dependencies description="Depends on optionally" -%}
{%- include formulae.html formula_path=formula_path formulae=f.build_dependencies description="Depends on when building from source" -%}
{%- include formulae.html formulae=f.dependencies description="Depends on" -%}
{%- include formulae.html formulae=f.recommended_dependencies description="Depends on recommended" -%}
{%- include formulae.html formulae=f.optional_dependencies description="Depends on optionally" -%}
{%- include formulae.html formulae=f.build_dependencies description="Depends on when building from source" -%}

{%- if f.requirements.size > 0 %}
<p>Requires:
Expand All @@ -159,7 +158,7 @@
{{ r.name | capitalize | escape }}
{%- endcase -%}
{%- endcapture -%}
{%- if r.cask and formula_path == "formula" -%}
{%- if r.cask -%}
{%- unless r.cask contains "/" -%}
<a href="{{ site.baseurl }}/cask/{{ r.cask | uri_escape }}">{{ requirement }}</a>
{%- else -%}
Expand Down Expand Up @@ -189,7 +188,7 @@
{%- if f.conflicts_with.size > 0 %}
<p>Conflicts with:
{%- for c in f.conflicts_with %}
<strong><a href="{{ site.baseurl }}/{{ formula_path }}/{{ c | uri_escape }}">{{ c | escape }}</a></strong>
<strong><a href="{{ site.baseurl }}/formula/{{ c | uri_escape }}">{{ c | escape }}</a></strong>
{%- unless forloop.last -%}, {% endunless -%}
{%- endfor %}
</p>
Expand Down

0 comments on commit 714cfbe

Please sign in to comment.