<< Go Commands << Go Home

Command @code

Description:

Inserts source code in a page.
 
Warning: command only works inside a .tg9 file.

Syntax:

@code
@@src
@@width
@@height
<code area>
@end_code

Parameters:

Param @@src
description: path to text file
options:
default:
optional: yes
Param @@witdh
description: box around text width
options: px, %, auto
default: auto
optional: yes
Param @@height
description: box round text height
options: px, %, auto
default: auto
optional: yes
Obs: parameters can be put in any line order
Obs: if you use param @@src commmad @code will look for code in a file
Obs: if you omit param @@src commmad @code will look for code in de <code area>
Obs: if width or height is just a number px is added automaticly

Example 1:

1 @code
2 @@src demo.cpp
3 @@width 50%
4 @end_code

Output:

1 // example 1 - <current directory>
2
3 #include <iostream>
4
5 int main()
6 {
7 // comment
8 std::cout << "Hello World!" << std::endl;
9 return 0;
10 }

Example 2:

1 @code
2 @@src cpp/demo.cpp
3 @@width 100%
4 @end_code

Output:

1 // example 2 - <current directory>/cpp
2
3 #include <iostream>
4
5 int main()
6 {
7 // comment
8 std::cout << "Hello World!" << std::endl;
9 return 0;
10 }