summaryrefslogtreecommitdiffstats
path: root/gitsrht
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-02-05 10:20:55 -0500
committerDrew DeVault <sir@cmpwn.com>2019-02-05 10:20:55 -0500
commit0af916a82b93e3b125ca1de463d4d3500e947c1e (patch)
tree473e8b5658000e66844da44a483119d3926d3319 /gitsrht
parent6ed66f74828ac0efec4b1d3ffd73b9c8df9f3c06 (diff)
Pull max line width from editorconfig in blob view
Diffstat (limited to 'gitsrht')
-rw-r--r--gitsrht/editorconfig.py5
-rw-r--r--gitsrht/templates/blob.html3
2 files changed, 7 insertions, 1 deletions
diff --git a/gitsrht/editorconfig.py b/gitsrht/editorconfig.py
index 8186062..48944d8 100644
--- a/gitsrht/editorconfig.py
+++ b/gitsrht/editorconfig.py
@@ -48,6 +48,11 @@ class EditorConfig:
return 8
return self._config.get("tab_size", self._config.get("indent_size", 8))
+ def max_line_length(self):
+ if self._config == None:
+ return 80
+ return self._config.get("max_line_length", 80)
+
# Via https://github.com/editorconfig/editorconfig-core-py/blob/master/editorconfig/fnmatch.py
# 2-Clause BSD
diff --git a/gitsrht/templates/blob.html b/gitsrht/templates/blob.html
index d8c19ef..fe978e5 100644
--- a/gitsrht/templates/blob.html
+++ b/gitsrht/templates/blob.html
@@ -67,7 +67,8 @@ pre, body {
<div class="row" style="margin-right: 0;">
{% if not blob.is_binary %}
<div class="col-md-12 code-view">
- <pre class="ruler"><span>{% for i in range(80) %} {% endfor %}</span></pre>
+ <pre class="ruler"><span>{% for i in range(
+ editorconfig.max_line_length()) %} {% endfor %}</span></pre>
<pre class="lines">{% for line in data.split("\n") %}<a
href="#L{{loop.index}}"
id="L{{loop.index}}"