Skip to content

Commit 3933bbb

Browse files
authored
Merge pull request codehub-ir#44 from lnxpy/main
Line numbers added to the code block + DockerFile option (and icon) added as LANGUAGES
2 parents b0ee5e7 + 897b278 commit 3933bbb

File tree

3 files changed

+35
-25
lines changed

3 files changed

+35
-25
lines changed

main/constants.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,26 @@
88

99
# lang choices for Snippet.lang
1010
LANGUAGES = (
11-
('arduino', 'Arduino'), # + icon
12-
('bash', 'Bash'), # + icon
13-
('c', 'C'), # + icon
14-
('cpp', 'C++'), # + icon
15-
('csharp', 'C#'), # + icon
16-
('css', 'CSS'), # + icon
17-
('dart', 'Dart'), # + icon
18-
('docker', 'DockerFile'), # + icon
19-
('go', 'Go'), # + icon
20-
('html', 'HTML'), # + icon
21-
('java', 'Java'), # + icon
22-
('js', 'JavaScript'), # + icon
23-
('json', 'JSON'), # + icon
24-
('lua', 'Lua'), # + icon
25-
('md', 'markdown'), # + icon
26-
('mysql', 'MySQL'), # + icon
27-
('php', 'PHP'), # + icon
28-
('python', 'Python'), # + icon
29-
('rb', 'Ruby'), # + icon
11+
('arduino', 'Arduino'), # + icon
12+
('bash', 'Bash'), # + icon
13+
('c', 'C'), # + icon
14+
('cpp', 'C++'), # + icon
15+
('csharp', 'C#'), # + icon
16+
('css', 'CSS'), # + icon
17+
('dart', 'Dart'), # + icon
18+
('docker', 'DockerFile'), # + icon
19+
('docker-compose', 'DockerCompose'), # + icon (same as docker.svg)
20+
('go', 'Go'), # + icon
21+
('html', 'HTML'), # + icon
22+
('java', 'Java'), # + icon
23+
('js', 'JavaScript'), # + icon
24+
('json', 'JSON'), # + icon
25+
('lua', 'Lua'), # + icon
26+
('md', 'markdown'), # + icon
27+
('mysql', 'MySQL'), # + icon
28+
('php', 'PHP'), # + icon
29+
('python', 'Python'), # + icon
30+
('rb', 'Ruby'), # + icon
3031
)
3132

3233
# verification choices for Ticket

main/static/css/style.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,10 @@ body {
6565
background-size: 80px;
6666
background-repeat: no-repeat;
6767
background-position: center;
68-
}
68+
}
69+
70+
.code-snippet span.linenos {
71+
color: #969699;
72+
margin-right: 20px;
73+
user-select: none;
74+
}

main/templates/snippet.html

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@
2727

2828
{% block content %}
2929
<h3 style="word-wrap:break-word; line-height: 40px;">{{snippet.title}} <button id="text" type="button"
30-
class="btn btn-sm btn-outline-light text-secondary shadow-sm"
31-
onclick='copyElementText("{{snippet.get_absolute_url}}")'><span class="fa fa-clipboard"></span> کپی در
32-
کلیپ&#8204;بورد</button></h3><br>
33-
<p style="word-wrap:break-word;">{{snippet.description}}</p><br>
30+
class="btn btn-sm btn-outline-light text-secondary shadow-sm"
31+
onclick='copyElementText("{{snippet.get_absolute_url}}")'><span class="fa fa-clipboard"></span> کپی در
32+
کلیپ&#8204;بورد</button></h3><br>
3433

35-
{% pygmentify %}
34+
{% if snippet.description %}
35+
<p style="word-wrap:break-word;">{{snippet.description}}</p>
36+
{% endif %}
37+
38+
{% pygmentify linenos='inline' %}
3639
<img class="code-snippet-lang" src="{% static 'img/icons/material/'|add:snippet.lang|add:'.svg' %}" alt="-">
3740
<pre class="{{snippet.lang}} code-snippet pre-snippet">{{snippet.body}}</pre>
3841
{% endpygmentify %}

0 commit comments

Comments
 (0)