Refactor gallery generator with smart file handling and improved UI
Key improvements: - Add intelligent file update checking with 30-second buffer to avoid unnecessary operations - Implement efficient PDF to PNG conversion (only when source is newer) - Add smart file copying (skip if target is up-to-date) - Create proper folder structure using plot_root/source_name pattern - Improve template with better text handling for long plot names - Add text wrapping, truncation, and hover tooltips for plot names - Remove unnecessary directory cleaning for true incremental updates - Fix title display issue (was showing '.' instead of 'Gallery') - Add comprehensive logging showing what's processed vs skipped Performance benefits: - Subsequent runs are significantly faster (only processes changed files) - Reduces ImageMagick conversions and file I/O operations - Maintains file system timing robustness with buffer delays UI improvements: - Better handling of long filenames with word wrapping - Constrained text areas prevent overlap between thumbnails - Hover tooltips show full names when truncated - Responsive grid layout maintained
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ title }}</title>
|
||||
<style>
|
||||
body { font-family: sans-serif; margin: 1em; }
|
||||
h1 { font-size: 1.5em; }
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
gap: 1rem;
|
||||
padding: 1rem 0;
|
||||
}
|
||||
.grid-item img {
|
||||
max-width: 100%;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.grid-item {
|
||||
text-align: center;
|
||||
max-width: 200px; /* Constrain to grid column width */
|
||||
}
|
||||
.plot-name {
|
||||
margin-top: 0.5rem;
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
hyphens: auto;
|
||||
font-size: 0.9em;
|
||||
line-height: 1.2;
|
||||
max-height: 3.6em; /* Limit to ~3 lines */
|
||||
overflow: hidden;
|
||||
padding: 0 0.2rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>{{ relpath or 'Root' }}</h1>
|
||||
<div class="grid">
|
||||
{% for item in items %}
|
||||
<div class="grid-item">
|
||||
<a href="{{ item.pdf_href }}" target="_blank">
|
||||
<img src="{{ item.png_href }}" alt="{{ item.name }}">
|
||||
</a>
|
||||
<div class="plot-name" title="{{ item.name }}">{{ item.name }}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% if subdirs %}
|
||||
<h2>Subdirectories</h2>
|
||||
<ul>
|
||||
{% for sub in subdirs %}
|
||||
<li><a href="{{ sub }}/index.html">{{ sub }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user