Skip to content

Commit

Permalink
Merge pull request #9 from charlesrocket/project
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesrocket authored Jan 27, 2024
2 parents 879dd26 + 53a1dfb commit 88228d0
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 16 deletions.
18 changes: 9 additions & 9 deletions content/pages/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ template = "page.html"
draft = false
+++

{{ project(gh_repo="halve-z") }}
{{ project(link="https://github.com/charlesrocket/halve-z") }}

{{ project(gh_repo="dorst") }}
{{ project(link="https://github.com/charlesrocket/dorst") }}

{{ project(gh_repo="freebsd-collection") }}
{{ project(link="https://github.com/charlesrocket/freebsd-collection") }}

{{ project(gh_repo="essential-collection") }}
{{ project(link="https://github.com/charlesrocket/essential-collection") }}

{{ project(gh_repo="webpixels") }}
{{ project(link="https://github.com/charlesrocket/webpixels") }}

{{ project(gh_repo="pixelmosh") }}
{{ project(link="https://github.com/charlesrocket/pixelmosh") }}

{{ project(gh_repo="skully") }}
{{ project(link="https://github.com/charlesrocket/skully") }}

{{ project(gh_repo="beastie") }}
{{ project(link="https://github.com/charlesrocket/beastie") }}

{{ project(gh_repo="frightcrawler") }}
{{ project(link="https://github.com/charlesrocket/frightcrawler") }}
25 changes: 25 additions & 0 deletions content/posts/project/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
+++
title = "Projects"
date = 2022-12-31
[taxonomies]
categories = ["usage"]
tags = ["content", "features"]
[extra]
subtitle = "Project cards"
+++

input:

```rs
{{/* project(link="https://github.com/charlesrocket/halve-z") */}}
```

- `link`: the address of the repository (mandatory)

output:

```html
{{ project(link="https://github.com/charlesrocket/halve-z") }}
```

{{ project(link="https://github.com/charlesrocket/halve-z") }}
16 changes: 9 additions & 7 deletions templates/shortcodes/project.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{% set gh_repo_link = "https://api.github.com/repos/charlesrocket/" ~ gh_repo %}
{% set gh_repo_data = load_data(url=gh_repo_link, format="json") %}
{%- if link is starting_with("https://github.com") %}
{%- set gh_repo_link = link | replace(from="https://github.com", to="https://api.github.com/repos") %}
{%- set gh_repo_data = load_data(url=gh_repo_link, format="json") %}
{%- endif %}
<div class="projects frame-dim">
<h3><a href="{{ gh_repo_data['html_url'] | safe }}" target="_blank">{{ gh_repo_data["name"] }}</a></h3>
<ul class="project-list">
<li>{{ gh_repo_data["language"] | default(value="") | safe }} <span class="{{ gh_repo_data["language"] | default(value="") | replace(from="#", to="-Sharp") | replace(from="++", to="pp") | replace(from="-", to="") | replace(from=" ", to="") | safe }}">&#42;</span></li>
<li><b>{{ gh_repo_data["language"] | default(value="") | safe }}</b> <span class="{{ gh_repo_data["language"] | default(value="") | replace(from="#", to="-Sharp") | replace(from="++", to="pp") | replace(from="-", to="") | replace(from=" ", to="") | safe }}"><b>&#42;</b></span></li>
<li><span class="project-license">{{ gh_repo_data["license"]["spdx_id"] | default(value="") | safe }}</span></li>
<li>{{ gh_repo_data["description"] | default(value="") | regex_replace(pattern='\p{Emoji}', rep='') | safe }}</li>
<li><ul class="tags project-tags">
{% for topic in gh_repo_data["topics"] %}
{%- for topic in gh_repo_data["topics"] %}
<li>{{ topic }}</li>
{% if not loop.last %}
{% endif %}
{% endfor %}
{%- if not loop.last %}
{%- endif %}
{%- endfor %}
</ul></li>
</ul>
</div>

0 comments on commit 88228d0

Please sign in to comment.