aa_macro syntax 
 aa_macro source 
 HTML source 
 HTML render 
Key

§ 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.

with the embeds=t option, you can highlight content that has been fenced using quad-backticks. Such content contains, rather than literal squiggly and square braces, the HTML entities for these, #&123; and so on. emdeds=t informs the  [getc]  built-in that those are to be re-encoded, and highlighted appropriately (if highlighting is on.)

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:


[getc (var=varName,)(tabsiz=n,)(high=c|cp|oc,)(tabchar=x,)filename]

[raw ccode #define TRUE 0
#define FALSE 1
void main()
{
int i;
printf("Hello, Whirled\n"); // Whirled peas!
for (i=0; i<10; i++)
{
printf("%d\n",i);
}
}
]
<div style="white-space: pre-wrap; color: #00ff00; background-color: #000000;">
[getc high=c,var=ccode]
</div>

<div style="white-space: pre-wrap; color: #00ff00; background-color: #000000;">
<span style="color: #ff0000;">#define</span> TRUE 0<span style="color: #4488ff;">
</span><span style="color: #ff0000;">#define</span> FALSE 1<span style="color: #4488ff;">
</span><span style="color: #ff8844;">void</span> main<span style="color: #4488ff;">()
</span><span style="color: #4488ff;">&#123;
</span> printf<span style="color: #4488ff;">(</span><span style="color: #ffffff;">&quot;Hello, Whirled\n&quot;</span><span style="color: #4488ff;">);</span> <span style="color: #888888;">// Whirled peas!
</span> <span style="color: #ff8844;">for</span> <span style="color: #4488ff;">(</span>i<span style="color: #4488ff;">=</span>0<span style="color: #4488ff;">;</span> i<span style="color: #4488ff;">&lt;</span>10<span style="color: #4488ff;">;</span> i<span style="color: #4488ff;">++)
</span> <span style="color: #4488ff;">&#123;
</span> printf<span style="color: #4488ff;">(</span><span style="color: #ffffff;">&quot;%d\n&quot;</span><span style="color: #4488ff;">,</span>i<span style="color: #4488ff;">);
</span> <span style="color: #4488ff;">&#125;
</span><span style="color: #4488ff;">&#125;
</span>
</div>
#define TRUE 0 #define FALSE 1 void main() { printf("Hello, Whirled\n"); // Whirled peas! for (i=0; i<10; i++) { printf("%d\n",i); } }
You can customize the syntax highlighting colors by altering the following global variables:
cpp_fpre - keywords - default is ff8844 - example cpp_spre - reserved tokens - default is 4488ff - example cpp_stpre - strings - default is ffffff - example cpp_copre - comments - default is 888888 - example cpp_pppre - preprocessor - default is ff0000 - example cpp_atpre - @ (Objective c only) - default is ff00ff - example
Keyboard Navigation
, Previous Page . Next Page t TOC i Index

Valid HTML 4.01 Loose
 

This manual was generated with wtfm
wtfm uses aa_macro and SqLite
aa_macro uses Python 2.7