aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/meta_abstraction.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/meta_abstraction.org')
-rw-r--r--org/meta_abstraction.org128
1 files changed, 49 insertions, 79 deletions
diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org
index 959de0c..b8ab4e6 100644
--- a/org/meta_abstraction.org
+++ b/org/meta_abstraction.org
@@ -5433,113 +5433,83 @@ private:
static assert(is(typeof(munge_) == string));
static assert(is(typeof(obj_) == string[string]));
}
- if (conf_make_meta.make.num_top.length > 0) {
- static __gshared int heading_num_top_level=9;
- static __gshared int heading_num_depth=2;
- static __gshared int heading_num_0 = 0;
- static __gshared int heading_num_1 = 0;
- static __gshared int heading_num_2 = 0;
- static __gshared int heading_num_3 = 0;
- static __gshared string heading_number_auto_composite = "";
- if (heading_num_top_level==9) {
- if (conf_make_meta.make.num_depth.length > 0) {
- heading_num_depth = conf_make_meta.make.num_depth.to!uint;
- }
- switch (conf_make_meta.make.num_top) {
- case "A":
- break;
- case "B":
- heading_num_top_level=1;
- break;
- case "C":
- heading_num_top_level=2;
- break;
- case "D":
- heading_num_top_level=3;
- break;
- case "1":
- heading_num_top_level=4;
- break;
- case "2":
- heading_num_top_level=5;
- break;
- case "3":
- heading_num_top_level=6;
- break;
- case "4":
- heading_num_top_level=7;
- break;
- default:
- break;
- }
+ static __gshared int[] heading_num = [ 0, 0, 0, 0 ];
+ static __gshared string heading_number_auto_composite = "";
+ if (conf_make_meta.make.auto_num_top_lv) {
+ if (obj_["lev_markup_number"].to!int == 0) {
+ heading_num[0] = 0;
+ heading_num[1] = 0;
+ heading_num[2] = 0;
+ heading_num[3] = 0;
+ heading_number_auto_composite = "";
}
/+ num_depth minimum 0
(1.) default 2 (1.1.1) max 3 (1.1.1.1) implement +/
if (
- heading_num_top_level
+ conf_make_meta.make.auto_num_top_lv
> obj_["lev_markup_number"].to!uint
) {
- heading_num_1 = 0;
- heading_num_2 = 0;
- heading_num_3 = 0;
+ heading_num[1] = 0;
+ heading_num[2] = 0;
+ heading_num[3] = 0;
} else if (
- heading_num_top_level
+ conf_make_meta.make.auto_num_top_lv
== obj_["lev_markup_number"].to!uint
) {
- heading_num_0 ++;
- heading_num_1 = 0;
- heading_num_2 = 0;
- heading_num_3 = 0;
+ heading_num[0] ++;
+ heading_num[1] = 0;
+ heading_num[2] = 0;
+ heading_num[3] = 0;
} else if (
- heading_num_top_level
+ conf_make_meta.make.auto_num_top_lv
== (obj_["lev_markup_number"].to!uint - 1)
) {
- heading_num_1 ++;
- heading_num_2 = 0;
- heading_num_3 = 0;
+ heading_num[1] ++;
+ heading_num[2] = 0;
+ heading_num[3] = 0;
} else if (
- heading_num_top_level
+ conf_make_meta.make.auto_num_top_lv
== (obj_["lev_markup_number"].to!uint - 2)
) {
- heading_num_2 ++;
- heading_num_3 = 0;
+ heading_num[2] ++;
+ heading_num[3] = 0;
} else if (
- heading_num_top_level
+ conf_make_meta.make.auto_num_top_lv
== (obj_["lev_markup_number"].to!uint - 3)
) {
- heading_num_3 ++;
+ heading_num[3] ++;
}
- if (heading_num_3 > 0) {
+ if (heading_num[3] > 0) {
heading_number_auto_composite
- = (heading_num_depth == 3)
- ? ( heading_num_0.to!string ~ "."
- ~ heading_num_1.to!string ~ "."
- ~ heading_num_2.to!string ~ "."
- ~ heading_num_3.to!string
+ = (conf_make_meta.make.num_depth.to!uint == 3)
+ ? ( heading_num[0].to!string ~ "."
+ ~ heading_num[1].to!string ~ "."
+ ~ heading_num[2].to!string ~ "."
+ ~ heading_num[3].to!string
)
: "";
- } else if (heading_num_2 > 0) {
+ } else if (heading_num[2] > 0) {
heading_number_auto_composite
- = ((heading_num_depth >= 2)
- && (heading_num_depth <= 3))
- ? ( heading_num_0.to!string ~ "."
- ~ heading_num_1.to!string ~ "."
- ~ heading_num_2.to!string
+ = ((conf_make_meta.make.num_depth.to!uint >= 2)
+ && (conf_make_meta.make.num_depth.to!uint <= 3))
+ ? ( heading_num[0].to!string ~ "."
+ ~ heading_num[1].to!string ~ "."
+ ~ heading_num[2].to!string
)
: "";
- } else if (heading_num_1 > 0) {
+ } else if (heading_num[1] > 0) {
heading_number_auto_composite
- = ((heading_num_depth >= 1)
- && (heading_num_depth <= 3))
- ? ( heading_num_0.to!string ~ "."
- ~ heading_num_1.to!string
+ = ((conf_make_meta.make.num_depth.to!uint >= 1)
+ && (conf_make_meta.make.num_depth.to!uint <= 3))
+ ? ( heading_num[0].to!string ~ "."
+ ~ heading_num[1].to!string
)
: "";
- } else if (heading_num_0 > 0) {
+ } else if (heading_num[0] > 0) {
heading_number_auto_composite
- = ((heading_num_depth >= 0)
- && (heading_num_depth <= 3))
- ? (heading_num_0.to!string)
+ = ((conf_make_meta.make.num_depth.to!uint >= 0)
+ && (conf_make_meta.make.num_depth.to!uint <= 3))
+ ? (heading_num[0].to!string)
: "";
} else {
heading_number_auto_composite = "";
@@ -5548,7 +5518,7 @@ private:
writeln(heading_number_auto_composite);
}
if ((!empty(heading_number_auto_composite))
- && (obj_["lev_markup_number"].to!uint >= heading_num_top_level)) {
+ && (obj_["lev_markup_number"].to!uint >= conf_make_meta.make.auto_num_top_lv)) {
munge_=(munge_)
.replaceFirst(rgx.heading,
"$1~$2 " ~ heading_number_auto_composite ~ ". ")