| 28 | |
| 29 | |
| 30 | == Usage |
| 31 | Comments can contain python code if the block starts with {@link #CODE_IN_COMMENT_TXT}. This code replaces the entire object (if/case/while block; statement) that follows the comment. |
| 32 | |
| 33 | Python has strict requirements regarding indentation. To make this possible, we need to be strict about indentation as well. In a single line python comment, the code must look exactly like |
| 34 | |
| 35 | {{{ |
| 36 | //#PY single_python_line |
| 37 | }}} |
| 38 | |
| 39 | Note the single whitespace after the #PY. Your code starts after this single whitespace. |
| 40 | |
| 41 | In a multi line comment the code must look exactly like |
| 42 | {{{ |
| 43 | /*#PY |
| 44 | * codeline1 |
| 45 | * codeline2 |
| 46 | * ... |
| 47 | */ |
| 48 | }}} |
| 49 | |
| 50 | Your code lines each start with "* ", note the whitespace after the star. You are free to indent before the "*". |
| 51 | |
| 52 | Your code is automatically indented to the level needed at the insertion |
| 53 | place in the coed. |
| 54 | |
| 55 | Code MUST be placed in either a standard block comment or a single line |
| 56 | comment. Starting a javadoc with the {@link #CODE_IN_COMMENT_TXT} is not |
| 57 | allowed. This is to encourage proper use of javadoc. |
| 58 | |
| 59 | A comment block overrides also annotations. |
| 60 | |
| 61 | If the code block contains no code at all, it is translated as |
| 62 | {{{pass}}}, to ensure that the code is a proper statement. |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | == Resulting file |