4.67 - [getc] Built-In

Mnemonic aid: getc for GET C code

The file with the given filename, or the local variable with the given variable name, is converted to HTML format. If you use the local variable form, you must create the local variable in the outermost context using the [raw] built-in, otherwise the braces in the c code will be interpreted as aa_macro code.

You can set a custom tab size. The default is 4. You can also set a custom character for the space. The default is the non-breaking HTML space. You can use the two-letter code sp for a normal space.

With the high=c option, you can do some basic HTML highlighting of c code. Likewise, with high=oc you can do the same for objective c. Finally, with high=cp you can highlight c++ source code.

Note: the top example box highlighting is pathological within the [raw] built-in because the aa_macro code syntax highlighter doesn't deal with c code in the context of aa_macro code. This is only relevant in the context of aa_macro syntax highlighting. It won't affect other operations in any way.

As access to the filesystem can present a significant security risk, there is a means to disable c file loading capability when instantiating the class. If noshell=True then [getc] does nothing when invoked to process a file. It can still be used to process a [raw] variable.

When using HTML, you'll probably want to wrap the output a <div> that sets up a default text color (I used green here) and a background color as shown in the example below: