aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/meta/object_setter.d
blob: 967f9ecdb8d0d7acd517e797e22fadaaf054b0f9 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/++
  object setter:
  setting of sisu objects for downstream processing
  meta_object_setter.d
+/
module sdp.meta.object_setter;
template ObjectSetter() {
  /+ structs +/
  struct DocObj_TypeInfo_ {                                   // typeinfo
    string                 of_part                            = ""; // frontmatter, body, backmatter
    string                 of_section                         = ""; // toc, body, glossary, biography, book index, blurb
    string                 is_of                              = ""; // para, block ?
    string                 is_a                               = ""; // heading, para, table, code block, group, ...
  }
  struct DocObj_TxtAttrib_ {                                  // attrib
    int                    indent_base                        = 0;
    int                    indent_hang                        = 0;
    bool                   bullet                             = false;
    string                 language                           = ""; // not implemented, consider
  }
  struct DocObj_Has_ {                                        // has
    bool                   inline_links                       = false;
    bool                   inline_notes_reg                   = false;
    bool                   inline_notes_star                  = false;
    bool                   contains_image_without_dimensions  = false;
  }
  struct DocObj_Node_ {                                       // node
    string[string][string] node;
    int                    ocn                                = 0;
    string object_number() const @property {
      return (ocn==0)
        ? ""
        : ocn.to!string;
    }
    string                 ocn_type                           = ""; // code duplicated typeinfo is_a
    string                 marked_up_level                    = "9";
    int                    heading_lev_markup                 = 9;
    int                    heading_lev_collapsed              = 9;
    int[]                  dom_markedup                       = [ 0, 0, 0, 0, 0, 0, 0, 0,];
    int[]                  dom_collapsed                      = [ 0, 0, 0, 0, 0, 0, 0, 0,];
    int[]                  heading_ancestors                  = [ 0, 0, 0, 0, 0, 0, 0, 0,];
    int                    parent_lev_markup                  = 0;
    int                    parent_ocn                         = 0;
    int[]                  ancestors                          = [];
  }
  struct DocObj_Table_ {                                      // table
    int                    number_of_columns                  = 0;
    double[]               column_widths                      = [];
    string[]               column_aligns                      = [];
    bool                   heading                            = false;
    bool                   walls                              = false; // not implemented
  }
  struct DocObj_CodeBlock_ {                                  // code_block
    string                 syntax                             = "";
  }
  struct DocObj_Pointer_ {                                    // ptr
    int                    doc_object                         = 0;
    int                    html_segnames                      = 0;
    int                    heading                            = 0;
  }
  struct DocObj_Tags_ {                                       // tags
    string[]               heading_ancestors_text             = [ "", "", "", "", "", "", "", "", ];
    string                 segment_anchor_tag                 = "";
    string                 segname_prev                       = "";
    string                 segname_next                       = "";
    string[]               lev4_subtoc                        = [];
    string[]               anchor_tags                        = [];
  }
  struct DocObj_Misc_ {                                       // misc
    int                    o_n_substantive                    = 0;
    int                    o_n_non_substantive                = 0;
    int                    o_n_glossary                       = 0;
    int                    o_n_bibliography                   = 0;
    int                    o_n_book_index                     = 0;
    int                    o_n_blurb                          = 0;
    string object_number_substantive() const @property {
      return (o_n_substantive==0)
        ? ""
        : o_n_substantive.to!string;
    }
    string object_number_non_substantive() const @property {
      return (o_n_non_substantive==0)
        ? ""
        : o_n_non_substantive.to!string;
    }
    string object_number_glossary() const @property {
      return (o_n_glossary==0)
        ? ""
        : o_n_glossary.to!string;
    }
    string object_number_bibliography() const @property {
      return (o_n_bibliography==0)
        ? ""
        : o_n_bibliography.to!string;
    }
    string object_number_book_index() const @property {
      return (o_n_book_index==0)
        ? ""
        : o_n_book_index.to!string;
    }
    string object_number_blurb() const @property {
      return (o_n_blurb==0)
        ? ""
        : o_n_blurb.to!string;
    }
    string                 object_number_off                  = "";
    bool                   visible_object_number              = false;
    int                    object_number_type                 = 0; // { ocn, non, bkidx }
  }
  struct ObjGenericComposite {
    string                 text                               = "";
    DocObj_TypeInfo_       typeinfo;
    DocObj_TxtAttrib_      attrib;
    DocObj_Tags_           tags;
    DocObj_Has_            has;
    DocObj_Table_          table;
    DocObj_CodeBlock_      code_block;
    DocObj_Misc_           misc;
    DocObj_Pointer_        ptr;
    DocObj_Node_           node;
  }
  struct TheObjects {
    ObjGenericComposite[] oca;
  }
}