| 1 | """ |
|---|
| 2 | Macro for a centering environment |
|---|
| 3 | |
|---|
| 4 | {{{ |
|---|
| 5 | [[Center(begin)]] |
|---|
| 6 | }}} |
|---|
| 7 | starts the centered environment |
|---|
| 8 | |
|---|
| 9 | {{{ |
|---|
| 10 | [[Center(end)]] |
|---|
| 11 | }}} |
|---|
| 12 | ends the centered environment |
|---|
| 13 | |
|---|
| 14 | """ |
|---|
| 15 | from StringIO import StringIO |
|---|
| 16 | |
|---|
| 17 | def execute(hdf, args, env): |
|---|
| 18 | buf = StringIO() |
|---|
| 19 | if args: |
|---|
| 20 | if args == 'begin': |
|---|
| 21 | buf.write("<center>") |
|---|
| 22 | elif args == 'end': |
|---|
| 23 | buf.write("</center>") |
|---|
| 24 | else: |
|---|
| 25 | buf.write("<p style='font-weight:bold; color:red;'>[[Center()]] macro unknown keyword %s</p>\n" % (args)) |
|---|
| 26 | |
|---|
| 27 | else: |
|---|
| 28 | buf.write("<p style='font-weight:bold; color:red;'>[[Center()]] macro requires keyword 'begin' or 'end'</p>\n") |
|---|
| 29 | |
|---|
| 30 | return buf.getvalue() |
|---|