Let smallish plaintext files display as a pre element.
This commit is contained in:
		
							parent
							
								
									706a5eb185
								
							
						
					
					
						commit
						6cc0246764
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		|  | @ -91,6 +91,15 @@ | ||||||
|     max-height: 100%; |     max-height: 100%; | ||||||
|     max-width: 100%; |     max-width: 100%; | ||||||
| } | } | ||||||
|  | #photo_viewer pre | ||||||
|  | { | ||||||
|  |     align-self: start; | ||||||
|  |     width: 100%; | ||||||
|  |     max-height: 100%; | ||||||
|  |     overflow-y: auto; | ||||||
|  |     margin: 0; | ||||||
|  |     white-space: pre-wrap; | ||||||
|  | } | ||||||
| #photo_viewer a | #photo_viewer a | ||||||
| { | { | ||||||
|     margin: auto; |     margin: auto; | ||||||
|  | @ -254,6 +263,9 @@ | ||||||
|         {% elif photo.simple_mimetype == "audio" %} |         {% elif photo.simple_mimetype == "audio" %} | ||||||
|         <audio src="{{photo|file_link}}" controls></audio> |         <audio src="{{photo|file_link}}" controls></audio> | ||||||
| 
 | 
 | ||||||
|  |         {% elif photo.simple_mimetype == "text" and photo.real_path.is_file and photo.real_path.size < 2**20 %} | ||||||
|  |         <pre>{{photo.real_path.open('r', encoding='utf-8', errors='replace').read()}}</pre> | ||||||
|  | 
 | ||||||
|         {% else %} |         {% else %} | ||||||
|         <a href="{{photo|file_link}}">View {{photo.basename}}</a> |         <a href="{{photo|file_link}}">View {{photo.basename}}</a> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue