Prev Next

Example Including Source Code

The srcfile command enables one to include all of part of a source code file. This is useful for including examples in the documentation with source code highlighting.

The srccode command enables one to include line text with source code highlighting.

Execute The Following Steps

Use an editor of your choice to create the file src_example.omh in the test directory with the following contents:
     	inline src srcfile py newline
     $section Example Inclusion of Source Code$$
     $head Inline Source Code$$
     The following is an example of in-line source code
     	extern std::set< std::string > string_set(const char* c_string);
     $head Contents of$$
     Note that a newline is automatically added at the beginning
     of a file:
     $head Escape Character$$
     Change the escape character from $code #$$ to $code !$$
     so $code #$$ can be used normally as part of the start
     and stop sequences:
     $escape !$$
     $head Just Usage Message$$
     Note that the newline following
     $code # BEGIN USAGE$$ is included:
Note that you can copy and paste the commands above to your editor window. You may just copy the file with the same name from the getting started directory .

Example In This Web Site Context
You can view the result of making src_example.omh part of the OMhelp help web site by selecting src_example .

Execute OMhelp
In a command window and in the htm directory execute the following command
     omhelp ../src_example.omh -noframe

Example by Itself
Use a web browser of your choosing to view the file test/htm/src_example.htm .
Input File: getstarted/start_src.omh