Skip to content

Commit 54a27af

Browse files
Merge pull request redhat-documentation#23 from VladimirSlavik/atree-readme-fixes
update and extend atree readme
2 parents 45e55fe + 870623c commit 54a27af

File tree

1 file changed

+56
-5
lines changed

1 file changed

+56
-5
lines changed

atree/README.txt

+56-5
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,32 @@ syntax: atree [file|directory|option]...
44

55
Prints a tree of asciidoc document inclusions.
66

7+
78
INPUT
89
-----
910

1011
The possible parameters are:
1112

1213
* Top level file
13-
* Directory with the top level file
14+
* Directory with a top level file
1415
* Glob pattern for files or directories
1516
* Option
1617

1718
You can specify as many inputs as needed. Inputs are processed in order of appearance. This means that options must be specified before the files they are supposed to affect.
1819

1920
If no input files or directories are specified, the current directory is tried.
2021

22+
Path handling details
23+
---------------------
24+
25+
When atree encounters a glob pattern, it expands it first and then handles the resulting paths as if listed manually.
26+
27+
If a path is a file, atree tries to parse and analyze it as an AsciiDoc file. If a path is a directory instead, atree checks for existence of files in this order:
28+
29+
1. master.adoc
30+
2. index.adoc
31+
3. any *.adoc file, but only if there is just a single such file
32+
2133

2234
OPTIONS
2335
-------
@@ -27,15 +39,21 @@ OPTIONS
2739
-l Use literal include line output.
2840

2941
-c Display commented-out includes in annotated mode.
30-
-x Analyze commented-out includes in annotated mode.
42+
-x Analyze commented-out includes.
3143
-h Hide hints for human user.
3244

3345
All options in the second group have their inverse in uppercase, which is also the default state. For example, atree does not show commented out includes by default, but you can get them with -c, and later return to the default with -C.
3446

47+
3548
OUTPUT
3649
------
3750

38-
Included files are printed in order of appearance. Indentation shows the level of nesting. If the inclusion of a file is modified in some way, this is displayed:
51+
Output differs by mode. Default mode is annotated.
52+
53+
Annotated output
54+
----------------
55+
56+
This output mode is intended for consumption by humans. Included files are printed in order of appearance. Indentation shows the level of nesting. If the inclusion of a file is modified in some way, this is displayed:
3957

4058
* If a file is included, but the inclusion is commented out, the line with the included path begins with the // characters, to idicate the file is included but does not affect output:
4159

@@ -48,6 +66,35 @@ Included files are printed in order of appearance. Indentation shows the level o
4866

4967
* If a file can not be read, its inclusion will be displayed, but no includes inside that file can be analyzed.
5068

69+
* If a file cannot be analyzed, the reason will be shown with flags. The flags are:
70+
71+
R! the file includes itself, infinitely recursive inclusion
72+
N! the file does not exist
73+
X! the file name is not valid
74+
75+
Example of outputs with flags:
76+
77+
N! some/nonexistent/file.adoc
78+
//R! the-same-file.adoc
79+
X! an|invalid*path/somefile.adoc
80+
81+
82+
Full path output
83+
----------------
84+
85+
This mode is intended for consumption by other tools. The output consists only of absolute paths, one on a line. No indenting to show include level is printed. Commented out files will not be listed. Conditionals and flags are not displayed. Invalid or nonexistent files will still be listed.
86+
87+
Note that using the -c option will enable analysis of commented out includes, but they will not be shown.
88+
89+
Literal output
90+
--------------
91+
92+
This mode prints include lines as encountered in the files. Handling of flags, conditions, comments etc. is identical to full path output.
93+
94+
The top level file has no include statement and therefore has a special line: "<top: the-top-file.adoc>".
95+
96+
Note that attributes are expanded before this listing, so the icludeds are not verbatim as shown in the files.
97+
5198

5299
EXAMPLE
53100
-------
@@ -73,9 +120,12 @@ EXAMPLE
73120
KNOWN ISSUES
74121
------------
75122

76-
* If an attribute is used in the include macro, the attribute is not uderstood and thus also not expanded. The include is displayed, but the actual file can not be loaded and thus any further inclusions are not shown.
123+
* AsciiDoctor apparently uses some special handling for absolute paths. This syntax is not understood by atree and the file will be treated as non-existent (N!).
124+
See also https://github.com/redhat-documentation/tools/issues/21
125+
126+
* If an attribute is used in the include macro, the attribute must be defined in the document tree. There is no way to define an attribute manually / externally. Because undefined attributes can not not expanded, includes containing these are displayed, but the actual files can not be loaded and thus any further inclusions are not shown.
77127

78-
* All includes in comments are listed, including these that are not intended as part of the document, but only comment.
128+
* All includes in comments are listed, including these that are not intended as part of the document, but only comment. There is no way to distinguish these automatically.
79129

80130

81131
HINTS
@@ -88,3 +138,4 @@ HINTS
88138
* You can pipe atree output to egrep to add search and highlighting:
89139
atree | egrep --color "SOME-FILE-I-WANT-HIGHLIGHTED|$"
90140

141+
* When in doubt, check the source...

0 commit comments

Comments
 (0)