aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sdp/ao_object_setter.d
blob: a44aeb00d8db90c931e2b1c5f53e96f651c61278 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/+
  object setter
  ao_object_setter.d
+/
template ObjectSetter() {
  struct ObjectAbstractSet {
    import std.conv : to;
    string[string] contents_comment(in string object) {
      string[string] object_set;
      object_set["use"]           = "comment";
      object_set["of"]            = "comment";
      object_set["is"]            = "comment";
      object_set["obj"]           = object;
      // object_set["attrib"]     = attrib;
      return object_set;
    }
    string[string] contents_heading(
      in int type,
      in string object,
      in string attrib,
      in int obj_cite_number,
      in string lev,
      in string lev_markup_number,
      in string lev_collapsed_number,
    ) {
      string[string] object_set;
      object_set["use"]                  = "content";
      object_set["of"]                   = "para";
      object_set["is"]                   = "heading";
      object_set["type"]                 = to!string(type);
      // object_set["is"]                = type; // "heading" "heading_dummy"
      object_set["obj"]                  = object;
      object_set["obj_cite_number"]      = (obj_cite_number==0) ? "" : to!string(obj_cite_number);
      object_set["lev"]                  = to!string(lev);
      object_set["lev_markup_number"]    = to!string(lev_markup_number);
      object_set["lev_collapsed_number"] = to!string(lev_collapsed_number);
      object_set["attrib"]               = attrib;
      // object_set["children"]          = children;
      return object_set;
    }
    string[string] contents_para(
      in string is_a,
      in string object,
      in string attrib,
      in int obj_cite_number,
      in string[string] indent,
      in bool bullet
    ) {
      string[string] object_set;
      object_set["use"]              = "content";
      object_set["of"]               = "para";
      object_set["is"]               = is_a;
      // object_set["status"]        = status;
      object_set["obj"]              = object;
      object_set["obj_cite_number"]  = (obj_cite_number==0) ? "" : to!string(obj_cite_number);
      object_set["indent_first"]     = indent["first"];
      object_set["indent_second"]    = indent["second"];
      object_set["bullet"]           = to!string(bullet);
      object_set["attrib"]           = attrib;
      return object_set;
    }
    string[string] contents_block(
      in string type,
      in string object,
      in string attrib,
      in int obj_cite_number
    ) {
      string[string] object_set;
      object_set["use"]             = "content";
      object_set["of"]              = "block";
      object_set["is"]              = type;
      object_set["obj"]             = object;
      object_set["obj_cite_number"] = (obj_cite_number==0) ? "" : to!string(obj_cite_number);
      object_set["attrib"]          = attrib;
      return object_set;
    }
    string[string] contents_block_obj_cite_number_string(
      in string type,
      in string object,
      in string obj_cite_number,
      in string node
    ) {
      string[string] object_set;
      object_set["use"]             = "content";
      object_set["of"]              = "block";
      object_set["is"]              = type;
      object_set["obj"]             = object;
      object_set["obj_cite_number"] = obj_cite_number;
      object_set["node"]            = node;
      // object_set["attrib"]       = "";
      return object_set;
    }
  }
}