Prev Next srccode

Displaying In Line Source Code

Syntax
$srccode%file_ext%source%$$

See Also
get started , srcfile , codep

Purpose
This command will display the specified program source code with highlighting and for the language corresponding to the specified file extension file_ext .

Delimiter Sequence
     %file_ext%source%
is a delimiter sequence where % can be any character that is not a letter.

Example
All the characters, except the end of line character, in the first and last line of the srccode command are ignored. (There must be at least two newlines in text.) This enables the inclusion of source code that is actually compiled. For example, the input
 
     $tabsize 4$$
     $subhead Factorial Program$$ */
     $srccode%py%
          def factorial(n) :
               if n == 1 :
                    return 1
               return n * factorial(n-1)
          end
     /* %$$
would create the following output

Factorial Program
    def factorial(n) :
        if n == 1 :
            return 1
        return n * factorial(n-1)
    end

Input File: srccode.omh