@@ -938,29 +938,54 @@ def opt_all_caps(
938938
939939 # TODO: Ensure that all values within `locations` are valid
940940
941- # Set new options for `locations` selected, or, reset to default options
942- # if `all_caps` is False
943- res = self
941+ # if `all_caps` is False, reset options to default, or, set new options
942+ # for `locations` selected
943+ if not all_caps :
944+ return tab_options (
945+ self ,
946+ column_labels_font_size = "100%" ,
947+ column_labels_font_weight = "normal" ,
948+ column_labels_text_transform = "inherit" ,
949+ stub_font_size = "100%" ,
950+ stub_font_weight = "initial" ,
951+ stub_text_transform = "inherit" ,
952+ row_group_font_size = "100%" ,
953+ row_group_font_weight = "initial" ,
954+ row_group_text_transform = "inherit" ,
955+ )
944956
945- # Predicates for locations
946- p1 = all_caps and "column_labels" in locations
947- p2 = all_caps and "stub" in locations
948- p3 = all_caps and "row_group" in locations
949-
950- res = tab_options (
951- res ,
952- column_labels_font_size = "80%" if p1 else "100%" ,
953- column_labels_font_weight = "bolder" if p1 else "normal" ,
954- column_labels_text_transform = "uppercase" if p1 else "inherit" ,
955- stub_font_size = "80%" if p2 else "100%" ,
956- stub_font_weight = "bolder" if p2 else "initial" ,
957- stub_text_transform = "uppercase" if p2 else "inherit" ,
958- row_group_font_size = "80%" if p3 else "100%" ,
959- row_group_font_weight = "bolder" if p3 else "initial" ,
960- row_group_text_transform = "uppercase" if p3 else "inherit" ,
961- )
957+ info = [
958+ (
959+ "column_labels" ,
960+ {
961+ "column_labels_font_size" : "80%" ,
962+ "column_labels_font_weight" : "bolder" ,
963+ "column_labels_text_transform" : "uppercase" ,
964+ },
965+ ),
966+ (
967+ "stub" ,
968+ {
969+ "stub_font_size" : "80%" ,
970+ "stub_font_weight" : "bolder" ,
971+ "stub_text_transform" : "uppercase" ,
972+ },
973+ ),
974+ (
975+ "row_group" ,
976+ {
977+ "row_group_font_size" : "80%" ,
978+ "row_group_font_weight" : "bolder" ,
979+ "row_group_text_transform" : "uppercase" ,
980+ },
981+ ),
982+ ]
983+ d = {}
984+ for location , params in info :
985+ if location in locations :
986+ d |= params
962987
963- return res
988+ return tab_options ( self , ** d )
964989
965990
966991def opt_table_outline (
0 commit comments