Code

l2l_scanner: Print "Abbildung|Listing" in bold font in figure captions.
authorSebastian Harl <sh@tokkee.org>
Sun, 13 Jun 2010 21:24:17 +0000 (23:24 +0200)
committerSebastian Harl <sh@tokkee.org>
Sun, 13 Jun 2010 21:33:14 +0000 (23:33 +0200)
src/l2l_scanner.l

index d02479d7370525f4336ccf14dead9eded4cb5b78..cf7000c567cf1bdc2925b8a136fe2d53f89937fc 100644 (file)
@@ -436,10 +436,12 @@ ANY_COMMAND @(R|SW|D|T|V|A|L|ZT|LI|B|Bi|IT|IL|IE|KT|KL|KE|TT|TH|TL|TE):
         * images/boxes
         */
 
-@(B|KT):{WHITESPACE}* {
+@(B|KT):{WHITESPACE}*((Abbildung|Listing)({WHITESPACE}|\n)+[0-9]+:)? {
        _Bool is_image = 0;
        _Bool is_box   = 0;
 
+       char *label    = NULL;
+
        if (! strncmp(yytext, "@B:", 3))
                is_image = 1;
        else if (! strncmp(yytext, "@KT:", 4))
@@ -456,6 +458,14 @@ ANY_COMMAND @(R|SW|D|T|V|A|L|ZT|LI|B|Bi|IT|IL|IE|KT|KL|KE|TT|TH|TL|TE):
                l2l_scanner_state = L2L_BODY;
        }
 
+       label = strstr(yytext, "Abbildung");
+       if (! label)
+               label = strstr(yytext, "Listing");
+
+       if (label)
+               if (l2l_strbuf_append(&l2l_caption, "{\\bfseries %s}", label))
+                       YY_FATAL_ERROR("ERROR: internal error");
+
        l2l_buf_ptr = &l2l_caption;
        if (is_image)
                BEGIN(caption);