Conversation
- crmap: show CR as interactive svg map - display map region and unit information and commands on click - orderfile: render orders with wiki links and comments (with markdown) - readnr/shownr: parse NR and detect sections, regions, units - display sections, regions units
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces new shortcodes for displaying Eressea game data in an Eleventy static site. The main purpose is to add interactive map visualization and formatted display of game reports and order files.
- Adds three new shortcode categories:
crmapfor interactive SVG maps,readnr/shownrfor displaying report sections, andorderfilefor formatted order display - Implements conditional CSS/JS loading to only include assets when actually needed
- Adds comprehensive report parsing with bookmarks and unit detection for easy navigation
Reviewed Changes
Copilot reviewed 6 out of 244 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| crs/crs.js | Main plugin file implementing all shortcodes with CR file parsing, SVG generation, and report processing |
| crs/crs.css | Styling for maps, tooltips, order files, and report displays |
| crs/crs-passthrough.js | Client-side JavaScript for interactive map functionality and tooltips |
| _includes/base-layout.njk | Template updated to conditionally include CRS assets and fix title display |
| .eleventyignore | Updated to ignore template directory |
| .eleventy.js | Plugin registration and configuration updates |
| const { start } = require('repl'); | ||
|
|
There was a problem hiding this comment.
The start import from 'repl' is unused throughout the file. This import should be removed as it's not needed for the functionality.
| const { start } = require('repl'); |
| const fs = require('fs'); | ||
| const path = require('path'); |
There was a problem hiding this comment.
The require statements for 'fs' and 'path' should be moved to the top of the file with other imports, as they're already imported there. This avoids redundant module loading on each function call.
| const fs = require('fs'); | |
| const path = require('path'); |
| {% if content.indexOf('crs-requires-css') !== -1 %} | ||
| <link rel="stylesheet" href="{{ '/css/crs.css' }}"> | ||
| {% endif %} | ||
| {% if content.indexOf('crs-requires-js') !== -1 %} |
There was a problem hiding this comment.
The conditional asset loading uses string search on content, which could have false positives if the marker class appears in text content. Consider using a more robust approach like setting template variables in the shortcodes.
| {% if content.indexOf('crs-requires-css') !== -1 %} | |
| <link rel="stylesheet" href="{{ '/css/crs.css' }}"> | |
| {% endif %} | |
| {% if content.indexOf('crs-requires-js') !== -1 %} | |
| {% if crs_requires_css %} | |
| <link rel="stylesheet" href="{{ '/css/crs.css' }}"> | |
| {% endif %} | |
| {% if crs_requires_js %} |
Neue Shortcodes:
css/js only included if actually needed.