[RFC 05/10] scripts: add asciidoc-includes to extract includes from asciidoc

From: Jani Nikula
Date: Tue Jan 26 2016 - 07:09:20 EST


Given an asciidoc input file in standard input, print the files included
using asciidoc include macros to standard output, one per line. This
will be helpful in asciidoc dependency generation.

Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
---
scripts/asciidoc-includes | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100755 scripts/asciidoc-includes

diff --git a/scripts/asciidoc-includes b/scripts/asciidoc-includes
new file mode 100755
index 000000000000..d832035275eb
--- /dev/null
+++ b/scripts/asciidoc-includes
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Given an asciidoc input file in standard input, print the files included using
+# asciidoc include macros to standard output, one per line.
+
+INCLUDE="^include::\([^[]*\)\[.*\]"
+exec sed "/${INCLUDE}/!d; s/${INCLUDE}/\1/"
--
2.1.4