~aw/patches

5 2

[PATCH mygit v1 1/2] get site name directly from CONFIG

Johann Galle
Details
Message ID
<20210323080251.2129-1-johann@qwertqwefsday.eu>
DKIM signature
pass
Download raw message
Patch: +2 -6
From: Johann150 <johann@qwertqwefsday.eu>

This reverts commit 04082ef80ab084046f6faf228dfdcc365b49333a.
---
 src/main.rs          | 6 +-----
 templates/index.html | 2 +-
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index be316b0..c78f8f1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -100,7 +100,6 @@ fn args() -> Config {
#[template(path = "index.html")] // using the template in this path, relative
struct IndexTemplate {
    repos: Vec<Repository>,
    site_name: String,
}

async fn index(_req: Request<()>) -> tide::Result {
@@ -118,10 +117,7 @@ async fn index(_req: Request<()>) -> tide::Result {
        })
        .map_err(|e| tide::log::warn!("can not read repositories: {}", e))
        .unwrap_or_default();
    let index_template = IndexTemplate {
        repos,
        site_name: CONFIG.site_name.to_owned(),
    };
    let index_template = IndexTemplate { repos };

    Ok(index_template.into())
}
diff --git a/templates/index.html b/templates/index.html
index 7744fe6..f0ed91e 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -1,7 +1,7 @@
{% extends "base.html" %}

{% block content %}
<div class="page-title"><h1>{{site_name}}</h1></div>
  <div class="page-title"><h1>{{crate::CONFIG.site_name}}</h1></div>
  <div>
  <table>
  {% for repo in repos %}
-- 
2.20.1

[PATCH mygit v1 2/2] improve template indentation

Johann Galle
Details
Message ID
<20210323080251.2129-2-johann@qwertqwefsday.eu>
In-Reply-To
<20210323080251.2129-1-johann@qwertqwefsday.eu> (view parent)
DKIM signature
pass
Download raw message
From: Johann150 <johann@qwertqwefsday.eu>

---
 templates/base.html        |  2 +-
 templates/commit.html      | 10 ++++-----
 templates/files.html       |  0
 templates/index.html       | 18 ++++++++--------
 templates/log.html         | 18 ++++++++--------
 templates/refs.html        | 24 ++++++++++++---------
 templates/repo-navbar.html |  9 ++++++--
 templates/tree.html        | 44 +++++++++++++++++++-------------------
 8 files changed, 67 insertions(+), 58 deletions(-)
 delete mode 100644 templates/files.html

diff --git a/templates/base.html b/templates/base.html
index 637a281..ee14493 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -15,7 +15,7 @@
     </div>
   <hr class="thin">
   <div class="footer">
-  Server running <a href="https://git.alexwennerberg.com/mygit">mygit</a>
+    Server running <a href="https://git.alexwennerberg.com/mygit">mygit</a>
   </div>
   </body>
 </html>
diff --git a/templates/commit.html b/templates/commit.html
index 1e140c9..8c256bb 100644
--- a/templates/commit.html
+++ b/templates/commit.html
@@ -2,17 +2,17 @@
 
 {% block content %}
   {% include "repo-navbar.html" %}
-  <b>Commit:</b> <div class="commit-hash">{{commit.id()}}</div> (<a href="/{{repo|repo_name|urlencode_strict}}/tree/{{parent.id()}}">tree</a>)
+  <strong>Commit:</strong> <div class="commit-hash">{{commit.id()}}</div> (<a href="/{{repo|repo_name|urlencode_strict}}/tree/{{parent.id()}}">tree</a>)
   <br>
-  <b>Parent:</b> <a href="/{{repo|repo_name|urlencode_strict}}/commit/{{parent.id()}}"><div class="commit-hash">{{parent.id()}}</div></a> (<a href="/{{repo|repo_name|urlencode_strict}}/tree/{{parent.id()}}">tree</a>)
+  <strong>Parent:</strong> <a href="/{{repo|repo_name|urlencode_strict}}/commit/{{parent.id()}}"><div class="commit-hash">{{parent.id()}}</div></a> (<a href="/{{repo|repo_name|urlencode_strict}}/tree/{{parent.id()}}">tree</a>)
   <br>
-  <b>Author:</b> {{commit.author().name().unwrap()}} &lt;<a href="mailto:{{commit.author().email().unwrap()}}">{{commit.author().email().unwrap()}}</a>&gt;
+  <strong>Author:</strong> {{commit.author().name().unwrap()}} &lt;<a href="mailto:{{commit.author().email().unwrap()}}">{{commit.author().email().unwrap()}}</a>&gt;
   <br>
-  <b>Date:</b> {{commit.time()|format_datetime("%c %z")}}
+  <strong>Date:</strong> {{commit.time()|format_datetime("%c %z")}}
   <br>
   {% let stats = diff.stats().unwrap() %}
   {{stats.files_changed()}} files changed; {{stats.insertions()}} insertions {{stats.deletions()}} deletions
   <div class="commit-message">
-  {{commit.message().unwrap()}} 
+    {{commit.message().unwrap()}}
   </div>
 {% endblock %}
diff --git a/templates/files.html b/templates/files.html
deleted file mode 100644
index e69de29..0000000
diff --git a/templates/index.html b/templates/index.html
index f0ed91e..c439291 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -3,14 +3,14 @@
 {% block content %}
   <div class="page-title"><h1>{{crate::CONFIG.site_name}}</h1></div>
   <div>
-  <table>
-  {% for repo in repos %}
-  <tr>
-    <td class="repo-link"><a href="{{repo|repo_name|urlencode_strict}}">{{repo|repo_name}}</a></td>
-    <td class="repo-description">{{repo|description}}</td>
-    <td class="repo-last-updated">updated 2021-02-01</td>
-  </tr>
-  {% endfor %}
-  </table>
+    <table>
+      {% for repo in repos %}
+      <tr>
+        <td class="repo-link"><a href="{{repo|repo_name|urlencode_strict}}">{{repo|repo_name}}</a></td>
+        <td class="repo-description">{{repo|description}}</td>
+        <td class="repo-last-updated">updated 2021-02-01</td>
+      </tr>
+      {% endfor %}
+    </table>
   </div>
 {% endblock %}
diff --git a/templates/log.html b/templates/log.html
index 5ba59eb..6a321fb 100644
--- a/templates/log.html
+++ b/templates/log.html
@@ -4,15 +4,15 @@
   {% include "repo-navbar.html" %}
   <h3>{{branch}}</h3>
   <table>
-  {% for commit in commits %} 
-  <tr>
-    <td class="commit-hash"><a href="/{{repo|repo_name|urlencode_strict}}/commit/{{commit.id()}}">{{commit.id().to_string()[..7]}}</a></td>
-    {% let summary = commit.summary().unwrap_or("")|truncate(72) %}
-    <td class="commit-summary">{{summary}}</td>
-    <td class="commit-author-email"><a href="mailto:{{commit.author().email().unwrap_or("")}}">{{commit.author().name().unwrap_or(commit.author().email().unwrap_or(""))}}</a></td>
-    <td class="commit-date">{{commit.time()|format_datetime("%Y-%m-%d")}}</td>
-  </tr>
-  {% endfor %}
+    {% for commit in commits %}
+    <tr>
+      <td class="commit-hash"><a href="/{{repo|repo_name|urlencode_strict}}/commit/{{commit.id()}}">{{commit.id().to_string()[..7]}}</a></td>
+      {% let summary = commit.summary().unwrap_or("")|truncate(72) %}
+      <td class="commit-summary">{{summary}}</td>
+      <td class="commit-author-email"><a href="mailto:{{commit.author().email().unwrap_or("")}}">{{commit.author().name().unwrap_or(commit.author().email().unwrap_or(""))}}</a></td>
+      <td class="commit-date">{{commit.time()|format_datetime("%Y-%m-%d")}}</td>
+    </tr>
+    {% endfor %}
   </table>
 {% endblock %}
 
diff --git a/templates/refs.html b/templates/refs.html
index 15b7bfc..0a4a8e3 100644
--- a/templates/refs.html
+++ b/templates/refs.html
@@ -4,18 +4,22 @@
   {% include "repo-navbar.html" %}
   <h2>Branches</h2>
   <table>
-  {% for branch in branches %}
-  <tr>
-    <td class="git-reference">
-    <a href="/{{repo|repo_name|urlencode_strict}}/log/{{branch.shorthand().unwrap()}}">{{ branch.shorthand().unwrap() }}</a>
-    </td>
-  </tr>
-  {% endfor %}
+    {% for branch in branches %}
+    <tr>
+      <td class="git-reference">
+        <a href="/{{repo|repo_name|urlencode_strict}}/log/{{branch.shorthand().unwrap()}}">{{ branch.shorthand().unwrap() }}</a>
+      </td>
+    </tr>
+    {% endfor %}
   </table>
   <h2>Tags</h2>
   <table>
-  {% for tag in tags %}
-  <tr><td class="git-reference"><a href="/{{repo|repo_name|urlencode_strict}}/commit/{{tag.shorthand().unwrap()}}">{{ tag.shorthand().unwrap() }}</a></td></tr>
-  {% endfor %}
+    {% for tag in tags %}
+    <tr>
+      <td class="git-reference">
+        <a href="/{{repo|repo_name|urlencode_strict}}/commit/{{tag.shorthand().unwrap()}}">{{ tag.shorthand().unwrap() }}</a>
+      </td>
+    </tr>
+    {% endfor %}
   </table>
 {% endblock %}
diff --git a/templates/repo-navbar.html b/templates/repo-navbar.html
index 628dcad..5ee213e 100644
--- a/templates/repo-navbar.html
+++ b/templates/repo-navbar.html
@@ -1,5 +1,10 @@
 <h1><a href="/">index</a>/{{repo|repo_name}}</h1>
 <div>{{repo|description}}</div>
-<div class="clone-url">git clone {{crate::CONFIG.clone_base}}/{{repo|repo_name}} </div>
-<div class="navbar"><a href="/{{repo|repo_name|urlencode_strict}}">README</a> |  <a href="/{{repo|repo_name|urlencode_strict}}/tree">tree</a> |  <a href="/{{repo|repo_name|urlencode_strict}}/log">log</a> |  <a href="/{{repo|repo_name|urlencode_strict}}/refs">refs</a></div>
+<div class="clone-url">git clone {{crate::CONFIG.clone_base}}/{{repo|repo_name}}</div>
+<div class="navbar">
+  <a href="/{{repo|repo_name|urlencode_strict}}">README</a>
+  | <a href="/{{repo|repo_name|urlencode_strict}}/tree">tree</a>
+  | <a href="/{{repo|repo_name|urlencode_strict}}/log">log</a>
+  | <a href="/{{repo|repo_name|urlencode_strict}}/refs">refs</a>
+</div>
 <hr class='thin'>
diff --git a/templates/tree.html b/templates/tree.html
index f64d28a..620a266 100644
--- a/templates/tree.html
+++ b/templates/tree.html
@@ -4,28 +4,28 @@
   {% include "repo-navbar.html" %}
   <div>
     {% if path.to_string_lossy() != "" %}
-    <h3>{{path.to_string_lossy()}}/@<a href="/{{repo|repo_name|urlencode_strict}}/tree/{{spec}}">{{spec}}<a></h3>
+      <h3>{{path.to_string_lossy()}}/@<a href="/{{repo|repo_name|urlencode_strict}}/tree/{{spec}}">{{spec}}<a></h3>
     {% else %}
-  <h3>{{ spec }}</h3>
-  {% endif %}
-  <table>
-    {% for entry in tree %}
-    <tr>
-      <td class="permissions">
-        {{ entry.filemode()|unix_perms }}
-      </td>
-      <td class="filename">
-        <a href="/{{repo|repo_name|urlencode_strict}}/tree/{{ spec }}/item/{{path.join(entry.name().unwrap()).to_string_lossy()}}">
-        {{ entry.name().unwrap() }}{% if entry.to_object(repo).unwrap().as_tree().is_some() %}/{% endif %}</a>
-      </td>
-      <td class="filesize">
-        {% let obj = entry.to_object(repo).unwrap() %}
-        {% if obj.as_blob().is_some() %}
-        {{ entry.to_object(repo).unwrap().into_blob().unwrap().content().len()|filesizeformat }}
-        {% endif %}
-      </td>
-    </tr>
-    {% endfor %}
-  </table>
+      <h3>{{ spec }}</h3>
+    {% endif %}
+    <table>
+      {% for entry in tree %}
+      <tr>
+        <td class="permissions">
+          {{ entry.filemode()|unix_perms }}
+        </td>
+        <td class="filename">
+          <a href="/{{repo|repo_name|urlencode_strict}}/tree/{{ spec }}/item/{{path.join(entry.name().unwrap()).to_string_lossy()}}">
+          {{ entry.name().unwrap() }}{% if entry.to_object(repo).unwrap().as_tree().is_some() %}/{% endif %}</a>
+        </td>
+        <td class="filesize">
+          {% let obj = entry.to_object(repo).unwrap() %}
+          {% if obj.as_blob().is_some() %}
+            {{ entry.to_object(repo).unwrap().into_blob().unwrap().content().len()|filesizeformat }}
+          {% endif %}
+        </td>
+      </tr>
+      {% endfor %}
+    </table>
   </div>
 {% endblock %}
-- 
2.20.1

Re: [PATCH mygit v1 2/2] improve template indentation

Details
Message ID
<CA55UU3KKWXV.1KINBKR5INIW5@debian-alex>
In-Reply-To
<20210323080251.2129-2-johann@qwertqwefsday.eu> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
Do you have settings for your editor for this? I don't write HTML much
so I just type it by hand in Vim. Applied (thank you!)

On Tue Mar 23, 2021 at 1:02 AM PDT, Johann Galle wrote:
> From: Johann150 <johann@qwertqwefsday.eu>
>
> ---
> templates/base.html | 2 +-
> templates/commit.html | 10 ++++-----
> templates/files.html | 0
> templates/index.html | 18 ++++++++--------
> templates/log.html | 18 ++++++++--------
> templates/refs.html | 24 ++++++++++++---------
> templates/repo-navbar.html | 9 ++++++--
> templates/tree.html | 44 +++++++++++++++++++-------------------
> 8 files changed, 67 insertions(+), 58 deletions(-)
> delete mode 100644 templates/files.html
>
> diff --git a/templates/base.html b/templates/base.html
> index 637a281..ee14493 100644
> --- a/templates/base.html
> +++ b/templates/base.html
> @@ -15,7 +15,7 @@
> </div>
> <hr class="thin">
> <div class="footer">
> - Server running <a
> href="https://git.alexwennerberg.com/mygit">mygit</a>
> + Server running <a
> href="https://git.alexwennerberg.com/mygit">mygit</a>
> </div>
> </body>
> </html>
> diff --git a/templates/commit.html b/templates/commit.html
> index 1e140c9..8c256bb 100644
> --- a/templates/commit.html
> +++ b/templates/commit.html
> @@ -2,17 +2,17 @@
>  
> {% block content %}
> {% include "repo-navbar.html" %}
> - <b>Commit:</b> <div class="commit-hash">{{commit.id()}}</div> (<a
> href="/{{repo|repo_name|urlencode_strict}}/tree/{{parent.id()}}">tree</a>)
> + <strong>Commit:</strong> <div
> class="commit-hash">{{commit.id()}}</div> (<a
> href="/{{repo|repo_name|urlencode_strict}}/tree/{{parent.id()}}">tree</a>)
> <br>
> - <b>Parent:</b> <a
> href="/{{repo|repo_name|urlencode_strict}}/commit/{{parent.id()}}"><div
> class="commit-hash">{{parent.id()}}</div></a> (<a
> href="/{{repo|repo_name|urlencode_strict}}/tree/{{parent.id()}}">tree</a>)
> + <strong>Parent:</strong> <a
> href="/{{repo|repo_name|urlencode_strict}}/commit/{{parent.id()}}"><div
> class="commit-hash">{{parent.id()}}</div></a> (<a
> href="/{{repo|repo_name|urlencode_strict}}/tree/{{parent.id()}}">tree</a>)
> <br>
> - <b>Author:</b> {{commit.author().name().unwrap()}} &lt;<a
> href="mailto:{{commit.author().email().unwrap()}}">{{commit.author().email().unwrap()}}</a>&gt;
> + <strong>Author:</strong> {{commit.author().name().unwrap()}} &lt;<a
> href="mailto:{{commit.author().email().unwrap()}}">{{commit.author().email().unwrap()}}</a>&gt;
> <br>
> - <b>Date:</b> {{commit.time()|format_datetime("%c %z")}}
> + <strong>Date:</strong> {{commit.time()|format_datetime("%c %z")}}
> <br>
> {% let stats = diff.stats().unwrap() %}
> {{stats.files_changed()}} files changed; {{stats.insertions()}}
> insertions {{stats.deletions()}} deletions
> <div class="commit-message">
> - {{commit.message().unwrap()}}
> + {{commit.message().unwrap()}}
> </div>
> {% endblock %}
> diff --git a/templates/files.html b/templates/files.html
> deleted file mode 100644
> index e69de29..0000000
> diff --git a/templates/index.html b/templates/index.html
> index f0ed91e..c439291 100644
> --- a/templates/index.html
> +++ b/templates/index.html
> @@ -3,14 +3,14 @@
> {% block content %}
> <div class="page-title"><h1>{{crate::CONFIG.site_name}}</h1></div>
> <div>
> - <table>
> - {% for repo in repos %}
> - <tr>
> - <td class="repo-link"><a
> href="{{repo|repo_name|urlencode_strict}}">{{repo|repo_name}}</a></td>
> - <td class="repo-description">{{repo|description}}</td>
> - <td class="repo-last-updated">updated 2021-02-01</td>
> - </tr>
> - {% endfor %}
> - </table>
> + <table>
> + {% for repo in repos %}
> + <tr>
> + <td class="repo-link"><a
> href="{{repo|repo_name|urlencode_strict}}">{{repo|repo_name}}</a></td>
> + <td class="repo-description">{{repo|description}}</td>
> + <td class="repo-last-updated">updated 2021-02-01</td>
> + </tr>
> + {% endfor %}
> + </table>
> </div>
> {% endblock %}
> diff --git a/templates/log.html b/templates/log.html
> index 5ba59eb..6a321fb 100644
> --- a/templates/log.html
> +++ b/templates/log.html
> @@ -4,15 +4,15 @@
> {% include "repo-navbar.html" %}
> <h3>{{branch}}</h3>
> <table>
> - {% for commit in commits %}
> - <tr>
> - <td class="commit-hash"><a
> href="/{{repo|repo_name|urlencode_strict}}/commit/{{commit.id()}}">{{commit.id().to_string()[..7]}}</a></td>
> - {% let summary = commit.summary().unwrap_or("")|truncate(72) %}
> - <td class="commit-summary">{{summary}}</td>
> - <td class="commit-author-email"><a
> href="mailto:{{commit.author().email().unwrap_or("")}}">{{commit.author().name().unwrap_or(commit.author().email().unwrap_or(""))}}</a></td>
> - <td
> class="commit-date">{{commit.time()|format_datetime("%Y-%m-%d")}}</td>
> - </tr>
> - {% endfor %}
> + {% for commit in commits %}
> + <tr>
> + <td class="commit-hash"><a
> href="/{{repo|repo_name|urlencode_strict}}/commit/{{commit.id()}}">{{commit.id().to_string()[..7]}}</a></td>
> + {% let summary = commit.summary().unwrap_or("")|truncate(72) %}
> + <td class="commit-summary">{{summary}}</td>
> + <td class="commit-author-email"><a
> href="mailto:{{commit.author().email().unwrap_or("")}}">{{commit.author().name().unwrap_or(commit.author().email().unwrap_or(""))}}</a></td>
> + <td
> class="commit-date">{{commit.time()|format_datetime("%Y-%m-%d")}}</td>
> + </tr>
> + {% endfor %}
> </table>
> {% endblock %}
>  
> diff --git a/templates/refs.html b/templates/refs.html
> index 15b7bfc..0a4a8e3 100644
> --- a/templates/refs.html
> +++ b/templates/refs.html
> @@ -4,18 +4,22 @@
> {% include "repo-navbar.html" %}
> <h2>Branches</h2>
> <table>
> - {% for branch in branches %}
> - <tr>
> - <td class="git-reference">
> - <a
> href="/{{repo|repo_name|urlencode_strict}}/log/{{branch.shorthand().unwrap()}}">{{
> branch.shorthand().unwrap() }}</a>
> - </td>
> - </tr>
> - {% endfor %}
> + {% for branch in branches %}
> + <tr>
> + <td class="git-reference">
> + <a
> href="/{{repo|repo_name|urlencode_strict}}/log/{{branch.shorthand().unwrap()}}">{{
> branch.shorthand().unwrap() }}</a>
> + </td>
> + </tr>
> + {% endfor %}
> </table>
> <h2>Tags</h2>
> <table>
> - {% for tag in tags %}
> - <tr><td class="git-reference"><a
> href="/{{repo|repo_name|urlencode_strict}}/commit/{{tag.shorthand().unwrap()}}">{{
> tag.shorthand().unwrap() }}</a></td></tr>
> - {% endfor %}
> + {% for tag in tags %}
> + <tr>
> + <td class="git-reference">
> + <a
> href="/{{repo|repo_name|urlencode_strict}}/commit/{{tag.shorthand().unwrap()}}">{{
> tag.shorthand().unwrap() }}</a>
> + </td>
> + </tr>
> + {% endfor %}
> </table>
> {% endblock %}
> diff --git a/templates/repo-navbar.html b/templates/repo-navbar.html
> index 628dcad..5ee213e 100644
> --- a/templates/repo-navbar.html
> +++ b/templates/repo-navbar.html
> @@ -1,5 +1,10 @@
> <h1><a href="/">index</a>/{{repo|repo_name}}</h1>
> <div>{{repo|description}}</div>
> -<div class="clone-url">git clone
> {{crate::CONFIG.clone_base}}/{{repo|repo_name}} </div>
> -<div class="navbar"><a
> href="/{{repo|repo_name|urlencode_strict}}">README</a> | <a
> href="/{{repo|repo_name|urlencode_strict}}/tree">tree</a> | <a
> href="/{{repo|repo_name|urlencode_strict}}/log">log</a> | <a
> href="/{{repo|repo_name|urlencode_strict}}/refs">refs</a></div>
> +<div class="clone-url">git clone
> {{crate::CONFIG.clone_base}}/{{repo|repo_name}}</div>
> +<div class="navbar">
> + <a href="/{{repo|repo_name|urlencode_strict}}">README</a>
> + | <a href="/{{repo|repo_name|urlencode_strict}}/tree">tree</a>
> + | <a href="/{{repo|repo_name|urlencode_strict}}/log">log</a>
> + | <a href="/{{repo|repo_name|urlencode_strict}}/refs">refs</a>
> +</div>
> <hr class='thin'>
> diff --git a/templates/tree.html b/templates/tree.html
> index f64d28a..620a266 100644
> --- a/templates/tree.html
> +++ b/templates/tree.html
> @@ -4,28 +4,28 @@
> {% include "repo-navbar.html" %}
> <div>
> {% if path.to_string_lossy() != "" %}
> - <h3>{{path.to_string_lossy()}}/@<a
> href="/{{repo|repo_name|urlencode_strict}}/tree/{{spec}}">{{spec}}<a></h3>
> + <h3>{{path.to_string_lossy()}}/@<a
> href="/{{repo|repo_name|urlencode_strict}}/tree/{{spec}}">{{spec}}<a></h3>
> {% else %}
> - <h3>{{ spec }}</h3>
> - {% endif %}
> - <table>
> - {% for entry in tree %}
> - <tr>
> - <td class="permissions">
> - {{ entry.filemode()|unix_perms }}
> - </td>
> - <td class="filename">
> - <a href="/{{repo|repo_name|urlencode_strict}}/tree/{{ spec
> }}/item/{{path.join(entry.name().unwrap()).to_string_lossy()}}">
> - {{ entry.name().unwrap() }}{% if
> entry.to_object(repo).unwrap().as_tree().is_some() %}/{% endif %}</a>
> - </td>
> - <td class="filesize">
> - {% let obj = entry.to_object(repo).unwrap() %}
> - {% if obj.as_blob().is_some() %}
> - {{
> entry.to_object(repo).unwrap().into_blob().unwrap().content().len()|filesizeformat
> }}
> - {% endif %}
> - </td>
> - </tr>
> - {% endfor %}
> - </table>
> + <h3>{{ spec }}</h3>
> + {% endif %}
> + <table>
> + {% for entry in tree %}
> + <tr>
> + <td class="permissions">
> + {{ entry.filemode()|unix_perms }}
> + </td>
> + <td class="filename">
> + <a href="/{{repo|repo_name|urlencode_strict}}/tree/{{ spec
> }}/item/{{path.join(entry.name().unwrap()).to_string_lossy()}}">
> + {{ entry.name().unwrap() }}{% if
> entry.to_object(repo).unwrap().as_tree().is_some() %}/{% endif %}</a>
> + </td>
> + <td class="filesize">
> + {% let obj = entry.to_object(repo).unwrap() %}
> + {% if obj.as_blob().is_some() %}
> + {{
> entry.to_object(repo).unwrap().into_blob().unwrap().content().len()|filesizeformat
> }}
> + {% endif %}
> + </td>
> + </tr>
> + {% endfor %}
> + </table>
> </div>
> {% endblock %}
> --
> 2.20.1

Re: [PATCH mygit v1 2/2] improve template indentation

Johann Galle
Details
Message ID
<41D857B0-9425-442F-ACE0-A0FDDFC22FB4@qwertqwefsday.eu>
In-Reply-To
<CA55UU3KKWXV.1KINBKR5INIW5@debian-alex> (view parent)
DKIM signature
pass
Download raw message
I also just did it by hand. If vim doesn't have it, I'm convinced that nano doesn't have it either.

Re: [PATCH mygit v1 2/2] improve template indentation

Details
Message ID
<CA5DARFAO55C.2AJ0MJTFB3IV9@debian-alex>
In-Reply-To
<41D857B0-9425-442F-ACE0-A0FDDFC22FB4@qwertqwefsday.eu> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
You write Rust with Nano??

I can set indent settings with vim just wanted to make sure they were
consistent with whatever you were doing

On Tue Mar 23, 2021 at 11:13 PM PDT, Johann Galle wrote:
> I also just did it by hand. If vim doesn't have it, I'm convinced that
> nano doesn't have it either.

Re: [PATCH mygit v1 2/2] improve template indentation

Johann Galle
Details
Message ID
<E9969B29-9A29-4FC8-AF8C-FD6877A8D537@qwertqwefsday.eu>
In-Reply-To
<CA5DARFAO55C.2AJ0MJTFB3IV9@debian-alex> (view parent)
DKIM signature
pass
Download raw message
On 2021-03-24T06:29:08Z Alex Wennerberg <alex@alexwennerberg.com> wrote:
>You write Rust with Nano??

Yes, the compiler is nice enough that I didn't need anything more yet.

>I can set indent settings with vim just wanted to make sure they were consistent with whatever you were doing.

For the rust code, everything should be fine if you use Rustfmt i.e. `cargo fmt`. (It uses four spaces.) And for the templates it looked to me like they were written with two spaces so I used that. In hindsight it might be a better idea to use four spaces everywhere.
Reply to thread Export thread (mbox)