Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ignore of directories #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,15 @@ For more control over the parsing and conversion process, a `.zod/config` file c

[ignore]
Makefile
.hide/

Here we're only parsing (not converting to a different format) files matching `*.htm` and `*.html`.

Files matching `*.md` are going to be parsed and converted using the `smu` markdown parsing program.

Files matching `*.txt` are going to be parsed and converted using `asciidoc`.

Files matching `Makefile` will be ignored and not copied.
Files matching `Makefile` and directories matching `.hide` will be ignored and not copied.

Conversion programs must accept a UNIX-style pipe and send converted data to stdout.

Expand Down
3 changes: 2 additions & 1 deletion bin/zod-internal
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ helpers.awk
*.partial
*.layout
*.meta
config
.zod/
.git/
!
}

Expand Down
6 changes: 5 additions & 1 deletion lib/config.awk
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,9 @@ action == "config" && section == "parse_convert" && (NF > 1) {
}

action == "config" && section == "ignore" {
ignore[ignore_count++] = $0
if (substr($0, length($0)) == "/") {
ignore_dir[ignore_dir_count++] = substr($0, 1, length($0) - 1)
} else {
ignore[ignore_count++] = $0
}
}
9 changes: 8 additions & 1 deletion lib/find_cmd.awk
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ END {
opts[opt_count++] = exts[i]
}
}
if ( length(ignore_dir) ) {
prunepart = "-type d \\( -name \"" ignore_dir[0] "\""
for (i = 1; i < length(ignore_dir); i++) {
prunepart = prunepart " -o -name \"" ignore_dir[i] "\""
}
prunepart = prunepart " \\) -prune -o"
}
for (i = 0; i < length(opts); i++) {
optpart = optpart " " opts[i]
}
printf "find \"%s\" -type f \\( %s \\) -exec zod-%s \"%s\" \"%s\" \"%s\" {} \\;", proj, optpart, phase, zod_lib, proj, target
printf "find \"%s\" %s -type f \\( %s \\) -exec zod-%s \"%s\" \"%s\" \"%s\" {} \\;", proj, prunepart, optpart, phase, zod_lib, proj, target
}