Support native FigCraft geometry import and export

This commit is contained in:
Dandaedre 2026-11-15 12:34:23 +01:00
parent 0dc7ec0106
commit d8f9242d0f
21 changed files with 116 additions and 38 deletions

View File

@ -112,7 +112,7 @@ See [development setup](https://proxy.dandaedre.com/gitea/Beffroi/beffroi-tools/
[**Download all templates as ZIP**](https://proxy.dandaedre.com/gitea/Beffroi/beffroi-tools/raw/branch/main/docs/templates/midra-layout/midra-layout-all-templates.zip) · [Browse individual starter files →](https://proxy.dandaedre.com/gitea/Beffroi/beffroi-tools/src/branch/main/docs/templates/midra-layout/README.md)
Matching Full HD and UHD 4K layouts are available in SVG, draw.io, geometry JSON,
CSV, DXF/DWG, HTML, PPTX, Figma FIG and Illustrator AI. The catalog contains every
CSV, DXF/DWG, HTML, PPTX, Figma FIG, FigCraft and Illustrator AI. The catalog contains every
base file, import guidance and format dependencies.
## Explore further

View File

@ -134,7 +134,12 @@ fn main() -> Result<(), String> {
let codecs = if extensions.is_empty() {
Codec::available()
.into_iter()
.filter(|c| !matches!(c, Codec::Pptx | Codec::Figma | Codec::Illustrator))
.filter(|c| {
!matches!(
c,
Codec::Pptx | Codec::Figma | Codec::Figcraft | Codec::Illustrator
)
})
.collect::<Vec<_>>()
} else {
extensions

View File

@ -8,7 +8,10 @@ const MAX_METADATA: usize = 1024 * 1024;
const PREFIX: &str = "beffroi-midra-parameters:";
pub fn supported(codec: Codec) -> bool {
!matches!(codec, Codec::Dwg | Codec::Figma | Codec::Illustrator)
!matches!(
codec,
Codec::Dwg | Codec::Figma | Codec::Figcraft | Codec::Illustrator
)
}
/// Exclude unexported layers, unused inputs, image bytes and device capture bindings.

View File

@ -715,7 +715,10 @@ impl Editor {
.is_some_and(|extension| {
let extension = extension.to_ascii_lowercase();
midra_layout::interchange::extensions().contains(&extension.as_str())
|| matches!(extension.as_str(), "pptx" | "fig" | "ai" | "dwg")
|| matches!(
extension.as_str(),
"pptx" | "fig" | "figcraft" | "ai" | "dwg"
)
})
}
fn read_geometry_files(files: Vec<egui::DroppedFile>, p: &mut Paste) {
@ -6426,7 +6429,7 @@ mod tests {
app.paste = None;
}
}
for extension in ["pptx", "fig", "ai", "xml"] {
for extension in ["pptx", "fig", "figcraft", "ai", "xml"] {
assert!(Editor::geometry_drop(&egui::DroppedFile {
name: format!("test.{extension}"),
..Default::default()

View File

@ -17,6 +17,7 @@ pub enum Codec {
Html,
Pptx,
Figma,
Figcraft,
Illustrator,
}
@ -34,7 +35,13 @@ impl Codec {
feature = "vendor_formats",
not(feature = "no_proprietary")
)) {
formats.extend([Self::Dwg, Self::Pptx, Self::Figma, Self::Illustrator]);
formats.extend([
Self::Dwg,
Self::Pptx,
Self::Figma,
Self::Figcraft,
Self::Illustrator,
]);
}
formats
}
@ -49,6 +56,7 @@ impl Codec {
Self::Html => "HTML / CSS",
Self::Pptx => "PowerPoint · PPTX",
Self::Figma => "Figma · FIG",
Self::Figcraft => "FigCraft · FIGCRAFT",
Self::Illustrator => "Illustrator · AI (VectorCraft)",
}
}
@ -63,6 +71,7 @@ impl Codec {
Self::Html => "html",
Self::Pptx => "pptx",
Self::Figma => "fig",
Self::Figcraft => "figcraft",
Self::Illustrator => "ai",
}
}
@ -77,6 +86,7 @@ impl Codec {
Self::Pptx => {
"One editable slide. Coordinates use 96 pixels per inch. Import lets you choose a slide."
}
Self::Figcraft => "Editable FigCraft document. Import lets you choose a page or frame.",
Self::Figma => {
"Editable Figma frame. Import lets you choose a page or frame. Uses FigCraft's best-effort native codec."
}
@ -164,8 +174,10 @@ pub fn import(bytes: &[u8], filename: &str) -> Result<Vec<Page>, String> {
.and_then(|s| s.to_str())
.unwrap_or("")
.to_ascii_lowercase();
let vendor = matches!(extension.as_str(), "pptx" | "fig" | "ai" | "dwg")
|| bytes.starts_with(b"PK")
let vendor = matches!(
extension.as_str(),
"pptx" | "fig" | "figcraft" | "ai" | "dwg"
) || bytes.starts_with(b"PK")
|| bytes.starts_with(b"fig-")
|| bytes.starts_with(b"AC10");
if vendor {
@ -188,7 +200,7 @@ pub fn import(bytes: &[u8], filename: &str) -> Result<Vec<Page>, String> {
}]);
}
let text = std::str::from_utf8(bytes).map_err(
|_| "Unrecognized binary format. Choose PPTX, FIG, AI or a supported geometry file.",
|_| "Unrecognized binary format. Choose PPTX, FIG, FIGCRAFT, AI or a supported geometry file.",
)?;
Ok(vec![Page {
name: filename.into(),

View File

@ -47,7 +47,7 @@ pub(crate) fn export(
canvas: [u32; 2],
shapes: &[ExportShape],
) -> Result<Vec<u8>, String> {
if matches!(codec, Codec::Pptx | Codec::Figma)
if matches!(codec, Codec::Pptx | Codec::Figma | Codec::Figcraft)
&& shapes
.iter()
.any(|s| !s.background && s.name == "midra-background")
@ -64,7 +64,8 @@ pub(crate) fn export(
Ok(bytes)
}
Codec::Pptx => export_pptx(canvas, shapes),
Codec::Figma => export_fig(canvas, shapes),
Codec::Figma => export_fig(canvas, shapes, false),
Codec::Figcraft => export_fig(canvas, shapes, true),
Codec::Illustrator => {
let svg = exchange::encode_shapes(exchange::Format::Svg, canvas, shapes)?;
let (bytes, warnings) = convert_ai(svg.as_bytes(), "svg", "ai", None)?;
@ -101,7 +102,7 @@ pub(crate) fn import(bytes: &[u8], extension: &str, filename: &str) -> Result<Ve
if deckcraft_pptx::sniff(bytes) {
return import_pptx(bytes);
}
import_fig(bytes, filename)
import_fig(bytes, filename, extension == "figcraft")
}
fn export_pptx([w, h]: [u32; 2], shapes: &[ExportShape]) -> Result<Vec<u8>, String> {
@ -243,7 +244,7 @@ fn collect_pptx(
Ok(())
}
fn export_fig([w, h]: [u32; 2], shapes: &[ExportShape]) -> Result<Vec<u8>, String> {
fn export_fig([w, h]: [u32; 2], shapes: &[ExportShape], native: bool) -> Result<Vec<u8>, String> {
use figcraft_doc::{
Document, Node, NodeKind,
color::{ImageScaleMode, Paint},
@ -287,6 +288,9 @@ fn export_fig([w, h]: [u32; 2], shapes: &[ExportShape]) -> Result<Vec<u8>, Strin
doc.insert(node, frame_id, None)
.map_err(|e| e.to_string())?;
}
if native {
return figcraft_format::save_bytes(&doc, None).map_err(|e| e.to_string());
}
let (bytes, warnings) = figcraft_format::fig::export(&doc, None).map_err(|e| e.to_string())?;
if !warnings.is_empty() {
return Err(format!(
@ -297,10 +301,14 @@ fn export_fig([w, h]: [u32; 2], shapes: &[ExportShape]) -> Result<Vec<u8>, Strin
Ok(bytes)
}
fn import_fig(bytes: &[u8], filename: &str) -> Result<Vec<Page>, String> {
fn import_fig(bytes: &[u8], filename: &str, native: bool) -> Result<Vec<Page>, String> {
use figcraft_doc::NodeKind;
let (doc, warnings) =
figcraft_format::fig::import(bytes, filename).map_err(|e| e.to_string())?;
let (doc, warnings) = if native {
figcraft_format::load_bytes(bytes)
} else {
figcraft_format::fig::import(bytes, filename)
}
.map_err(|e| e.to_string())?;
let mut pages = Vec::new();
for id in &doc.pages {
let Some(p) = doc.node(*id) else {

View File

@ -506,7 +506,7 @@ fn check_native_templates(codecs: &[midra_layout::interchange::Codec]) {
#[test]
fn native_readme_templates_preserve_two_layer_geometry() {
use midra_layout::interchange::Codec;
check_native_templates(&[Codec::Pptx, Codec::Figma, Codec::Dwg]);
check_native_templates(&[Codec::Pptx, Codec::Figma, Codec::Figcraft, Codec::Dwg]);
}
#[cfg(all(feature = "vendor_formats", not(feature = "no_proprietary")))]

View File

@ -139,7 +139,12 @@ fn metadata_is_optional_versioned_and_not_silently_applied_to_edited_artwork() {
assert!(interchange::import(&invalid, "x.json").is_ok());
json.as_object_mut().unwrap().remove(metadata::KEY);
assert!(interchange::import(&serde_json::to_vec(&json).unwrap(), "x.json").is_err());
for codec in [Codec::Dwg, Codec::Figma, Codec::Illustrator] {
for codec in [
Codec::Dwg,
Codec::Figma,
Codec::Figcraft,
Codec::Illustrator,
] {
assert!(!metadata::supported(codec));
assert!(
interchange::export(

View File

@ -42,7 +42,7 @@ fn native_binary_codecs_roundtrip_boxes_background_and_artwork() {
let mut project = Project::from_layout(&layout);
project.layers[0].name = "Camera & écran".into();
let ids: Vec<_> = project.layers.iter().map(|l| l.id).collect();
for codec in [Codec::Pptx, Codec::Figma] {
for codec in [Codec::Pptx, Codec::Figma, Codec::Figcraft] {
for artwork in [false, true] {
let bytes = interchange::export(
&project,
@ -56,6 +56,16 @@ fn native_binary_codecs_roundtrip_boxes_background_and_artwork() {
)
.unwrap();
assert!(bytes.starts_with(b"PK"));
if codec == Codec::Figcraft {
let (doc, _) = figcraft_format::load_bytes(&bytes).unwrap();
let resaved = figcraft_format::save_bytes(&doc, None).unwrap();
let json = figcraft_format::to_json(&doc).unwrap().to_string();
for data in [&resaved[..], json.as_bytes()] {
let pages = interchange::import(data, "resaved.FIGCRAFT").unwrap();
assert_eq!(pages[0].document.shapes.len(), 3);
assert_eq!(pages[0].document.shapes[1].geometry.x, -13.0);
}
}
let pages =
interchange::import(&bytes, &format!("layout.{}", codec.extension())).unwrap();
assert_eq!(pages.len(), 1, "{codec:?}");
@ -80,7 +90,11 @@ fn native_binary_codecs_roundtrip_boxes_background_and_artwork() {
let native = deckcraft_pptx::import(&bytes).unwrap();
assert_eq!(native.media.len(), 3);
} else {
let (native, _) = figcraft_format::fig::import(&bytes, "layout.fig").unwrap();
let (native, _) = if codec == Codec::Figcraft {
figcraft_format::load_bytes(&bytes).unwrap()
} else {
figcraft_format::fig::import(&bytes, "layout.fig").unwrap()
};
assert!(!native.images.is_empty());
}
} else if codec == Codec::Pptx {
@ -141,6 +155,8 @@ fn disabled_vendor_codecs_are_not_advertised_or_accepted() {
return;
}
assert!(!Codec::available().contains(&Codec::Figma));
assert!(!Codec::available().contains(&Codec::Figcraft));
assert!(interchange::import(b"{}", "test.figcraft").is_err());
assert!(interchange::import(b"fig-test", "test.fig").is_err());
let project = Project::from_layout(&Layout::default());
assert!(
@ -190,7 +206,7 @@ fn figma_frames_get_independent_origins_and_keep_hidden_children_out() {
fn native_export_refuses_names_that_would_turn_content_into_a_background() {
let mut project = Project::from_layout(&Layout::default());
project.layers[0].name = "midra-background".into();
for codec in [Codec::Pptx, Codec::Figma] {
for codec in [Codec::Pptx, Codec::Figma, Codec::Figcraft] {
let error =
interchange::export(&project, &[project.layers[0].id], codec, Options::default())
.unwrap_err();

View File

@ -24,6 +24,7 @@ external editor moves/resizes a shape without updating the embedded snapshot.
| HTML | `<meta name="beffroi_midra_parameters" content="BASE64"/>` in `<head>` | Inert document metadata, no scripts or hidden visible objects. HTML geometry version stays 1. |
| PPTX | `docProps/custom.xml`, string property `beffroi_midra_parameters` | Standard custom-properties content type and package-root relationship; `vt:lpwstr`, pid 2, fmtid `{D5CDD505-2E9C-101B-9397-08002B2CF9AE}`. Existing ZIP parts are preserved; native DeckCraft import checks unchanged geometry. Microsoft PowerPoint resave not tested here. |
| DWG | Not enabled | DXF comments do not provide a reliable binary-DWG carrier. XRECORD/XData are potential future paths, but the current Craft conversion bridge has no verified application-payload round trip. No bytes are appended to the binary file. |
| FigCraft FIGCRAFT | Not enabled | Native geometry and image exchange only; no Midra snapshot field is emitted or restored. |
| Figma FIG | Not enabled | Figma has plugin data, but the installed FigCraft 0.5.1 native exporter explicitly warns `plugin data was left out`. Its model field is not evidence of native preservation. |
| Illustrator AI | Not enabled | PDF-compatible AI can have document metadata, but the current VectorCraft SVG↔AI conversion path has no verified application-payload preservation. No unverified PDF/AI trailer changes are made. |
| Midra project JSON | Already complete | Project v12 remains the authoritative full-fidelity save. This task does not change its schema. |

View File

@ -1,7 +1,7 @@
# Midra Layout geometry exchange
The Export menu writes **SVG v2**, **draw.io v1**, **geometry JSON v1**,
**geometry CSV v1**, **DXF/DWG**, **HTML/CSS v1**, **PPTX**, **Figma FIG** and
**geometry CSV v1**, **DXF/DWG**, **HTML/CSS v1**, **PPTX**, **Figma FIG / FigCraft** and
**Illustrator AI** (the latter via a local VectorCraft CLI). Project
JSON is version 12 and is the full-fidelity save format. These exchanges
preserve layer **visible-box geometry**, not sources, crop settings, zoom, pivots,
@ -10,7 +10,7 @@ cropping; importing a picture does not reconstruct its crop or source settings.
The [starter-file catalog](../templates/midra-layout/README.md) centralizes ready-to-open
two-layer templates under `docs/templates/midra-layout/` for Full HD (1920 × 1080) and UHD 4K
(3840 × 2160), in all ten exchange formats (including PPTX, FIG and AI). The 4K geometry is an exact
(3840 × 2160), in all eleven exchange formats (including PPTX, FIG and AI). The 4K geometry is an exact
2× scale of the Full HD layout. Regenerate them with:
```sh
@ -45,6 +45,7 @@ MIDRA_VECTORCRAFT_CLI=/path/to/vectorcraft-cli cargo test --locked -p midra-layo
| Browsers and web layout tools | HTML/CSS | Yes | Embedded PNG | Embedded PNG |
| PowerPoint, LibreOffice Impress, DeckCraft | PPTX | Yes; slide picker on import | Embedded PNG | Embedded PNG |
| Figma, FigCraft | Native FIG | Yes; page/frame picker on import | Embedded PNG | Embedded PNG |
| FigCraft | Native FIGCRAFT | Yes; page/frame picker on import | Embedded PNG | Embedded PNG |
| Illustrator, VectorCraft | Native AI via VectorCraft CLI | Yes; artboard picker on import | Embedded PNG | Embedded PNG |
PSD, VSDX and ODG remain future adapters rather than implied support.
@ -129,7 +130,7 @@ Standard OOXML ZIP, one slide matching the screen; 96 screen pixels per inch,
or 0.75 points per pixel (9525 EMU/px). Native shapes/pictures preserve editable
names and boxes. The background is named `midra-background`, a reserved marker
excluded from mapping. PNGs are embedded as media; no source URLs are used.
PPTX/FIG export asks to rename a content layer with that reserved name so it
PPTX/FIG/FIGCRAFT export asks to rename a content layer with that reserved name so it
cannot silently become an ignored background on reimport.
Stable Midra device/source IDs are not represented in the native file.
@ -158,6 +159,24 @@ components, auto-layout rules, text and styling do not become Midra parameters.
Native round-trip tests verify geometry/artwork with the pinned upstream codec;
they do not constitute validation against every Figma service version.
### FigCraft FIGCRAFT
The separate `.figcraft` option uses the pinned `figcraft-format` crate's native
version 1 reader/writer, not a renamed `.fig`. Its ZIP contains `document.json`
(with `format: "figcraft"` and `version: 1`) and image assets under `images/`.
Import also accepts the native bare JSON representation with a `.figcraft`
extension; unsupported future versions are rejected by the upstream reader.
Geometry, page/frame selection, reserved background names and artwork follow the
FIG contract above. Export rounds positions and sizes to whole screen pixels;
import retains fractional coordinates. One output-sized frame contains the named
layer rectangles. Background and placeholder pictures are optional. Midra source,
crop, mapping and workspace settings are omitted; extra-parameter embedding is
not enabled. FigCraft history, branches and library data are not imported into
Midra or recreated on export. Reader repair warnings appear in the import review.
This option shares the FIG vendor feature and is excluded by `no_proprietary`.
Tests cover native resaving, bare JSON, geometry, artwork and both starter sizes.
### Illustrator AI
Uses [VectorCraft CLI](https://github.com/storytold/vectorcraft), discovered through
@ -351,7 +370,7 @@ the only positions present in that SVG. Include Midra Layout's background layer
before exporting through draw.io when the full output-screen origin must survive
the round trip.
Tests cover each format/artwork combination, the twelve text templates and six native PPTX/FIG/DWG templates (plus two AI templates in the opt-in CLI check),
Tests cover each format/artwork combination, the twelve text templates and eight native PPTX/FIG/FIGCRAFT/DWG templates (plus two AI templates in the opt-in CLI check),
full-screen layers vs backgrounds,
negative/fractional coordinates, repeat round trips, compressed clipboard/files,
embedded references, invalid IDs/versions and no-overwrite file handling.
@ -411,5 +430,5 @@ capture bindings. See the [complete carrier contract and format audit](midra-ext
Restore the original snapshot with **Project → Restore parameters from export…**.
Normal geometry import continues to use the artwork's current boxes, including any
external edits. Third-party editors may strip metadata. DWG, FIG and AI are not
external edits. Third-party editors may strip metadata. DWG, FIG, FIGCRAFT and AI are not
enabled until their current codec paths can preserve it reliably.

View File

@ -70,7 +70,7 @@ See [formats and crop](guide/formats-and-crop.md) and
- **Work with another application:** drop a supported geometry file into the window,
use **Import → Geometry file…**, or **Project → Export → Export layers…**. The [starter-file catalog](../templates/midra-layout/README.md)
has matching Full HD and 4K files in SVG, draw.io, geometry JSON, CSV, DXF/DWG,
HTML, PPTX, Figma FIG and Illustrator AI. It also lists format dependencies.
HTML, PPTX, Figma FIG, FigCraft and Illustrator AI. It also lists format dependencies.
- **Use an Eikos 4K:** connect, review layer mappings, then explicitly load or
send the chosen layers. Ordinary editing does not send commands to the device.
Follow the [connection and transfer guide](guide/device.md) and its linked

View File

@ -4,6 +4,11 @@
## Unreleased
- Add native FigCraft (.figcraft) geometry import/export, file drops and page/frame
selection using the existing crate. Include background/artwork options and both
starter sizes in the combined ZIP. Test native resaving and geometry/artwork
round trips; no_proprietary builds keep this codec disabled.
- Offer Download all templates as ZIP first in the README and starter catalog,
replacing the Illustrator-only archive with all 20 Full HD/UHD starter files.
Tests check every archived filename and byte against the individual templates.

View File

@ -4,7 +4,7 @@
## Paste layer values and import geometry
Drop SVG, draw.io/XML, geometry JSON/CSV, DXF/DWG, HTML, PPTX, FIG or AI files into
Drop SVG, draw.io/XML, geometry JSON/CSV, DXF/DWG, HTML, PPTX, FIG, FIGCRAFT or AI files into
the window to open the same geometry review as **Import → Geometry file…**.
Native codecs still require their normal build options/dependencies. Filename
extensions are case-insensitive; PNG/JPEG/BMP drops remain reference images.
@ -120,21 +120,21 @@ viewport preferences, and all embedded reference images. Apply pending edits
before saving. Opening asks before replacing current work and starts a fresh
undo history. Existing files require confirmation before replacement.
The [starter-file catalog](../../templates/midra-layout/README.md) contains all ten
The [starter-file catalog](../../templates/midra-layout/README.md) contains all eleven
exchange formats, with two layers for 1920 × 1080 and 3840 × 2160 canvases.
**Project → Export → Export layers…** opens one shared window. Choose SVG,
draw.io, JSON, CSV, DXF/DWG, HTML, PPTX, Figma FIG or Illustrator AI, then
draw.io, JSON, CSV, DXF/DWG, HTML, PPTX, Figma FIG, FigCraft or Illustrator AI, then
**Current layer…**,
**Selected layers…**, **Specific layer…**, **All layers…** and **Visible layers
only…**. A current-layer export keeps its original screen position and full-screen
canvas. The window offers **Include background layer**. SVG, draw.io, geometry
JSON, HTML, PPTX, FIG and AI also offer **Include placeholder pictures** with embedded source-grid
JSON, HTML, PPTX, FIG, FIGCRAFT and AI also offer **Include placeholder pictures** with embedded source-grid
imagery; CSV and DXF explicitly disable pictures and carry rectangle geometry.
Import a supported format with **Import → Geometry file…** or paste its text, then
choose a slide/page/frame where applicable, then map detected layers to destinations.
PPTX uses 96 pixels per inch; FIG uses native pixels. AI requires a separately
PPTX uses 96 pixels per inch; FIG/FIGCRAFT use native pixels. AI requires a separately
installed `vectorcraft-cli`; its artboards appear in the same canvas selector.
Import/export runs in the background and reports conversion failures without
modifying the project. Backgrounds are automatically ignored;

View File

@ -43,7 +43,7 @@ device readback and physical-screen acceptance.
- [x] Ten-format file exchange: SVG, draw.io, geometry JSON, CSV, DXF/DWG, HTML,
PPTX, FIG and AI through VectorCraft. Shared geometry, scope and review,
optional artwork where supported, page/frame selection and licensing build flag.
Two-layer Full HD and UHD templates exist for all ten formats.
Two-layer Full HD and UHD templates exist for all eleven formats.
- [x] Project JSON v12, tested legacy/recovery migration, saved layer links,
central application preferences, full Settings, themes and recent-theme list.
- [x] Separate Midra connection and mapping/transfer controls, saved address,

View File

@ -2,8 +2,8 @@
[Midra Layout](../../midra-layout/README.md) · [User guide](../../midra-layout/guide/README.md) · [Geometry format contract](../../interfaces/midra-layout-exchange.md)
**[Download all templates as ZIP](midra-layout-all-templates.zip)** — all ten formats
in both Full HD and UHD 4K (20 files). Extract the archive and use whichever
**[Download all templates as ZIP](midra-layout-all-templates.zip)** — all eleven formats
in both Full HD and UHD 4K (22 files). Extract the archive and use whichever
format suits your editor. This also preserves file names when browsers would
otherwise preview a template, including PDF-compatible Illustrator files.
@ -29,6 +29,7 @@ Review the detected rectangles and their destination layers before applying.
| HTML | [Download .html](midra-layout-1080p-2-layers.html) | [Download .html](midra-layout-4k-2-layers.html) | Browsers and web layouts |
| PowerPoint | [Download .pptx](midra-layout-1080p-2-layers.pptx) | [Download .pptx](midra-layout-4k-2-layers.pptx) | PowerPoint, LibreOffice Impress or DeckCraft |
| Figma FIG | [Download .fig](midra-layout-1080p-2-layers.fig) | [Download .fig](midra-layout-4k-2-layers.fig) | Figma or FigCraft |
| FigCraft | [Download .figcraft](midra-layout-1080p-2-layers.figcraft) | [Download .figcraft](midra-layout-4k-2-layers.figcraft) | FigCraft |
| Illustrator AI | [Download .ai](midra-layout-1080p-2-layers.ai) | [Download .ai](midra-layout-4k-2-layers.ai) | Illustrator or VectorCraft |
## Geometry files and saved projects
@ -52,7 +53,7 @@ After updating any starter file, rebuild the combined download from this folder:
python3 -m zipfile -c midra-layout-all-templates.zip midra-layout-*-2-layers.*
```
The archive contains exact copies of all 20 templates; regression tests verify
The archive contains exact copies of all 22 templates; regression tests verify
the file names and bytes and the manual includes the same archive.
Keep all formats here and link to this catalog instead of copying files or

Binary file not shown.

Binary file not shown.

View File

@ -18,7 +18,7 @@ CONFIG = ROOT / "docs/manuals"
OUTPUT = ROOT / "build/manuals"
REPOSITORY = "https://proxy.dandaedre.com/gitea/Beffroi/beffroi-tools/src/branch/main/"
DOWNLOADS = {".png", ".jpg", ".jpeg", ".svg", ".gif", ".json", ".csv", ".dxf", ".dwg", ".zip",
".html", ".drawio", ".pptx", ".fig", ".ai", ".txt"}
".html", ".drawio", ".pptx", ".fig", ".figcraft", ".ai", ".txt"}
LINK = re.compile(r"(?P<start>\]\()(?P<url>[^\s)]+)(?P<end>\))"
r"|(?P<attr>(?:href|src)=[\"'])(?P<html>[^\"']+)(?P<quote>[\"'])")

View File

@ -9,7 +9,7 @@ ROOT = pathlib.Path(__file__).resolve().parents[1] / "docs/templates/midra-layou
class MidraTemplateDownloads(unittest.TestCase):
def test_all_templates_archive_preserves_names_and_original_bytes(self):
names = {path.name for path in ROOT.glob("midra-layout-*-2-layers.*")}
self.assertEqual(len(names), 20)
self.assertEqual(len(names), 22)
with zipfile.ZipFile(ROOT / "midra-layout-all-templates.zip") as archive:
self.assertEqual(set(archive.namelist()), names)
self.assertEqual(len(archive.namelist()), len(names))