-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Take recursive includes into account for adoc filelist
list-srcfiles on adoc MAINs now also lists docinfo-files and includes from includes
- Loading branch information
1 parent
93fd0ab
commit 7506323
Showing
3 changed files
with
38 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (C) 2012-2022 SUSE Software Solutions Germany GmbH | ||
# | ||
# Author: | ||
# Frank Sundermeyer <fsundermeyer at opensuse dot org> | ||
# | ||
# Recursively get include files from an asciidoc "main" file | ||
# | ||
# include statements always start at the begin of the line, no other | ||
# characters (incl. space) are allowed before it, so a grep for | ||
# /^include::/ seems to be a safe enough | ||
# | ||
|
||
main="$1" | ||
includes=$(basename "$main") | ||
|
||
function include_grep { | ||
local f | ||
f=$(grep -E '^include::' $@ 2>/dev/null | sed 's/.*::\.\/\([^\[]*\).*/\1/g' 2>/dev/null) | ||
if [[ -n $f ]]; then | ||
includes+=" $f" | ||
include_grep $f | ||
else | ||
return | ||
fi | ||
} | ||
|
||
include_grep $main | ||
|
||
echo "${includes//$'\n'/ }" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters