Skip to content

Commit 2bba190

Browse files
authoredJun 13, 2024
Merge pull request #5 from brack-lang/hotfix/table
Hotfix/table
2 parents 5a9aa58 + 2398ac7 commit 2bba190

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
 

‎src/rules.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ pub fn metadata_rules() -> FnResult<Json<MetaData>> {
1414
#[plugin_fn]
1515
pub fn rules(Json(args): Json<Vec<Value>>) -> FnResult<String> {
1616
if args.len() != 0 {
17-
return Err(WithReturnCode::new(anyhow::anyhow!("Usage: {{std.---}}"), 1));
17+
return Err(WithReturnCode::new(
18+
anyhow::anyhow!("Usage: {{std.---}}"),
19+
1,
20+
));
1821
}
1922
Ok(String::from("<hr />"))
2023
}

‎src/table.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub fn table(Json(args): Json<Vec<Value>>) -> FnResult<String> {
4545
}
4646
};
4747
let mut result = String::from("");
48-
for i in 0..(elems.len() as i32 % col) {
48+
for i in 0..(elems.len() as i32 + col - 1) / col {
4949
let mut tr = String::from("");
5050
for j in 0..col {
5151
tr += &format!("<td>{}</td>", elems[(i * col + j) as usize]);

0 commit comments

Comments
 (0)