Ignore:
Timestamp:
09/11/09 05:40:45 (3 years ago)
Author:
james
Message:

Add revmixin and nomixin options to %VAR, to allow the gender-mixin stuff to be controlled

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/en/output_VAR.tcl

    r1029 r1031  
    2424proc bMotion_plugin_output_VAR { channel line } { 
    2525        bMotion_putloglev 4 * "bMotion_plugin_output_VAR $channel $line" 
     26        global BMOTION_MIXIN_NONE BMOTION_MIXIN_REVERSE BMOTION_MIXIN_DEFAULT 
    2627 
    2728        set line [string map { "%noun" "%VAR{sillyThings}" } $line] 
     
    3031        regsub {%VAR\{([^\}]+)\}\{strip\}} $line "%VAR{\\1:strip}" line 
    3132 
    32         if {[regexp -nocase {(%VAR\{([^\}:]+)(:[^\}]+)?\}(\{strip\})?)} $line matches whole_thing abstract options clean]} { 
     33        if {[regexp -nocase {(%VAR\{([^\}:]+)(:([^\}]+))?\}(\{strip\})?)} $line matches whole_thing abstract 1 options clean]} { 
    3334                global $abstract 
     35 
     36                bMotion_putloglev 1 * "options for $abstract are $options" 
     37 
     38                # check options 
     39                if {$options != ""} { 
     40                        set options_list [split $options ","] 
     41                } else { 
     42                        set options_list [list] 
     43                } 
     44                bMotion_putloglev 1 * "options list is $options_list" 
     45 
     46                if {$clean == "{strip}"} { 
     47                        lappend options_list "clean" 
     48                } 
     49 
     50                set mixin_type $BMOTION_MIXIN_DEFAULT 
     51 
     52                if {[lsearch $options_list "revmixin"] > -1} { 
     53                        bMotion_putloglev 1 * "mixin type for $abstract is reverse" 
     54                        set mixin_type $BMOTION_MIXIN_REVERSE 
     55                } elseif {[lsearch $options_list "nomixin"] > -1} { 
     56                        bMotion_putloglev 1 * "mixin type for $abstract is none" 
     57                        set mixin_type $BMOTION_MIXIN_NONE 
     58                } 
     59 
    3460                #see if we have a new-style abstract available 
    35                 set newText [bMotion_abstract_get $abstract] 
     61                set newText [bMotion_abstract_get $abstract $mixin_type] 
    3662                set replacement "" 
    3763                if {$newText == ""} { 
     
    4975                } 
    5076 
    51                 # check options 
    52                 set options [string range $options 1 end] 
    53                 if {$options != ""} { 
    54                         set options_list [split $options ","] 
    55                 } else { 
    56                         set options_list [list] 
    57                 } 
    58  
    59                 if {$clean == "{strip}"} { 
    60                         lappend options_list "clean" 
    61                 } 
    6277 
    6378                if {[lsearch $options_list "strip"] == -1} { 
     
    131146} 
    132147 
     148 
    133149bMotion_plugin_add_output "VAR" bMotion_plugin_output_VAR 1 "en" 3 
Note: See TracChangeset for help on using the changeset viewer.