Skip to content

Commit 222c9af

Browse files
committed
Support reading attributes from the repeating element
1 parent 7a73115 commit 222c9af

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct Table<'a> {
3131
impl<'a> Table<'a> {
3232
fn new(path: &str, file: Option<&str>, filemode: &str, skip: Option<&'a str>) -> Table<'a> {
3333
let mut ownpath = String::from(path);
34-
if !ownpath.starts_with("/") { ownpath.insert(0, '/'); }
34+
if !ownpath.is_empty() && !ownpath.starts_with("/") { ownpath.insert(0, '/'); }
3535
if ownpath.ends_with("/") { ownpath.pop(); }
3636
Table {
3737
path: ownpath,
@@ -186,7 +186,7 @@ fn add_table<'a>(rowpath: &str, outfile: Option<&str>, filemode: &str, skip: Opt
186186
let name = col["name"].as_str().unwrap_or_else(|| fatalerr!("Error: column has no 'name' entry in configuration file"));
187187
let colpath = col["path"].as_str().unwrap_or_else(|| fatalerr!("Error: column has no 'path' entry in configuration file"));
188188
let mut path = String::from(&table.path);
189-
if !colpath.starts_with("/") { path.push('/'); }
189+
if !colpath.is_empty() && !colpath.starts_with("/") { path.push('/'); }
190190
path.push_str(colpath);
191191
if path.ends_with("/") { path.pop(); }
192192
let subtable: Option<Table> = match col["cols"].is_badvalue() {
@@ -353,10 +353,9 @@ fn main() {
353353
}
354354
continue;
355355
}
356-
else if path == table.path {
357-
fullcount += 1;
358-
}
359-
else if path.len() > table.path.len() {
356+
else if path.len() >= table.path.len() {
357+
if path == table.path { fullcount += 1; }
358+
360359
for i in 0..table.columns.len() {
361360
if path == table.columns[i].path { // This start tag matches one of the defined columns
362361

0 commit comments

Comments
 (0)