By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

Add line numbers

roundabout,
created on Tuesday, 9 January 2024, 15:44:56 (1704815096), received on Wednesday, 31 July 2024, 06:54:40 (1722408880)
Author identity: vlad <vlad.muntoiu@gmail.com>

f57462b119372d16375feb652dee5ebdee3e7bf6

templates/file-view.html

@@ -10,8 +10,47 @@

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            <br>
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            {{ detailedtype }}
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        <style>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            .code-view {
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                white-space: normal;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                padding: 0;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            }
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            .code-view::before {
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                counter-reset: line-number;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            }
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            .code-view > code {
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                white-space: pre-wrap;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                font: inherit;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                color: inherit;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                background: inherit;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                display: block;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                padding: 0;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                margin: 0;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                counter-increment: line-number;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            }
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            .code-view > code::before {
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                display: inline-block;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                width: var(--line-chars) * 1ch;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                background: var(--color-callout);
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                content: counter(line-number);
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                padding: 0 1ch;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                text-align: end;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                margin-right: 1ch;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            }
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            .code-view > code:first-child::before {
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                padding-top: 1em;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            }
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            .code-view > code:last-child::before {
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                padding-bottom: 1em;
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            }
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        </style>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            {% if mode == "text" %}
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            <pre>{{ contents }}</pre>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            <pre class="code-view" style="--line-chars: {{ contents | split('\n') | length | string | length }}">
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                {% for i in contents | split("\n") %}
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    <code>{{ i }}</code>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                {% endfor %}
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            </pre>
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            {% elif mode == "image" %}
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                <img src="{{ file }}">
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            {% elif mode == "audio" %}