Ignore md separators.

This commit is contained in:
Matthieu Jolimaitre 2025-06-23 21:34:55 +02:00
parent abc6241353
commit 4d3ed4d73a
4 changed files with 29 additions and 11 deletions

View file

@ -1,7 +1,7 @@
use std::{env::args, fs};
use std::{env, fs};
fn main() {
let file = args().nth(1).expect("Usage : boxon <file>");
let file = env::args().nth(1).expect("Usage : boxon <file>");
let content = fs::read_to_string(&file).unwrap_or_else(|_| panic!("Could not read file '{file}'."));
let mut grid = Grid::from(content);
let count = grid.fix();
@ -34,6 +34,9 @@ impl Grid {
let mut result = 0;
let copy = self.clone();
for (y, line) in self.0.iter_mut().enumerate() {
if line == &vec!['-', '-', '-'] {
continue;
}
for (x, character) in line.iter_mut().enumerate() {
if let Some(cross) = copy.cross_at(x as i32, y as i32) {
let new_char = match cross {
@ -207,6 +210,8 @@ fn connects(c: char) -> Cross {
const F_: bool = false;
const MM: bool = true;
type Empt = ();
#[repr(Rust, packed)]
struct Cross(
(Empt, bool, Empt), //
(bool, bool, bool), //

View file

@ -17,3 +17,7 @@ this is a normalized data table diagram.
│ 1│ bob│ 19│
│ 2│ charlie│ 23│
└──┴────────┴───┘
---
Fin.

7
test/run Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/bash
set -e
cd "$(dirname "$(realpath "$0")")"
cp source.txt out.txt
cd ..
cargo run -- test/out.txt

View file

@ -9,13 +9,15 @@ this is a normalized data table diagram.
| 1|b@o.b| 1|
| 2|c@r.l| 2|
+--+-----+-------+
+---------------+
|USERS |
+--+--------+---+
|id| name|age|
+--+--------+---+
| 1| bob| 19|
| 2| charlie| 23|
+--+--------+---+
+---------------+
|USERS |
+--+--------+---+
|id| name|age|
+--+--------+---+
| 1| bob| 19|
| 2| charlie| 23|
+--+--------+---+
---
Fin.