*! version 1.0 20.12.2018

Title

expandihlp -- inserts the content of .ihlp-files into .sthlp-files

Description

expandihlp is a tool meant for programmers who want to include the same text in the help-files for their programs.
The standard way to do so is via the "INCLUDE help something" SMCL-directive which integrates the content of something.ihlp into the .sthlp file.
However, you have to distribute the .ihlp-files if you want to use this approach for a program being installed by someone else.
expandihlp reads the .sthlp-file, searches for "INCLUDE help something" SMCL-directives and integrates the content of something.ihlp into the .sthlp file like the Stata viewer would do.
By default expandihlp tests for the existince of the directives, reports the numbers (and names) and creates a new file named "program_expanded.sthlp" which contains the integrated content and leaves the original file unchanged.

The full path to the help file can be provided, but the command will look for the help file in the standard search paths.

Syntax

expandihlp , file(string)[ rename notest suffix(string) ]

Options

file(string) specify the helpfile with or without the .sthlp extension. The full path to the help file can be provided, but the command will look for the help file in the standard search paths.

notest do not test for the existince of "INCLUDE"-directives and expands the file irrespective whether .ihlp files and display the number (and the name of the files) to be included.
If no "INCLUDE"-directives are found, then the command is aborted.

rename renames the newly created file "program_expanded.sthlp" to "program.sthlp" and "program.sthlp" to "program_old.sthlp"

suffix changes the suffix of the newly created file. By default the suffix "_expanded" is added to the program name.

Examples

Expands the help file for this program, changes the suffix for the new file and replaces the original file with the expanded file.
expandihlp, file(expandihlp) ren suf(_parsed)

Saved results

expandihlp saves the following in r():
Macro

r(inccnt) the number of files included.

r(incfiles) the expanded and included ihlp-files.

r(origfile) the filename of the original help-file.

r(expfile) the filename of the expanded help-file.

Author

Sven-Kristjan Bormann, PhD student, School of Economics and Business Administration, University of Tartu

Bug Reporting

Please submit bugs, comments and suggestions via email to:	sven-kristjan@gmx.de

Further Stata programs and development versions can be found under https://github.com/skbormann/stata-tools