aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/output_show.org
blob: e473c928c5a0dabe1709c84d6d4e4ebac4212228 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
-*- mode: org -*-
#+TITLE:       spine (doc_reform) metadata (multidocument) harvests
#+DESCRIPTION: documents - structuring, various output representations & search
#+FILETAGS:    :spine:hub:
#+AUTHOR:      Ralph Amissah
#+EMAIL:       [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]]
#+COPYRIGHT:   Copyright (C) 2015 - 2020 Ralph Amissah
#+LANGUAGE:    en
#+STARTUP:     content hideblocks hidestars noindent entitiespretty
#+PROPERTY:    header-args  :exports code
#+PROPERTY:    header-args+ :noweb yes
#+PROPERTY:    header-args+ :eval no
#+PROPERTY:    header-args+ :results no
#+PROPERTY:    header-args+ :cache no
#+PROPERTY:    header-args+ :padline no

* document abstraction _summary_         :module:spine:metadoc_show_summary:
** _module template_ metadoc summary
- document summary from abstraction

#+BEGIN_SRC d :tangle "../src/doc_reform/meta/metadoc_show_summary.d"
module doc_reform.meta.metadoc_show_summary;
template spineMetaDocSummary() {
  @safe void spineMetaDocSummary(S,T)(
    const S  doc_abstraction,
          T  doc_matters,
  ) {
    <<metadoc_show_summary_imports>>
    <<metadoc_show_imports_shared>>
    mixin InternalMarkup;
    <<metadoc_show_initialize>>
    if (doc_matters.opt.action.verbose
    || doc_matters.opt.action.show_summary) {
      <<meta_metadoc_show_summary_document>>
    }
  }
}
#+END_SRC

** (last ocn)

#+NAME: meta_metadoc_show_summary_document
#+BEGIN_SRC d
string[string] check = [
  "last_object_number" : "NA [debug \"checkdoc\" not run]",
  "last_object_number_body"  : "0",
  "last_object_number_book_index" : "0",
];
foreach (k; doc_matters.has.keys_seq.seg) {
  foreach (obj; doc_abstraction[k]) {
    if (obj.metainfo.is_of_part != "empty") {
      if (!empty(obj.metainfo.object_number)) {
        if (k == "body") {
          check["last_object_number_body"] = obj.metainfo.object_number;
        }
        if (!(obj.metainfo.object_number.empty)) {
          check["last_object_number"] = obj.metainfo.object_number;
        }
      }
      if (k == "bookindex") {
        if (obj.metainfo.object_number_type == 2) {
          check["last_object_number_book_index"] = obj.metainfo.object_number_book_index;
        }
      }
    }
  }
}
#+END_SRC

** document summary

#+NAME: meta_metadoc_show_summary_document
#+BEGIN_SRC d
writefln(
  "%s\n\"%s\", %s\n%s [%s]\n%s\n%40-s%10-d\n%40-s%10-d\n%40-s%10-d\n%40-s%10-d\n%40-s%10-d\n%40-s%10-d\n%40-s%10-d\n%40-s%10-d\n%40-s%10-d\n%40-s%10-d\n%40-s%10-d\n%40-s%10-d\n%40-s%10-d\n%40-s%10-d\n%40-s%10-d\n%40-s%10-d\n%40-s%10-d\n%s",
  markup.repeat_character_by_number_provided("-", char_repeat_number),
  doc_matters.conf_make_meta.meta.title_full,
  doc_matters.conf_make_meta.meta.creator_author,
  doc_matters.src.filename,
  doc_matters.src.language,
  markup.repeat_character_by_number_provided("-", char_repeat_number),
  "- toc arr length:",
  to!int(doc_abstraction["toc"].length),
  "- doc_abstraction arr length:",
  to!int(doc_abstraction["body"].length),
  "  doc body last obj on.#:",
  to!int(check["last_object_number_body"]),
  "  - number of tables:",
  doc_matters.has.tables,
  "  - number of codeblocks:",
  doc_matters.has.codeblocks,
  "  - number of poems:",
  doc_matters.has.poems,
  "  - number of blocks:",
  doc_matters.has.blocks,
  "  - number of groups:",
  doc_matters.has.groups,
  "  - number of images:",
  doc_matters.has.images,
  "- endnotes length:",                                // subtract headings
  (doc_abstraction["endnotes"].length > 2)
  ? (to!int(doc_abstraction["endnotes"].length - 2))
  : 0,
  "- glossary length:",
  (doc_abstraction["glossary"].length > 1)
  ? (to!int(doc_abstraction["glossary"].length))
  : 0,
  "- biblio length:",
  (doc_abstraction["bibliography"].length > 1)
  ? (to!int(doc_abstraction["bibliography"].length))
  : 0,
  "- bookindex length:",
  (doc_abstraction["bookindex"].length > 1)
  ? (to!int(doc_abstraction["bookindex"].length))
  : 0,
  "  book idx last obj on.#:",
  to!int(check["last_object_number_book_index"]),
  "- blurb length:",
  (doc_abstraction["blurb"].length > 1)
  ? (to!int(doc_abstraction["blurb"].length))
  : 0,
  "* last obj on.#:",
  to!int(check["last_object_number"]),
  "number of segments:",
  (doc_matters.has.segnames_lv4.length > 1)
  ? (to!int(doc_matters.has.segnames_lv4.length))
  : 0,
  markup.repeat_character_by_number_provided("-", min_repeat_number),
);
#+END_SRC

* show config
** _module template_ show config
*** _show site config
--show-config (show config)

#+BEGIN_SRC d :tangle "../src/doc_reform/meta/metadoc_show_config.d"
module doc_reform.meta.metadoc_show_config;
template spineShowSiteConfig() {
  @safe void spineShowSiteConfig(O,T)(
    O opt_action,
    T config,
  ) {
    <<metadoc_show_summary_imports>>
    <<metadoc_show_imports_shared>>
    mixin InternalMarkup;
    auto markup = InlineMarkup();
    auto char_repeat_number = 66;
    if (opt_action.show_config) {
      <<meta_metadoc_show_site_config>>
    }
  }
}
#+END_SRC

*** show site config

#+NAME: meta_metadoc_show_site_config
#+BEGIN_SRC d
writefln(
  "\n%s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n",
  markup.repeat_character_by_number_provided("-", char_repeat_number),
  "- webserv domain name:",
  config.conf.w_srv_domain,
  "- webserv doc root (part):",
  config.conf.w_srv_data_root_part,
  "- webserv doc path:",
  config.conf.w_srv_data_root_path,
  "- webserv images (location):",
  config.conf.w_srv_images_root_part,
  "- webserv doc root url:",
  config.conf.w_srv_data_root_url,
  "- webserv cgi domain (host):",
  config.conf.w_srv_cgi_domain,
  "- webserv cgi host path:",
  config.conf.w_srv_cgi_bin_path,
  "- webserv cgi host (part):",
  config.conf.w_srv_cgi_bin_part,
  "- webserv cgi search script:",
  config.conf.w_srv_cgi_search_script,
  "- webserv cgi search script in d:",
  config.conf.w_srv_cgi_search_script_raw_fn_d,
  "- webserv cgi port:",
  config.conf.w_srv_cgi_port,
  "- webserv cgi user:",
  config.conf.w_srv_cgi_user,
  "- webserv cgi url:",
  config.conf.w_srv_cgi_bin_url,
  "- webserv cgi action:",
  config.conf.w_srv_cgi_action,
  "- webserv cgi title:",
  config.conf.w_srv_cgi_title,
  // "- webserv cgi file links:",
  // config.conf.w_srv_cgi_file_links,
  "- webserv sqlite db:",
  config.conf.w_srv_db_sqlite,
  "- output path:",
  config.conf.output_path,
  "- processing concordance max:",
  config.conf.processing_concord_max,
  // "- flag act0:",
  // config.conf.flag_act0,
  "- default papersize:",
  config.conf.set_papersize,
  "- default text wrap:",
  config.conf.set_text_wrap,
  "- default emphasis markup symbol:",
  config.conf.set_emphasis,
  "- default language:",
  config.conf.set_language,
  "- default hash digest:",
  config.conf.set_digest,
  "- search flag:",
  config.conf.search_flag,
  "- search action:",
  config.conf.search_action,
  "- search db:",
  config.conf.search_db,
  "- search title:",
  config.conf.search_title,
);
#+END_SRC

*** show (per document) config

#+BEGIN_SRC d :tangle "../src/doc_reform/meta/metadoc_show_config.d"
template spineShowConfig() {
  @safe void spineShowConfig(T)(
    T  doc_matters,
  ) {
    <<metadoc_show_summary_imports>>
    <<metadoc_show_imports_shared>>
    mixin InternalMarkup;
    <<metadoc_show_initialize>>
    if (doc_matters.opt.action.show_config
      && doc_matters.opt.action.debug_do
    ) {
      writeln(doc_matters.conf_make_meta.conf);
    }
    if (doc_matters.opt.action.show_config) {
      <<meta_metadoc_show_config>>
    }
  }
}
#+END_SRC

** show config

#+NAME: meta_metadoc_show_config
#+BEGIN_SRC d
writefln(
  "%s\n\"%s\", %s\n%s\n%s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n",
  markup.repeat_character_by_number_provided("-", char_repeat_number),
  doc_matters.conf_make_meta.meta.title_full,
  doc_matters.conf_make_meta.meta.creator_author,
  doc_matters.src.filename,
  markup.repeat_character_by_number_provided("-", char_repeat_number),
  "- webserv domain name:",
  doc_matters.conf_make_meta.conf.w_srv_domain,
  "- webserv doc root (part):",
  doc_matters.conf_make_meta.conf.w_srv_data_root_part,
  "- webserv doc path:",
  doc_matters.conf_make_meta.conf.w_srv_data_root_path,
  "- webserv images (location):",
  doc_matters.conf_make_meta.conf.w_srv_images_root_part,
  "- webserv doc root url:",
  doc_matters.conf_make_meta.conf.w_srv_data_root_url,
  "- webserv cgi domain (host):",
  doc_matters.conf_make_meta.conf.w_srv_cgi_domain,
  "- webserv cgi host path:",
  doc_matters.conf_make_meta.conf.w_srv_cgi_bin_path,
  "- webserv cgi host (part):",
  doc_matters.conf_make_meta.conf.w_srv_cgi_bin_part,
  "- webserv cgi search script:",
  doc_matters.conf_make_meta.conf.w_srv_cgi_search_script,
  "- webserv cgi search script in d:",
  doc_matters.conf_make_meta.conf.w_srv_cgi_search_script_raw_fn_d,
  "- webserv cgi url:",
  doc_matters.conf_make_meta.conf.w_srv_cgi_bin_url,
  "- webserv cgi action:",
  doc_matters.conf_make_meta.conf.w_srv_cgi_action,
  // "- webserv cgi file links:",
  // doc_matters.conf_make_meta.conf.w_srv_cgi_file_links,
  "- webserv sqlite db:",
  doc_matters.conf_make_meta.conf.w_srv_db_sqlite,
  "- output path:",
  doc_matters.conf_make_meta.conf.output_path,
  "- processing concordance max:",
  doc_matters.conf_make_meta.conf.processing_concord_max,
  // "- flag act0:",
  // doc_matters.conf_make_meta.conf.flag_act0,
  "- default papersize:",
  doc_matters.conf_make_meta.conf.set_papersize,
  "- default text wrap:",
  doc_matters.conf_make_meta.conf.set_text_wrap,
  "- default emphasis markup symbol:",
  doc_matters.conf_make_meta.conf.set_emphasis,
  "- default language:",
  doc_matters.conf_make_meta.conf.set_language,
  "- default hash digest:",
  doc_matters.conf_make_meta.conf.set_digest,
  "- search flag:",
  doc_matters.conf_make_meta.conf.search_flag,
  "- search action:",
  doc_matters.conf_make_meta.conf.search_action,
  "- search db:",
  doc_matters.conf_make_meta.conf.search_db,
  "- search title:",
  doc_matters.conf_make_meta.conf.search_title,
);
#+END_SRC

* show make
** _module template_ show make
--show-make (show document make)

#+BEGIN_SRC d :tangle "../src/doc_reform/meta/metadoc_show_make.d"
module doc_reform.meta.metadoc_show_make;
template spineShowMake() {
  @safe void spineShowMake(T)(
    T  doc_matters,
  ) {
    <<metadoc_show_summary_imports>>
    <<metadoc_show_imports_shared>>
    mixin InternalMarkup;
    <<metadoc_show_initialize>>
    if (doc_matters.opt.action.show_make
      && doc_matters.opt.action.debug_do
    ) {
      writeln(doc_matters.conf_make_meta.make);
    }
    if (doc_matters.opt.action.show_make) {
      <<meta_metadoc_show_make>>
    }
  }
}
#+END_SRC

** show make

#+NAME: meta_metadoc_show_make
#+BEGIN_SRC d
writefln(
  "%s\n\"%s\", %s\n%s\n%s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n",
  markup.repeat_character_by_number_provided("-", char_repeat_number),
  doc_matters.conf_make_meta.meta.title_full,
  doc_matters.conf_make_meta.meta.creator_author,
  doc_matters.src.filename,
  markup.repeat_character_by_number_provided("-", char_repeat_number),
  "- bold:",
  doc_matters.conf_make_meta.make.bold,
  "- breaks:",
  doc_matters.conf_make_meta.make.breaks,
  "- cover image:",
  doc_matters.conf_make_meta.make.cover_image,
  "- css:",
  doc_matters.conf_make_meta.make.css,
  "- emphasis:",
  doc_matters.conf_make_meta.make.emphasis,
  "- css:",
  doc_matters.conf_make_meta.make.css,
  "- footer:",
  doc_matters.conf_make_meta.make.footer,
  "- headings:",
  doc_matters.conf_make_meta.make.headings,
  "- home button image:",
  doc_matters.conf_make_meta.make.home_button_image,
  "- home button text:",
  doc_matters.conf_make_meta.make.home_button_text,
  "- italics:",
  doc_matters.conf_make_meta.make.italics,
  "- auto num top at level:",
  doc_matters.conf_make_meta.make.auto_num_top_at_level,
  "- auto num top level:",
  doc_matters.conf_make_meta.make.auto_num_top_lv,
  "- auto num depth:",
  doc_matters.conf_make_meta.make.auto_num_depth,
  "- texpdf font:",
  doc_matters.conf_make_meta.make.texpdf_font,
);
#+END_SRC

* show metadata
** _module template_ show metadata
--show-metadata (show document metadata)

#+BEGIN_SRC d :tangle "../src/doc_reform/meta/metadoc_show_metadata.d"
module doc_reform.meta.metadoc_show_metadata;
template spineShowMetaData() {
  @safe void spineShowMetaData(T)(
    T  doc_matters,
  ) {
    <<metadoc_show_summary_imports>>
    <<metadoc_show_imports_shared>>
    mixin InternalMarkup;
    <<metadoc_show_initialize>>
    if (doc_matters.opt.action.show_metadata
      && doc_matters.opt.action.debug_do
    ) {
      writeln(doc_matters.conf_make_meta.meta);
    }
    if (doc_matters.opt.action.show_metadata) {
      <<meta_metadoc_show_metadata>>
    }
  }
}
#+END_SRC

** show metadata

#+NAME: meta_metadoc_show_metadata
#+BEGIN_SRC d
writefln(
  "%s\n\"%s\", %s\n%s\n%s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n%40-s%10-s\n",
  markup.repeat_character_by_number_provided("-", char_repeat_number),
  doc_matters.conf_make_meta.meta.title_full,
  doc_matters.conf_make_meta.meta.creator_author,
  doc_matters.src.filename,
  markup.repeat_character_by_number_provided("-", char_repeat_number),
  "- author:",
  doc_matters.conf_make_meta.meta.creator_author,
  "- author array:",
  doc_matters.conf_make_meta.meta.creator_author_arr,
  "- author surname:",
  doc_matters.conf_make_meta.meta.creator_author_surname,
  "- author email:",
  doc_matters.conf_make_meta.meta.creator_author_email,
  "- illustrator:",
  doc_matters.conf_make_meta.meta.creator_illustrator,
  "- translator:",
  doc_matters.conf_make_meta.meta.creator_translator,
  "- title full:",
  doc_matters.conf_make_meta.meta.title_full,
  "- title main:",
  doc_matters.conf_make_meta.meta.title_main,
  "- title sub:",
  doc_matters.conf_make_meta.meta.title_subtitle,
  "- title edition:",
  doc_matters.conf_make_meta.meta.title_edition,
  "- title language:",
  doc_matters.conf_make_meta.meta.title_language,
  "- title note:",
  doc_matters.conf_make_meta.meta.title_note,
  "- classify dewey:",
  doc_matters.conf_make_meta.meta.classify_dewey,
  "- classify library of congress:",
  doc_matters.conf_make_meta.meta.classify_loc,
  "- classify keywords:",
  doc_matters.conf_make_meta.meta.classify_keywords,
  "- classify topic register:",
  doc_matters.conf_make_meta.meta.classify_topic_register,
  "- date added to site:",
  doc_matters.conf_make_meta.meta.date_added_to_site,
  "- date available:",
  doc_matters.conf_make_meta.meta.date_available,
  "- date created:",
  doc_matters.conf_make_meta.meta.date_created,
  "- date issued:",
  doc_matters.conf_make_meta.meta.date_issued,
  "- date modified:",
  doc_matters.conf_make_meta.meta.date_modified,
  "- date published:",
  doc_matters.conf_make_meta.meta.date_published,
  "- date valid:",
  doc_matters.conf_make_meta.meta.date_valid,
  // links
  "- notes abstract:",
  doc_matters.conf_make_meta.meta.notes_abstract,
  "- notes description:",
  doc_matters.conf_make_meta.meta.notes_description,
  "- original language:",
  doc_matters.conf_make_meta.meta.original_language,
  "- original language character:",
  doc_matters.conf_make_meta.meta.original_language_char,
  "- original source:",
  doc_matters.conf_make_meta.meta.original_source,
  "- original title:",
  doc_matters.conf_make_meta.meta.original_title,
  // publisher
  "- rights copyright:",
  doc_matters.conf_make_meta.meta.rights_copyright,
  "- rights copyright text:",
  doc_matters.conf_make_meta.meta.rights_copyright_text,
  "- rights copyright audio:",
  doc_matters.conf_make_meta.meta.rights_copyright_audio,
  "- rights copyright cover:",
  doc_matters.conf_make_meta.meta.rights_copyright_cover,
  "- rights copyright illustrations:",
  doc_matters.conf_make_meta.meta.rights_copyright_illustrations,
  "- rights copyright photographs:",
  doc_matters.conf_make_meta.meta.rights_copyright_photographs,
  "- rights copyright translation:",
  doc_matters.conf_make_meta.meta.rights_copyright_translation,
  "- rights copyright video:",
  doc_matters.conf_make_meta.meta.rights_copyright_video,
  "- rights license:",
  doc_matters.conf_make_meta.meta.rights_license,
);
#+END_SRC

* shared init ?
** init

*** imports

#+NAME: metadoc_show_imports_shared
#+BEGIN_SRC d
import
  std.array,
  std.exception,
  std.regex,
  std.stdio,
  std.string,
  std.typecons,
  std.uni,
  std.utf,
  std.conv : to;
#+END_SRC

*** imports

#+NAME: metadoc_show_summary_imports
#+BEGIN_SRC d
import
  doc_reform.meta.defaults,
  doc_reform.meta.rgx;
#+END_SRC

*** initialize                                                     :report:

#+NAME: metadoc_show_initialize
#+BEGIN_SRC d
auto markup = InlineMarkup();
auto min_repeat_number = 66;
auto char_repeat_number = (doc_matters.conf_make_meta.meta.title_full.length
  + doc_matters.conf_make_meta.meta.creator_author.length + 4);
char_repeat_number = (char_repeat_number > min_repeat_number)
? char_repeat_number
: min_repeat_number;
#+END_SRC