diff options
Diffstat (limited to 'src/interfacegats.cpp')
-rw-r--r-- | src/interfacegats.cpp | 50 |
1 files changed, 3 insertions, 47 deletions
diff --git a/src/interfacegats.cpp b/src/interfacegats.cpp index c14a8f2..696c6b6 100644 --- a/src/interfacegats.cpp +++ b/src/interfacegats.cpp | |||
@@ -1,6 +1,7 @@ | |||
1 | #include "interfacegats.h" | 1 | #include "interfacegats.h" |
2 | 2 | ||
3 | #include "smlnode.h" | 3 | #include "smlnode.h" |
4 | #include "smlrendererhtml.h" | ||
4 | 5 | ||
5 | #include <bu/plugger.h> | 6 | #include <bu/plugger.h> |
6 | #include <bu/sio.h> | 7 | #include <bu/sio.h> |
@@ -24,52 +25,7 @@ void InterfaceGats::run( class Game *pGame ) | |||
24 | 25 | ||
25 | void InterfaceGats::display( const SmlNode *pSml ) | 26 | void InterfaceGats::display( const SmlNode *pSml ) |
26 | { | 27 | { |
27 | switch( pSml->getType() ) | 28 | SmlRendererHtml rend; |
28 | { | 29 | rend.render( sio, pSml ); |
29 | case SmlNode::typeRoot: | ||
30 | sio << "<p>"; | ||
31 | for( SmlNode::SmlNodeList::const_iterator i = | ||
32 | pSml->getChildren().begin(); i; i++ ) | ||
33 | { | ||
34 | display( *i ); | ||
35 | } | ||
36 | sio << "</p>"; | ||
37 | break; | ||
38 | |||
39 | case SmlNode::typeText: | ||
40 | sio << pSml->getText(); | ||
41 | break; | ||
42 | |||
43 | case SmlNode::typeTag: | ||
44 | if( pSml->getChildren().isEmpty() ) | ||
45 | { | ||
46 | if( pSml->getText() == "break" ) | ||
47 | sio << "</p><p>"; | ||
48 | } | ||
49 | else | ||
50 | { | ||
51 | if( pSml->getText() == "red" ) | ||
52 | { | ||
53 | sio << "<span style=\"color: red;\">"; | ||
54 | for( SmlNode::SmlNodeList::const_iterator i = | ||
55 | pSml->getChildren().begin(); i; i++ ) | ||
56 | { | ||
57 | display( *i ); | ||
58 | } | ||
59 | sio << "</span>"; | ||
60 | } | ||
61 | else if( pSml->getText() == "green" ) | ||
62 | { | ||
63 | sio << "<span style=\"color: green;\">"; | ||
64 | for( SmlNode::SmlNodeList::const_iterator i = | ||
65 | pSml->getChildren().begin(); i; i++ ) | ||
66 | { | ||
67 | display( *i ); | ||
68 | } | ||
69 | sio << "</span>"; | ||
70 | } | ||
71 | } | ||
72 | break; | ||
73 | } | ||
74 | } | 30 | } |
75 | 31 | ||