-
Notifications
You must be signed in to change notification settings - Fork 1
/
CChtmlExport.py
1563 lines (1230 loc) · 88 KB
/
CChtmlExport.py
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
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__license__ = """
CChtmlExport
Author: https://twitter.com/1_mod_m/
Project site: https://github.com/1modm
Copyright (c) 2016, MM
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of copyright holders nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
"""
#------------------------------------------------------------------------------
# Modules
#------------------------------------------------------------------------------
import os
import sys
import hashlib
from datetime import datetime
import sqlite3
import shutil
from thirdparty.color.termcolor import colored
#------------------------------------------------------------------------------
# Plugins
#------------------------------------------------------------------------------
from lib.htmloutput import htmlaudit, htmlend, htmllast, create_html_file,\
create_blank_html_file, htmldatadashboard,\
htmldatadashboardjs, htmldashboardend
from lib.txtoutput import create_txt_file
from lib.output import print_results, print_titles, print_results_list, print_results_item,\
print_results_list_end, print_titles_subclase, print_results_figure,\
print_results_table, print_results_table_end, print_results_rowth, print_results_rowtd,\
print_results_tr, print_results_tr_end, print_results_aclass, print_titles_aclass,\
print_results_list_aclass, print_results_item_aclass, print_results_list_end_aclass,\
print_results_list_aclass_child6, print_results_item_aclass_child6, print_results_list_end_aclass_child6,\
print_results_list_aclass_child7, print_results_item_aclass_child7, print_results_list_end_aclass_child7,\
print_results_aclass_child4, print_results_aclass_child5
#------------------------------------------------------------------------------
# Python version check.
#------------------------------------------------------------------------------
if __name__ == "__main__":
if sys.version_info < (2, 7) or sys.version_info >= (3, 0):
show_banner()
print ("[!] You must use Python version 2.7 or above")
sys.exit(1)
try:
import argparse
except ImportError:
print 'argparse required. Install using `pip install argparse`'
sys.exit(1)
#------------------------------------------------------------------------------
# Command line parser using argparse
#------------------------------------------------------------------------------
def cmdline_parser():
parser = argparse.ArgumentParser(conflict_handler='resolve', add_help=True,
description='Example: python %(prog)s data/ccdb.sqlite3', version='CChtmlExport 0.1',
usage="python %(prog)s [OPTIONS]")
# Mandatory
parser.add_argument('database', action="store")
parser.add_argument('-ask', action='store_true', default=False, dest='ask')
return parser
###############################################################################
#------------------------------------------------------------------------------
# Class DatabaseManager
#------------------------------------------------------------------------------
###############################################################################
class DatabaseManager(object):
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.conn.execute('pragma foreign_keys = on')
self.conn.commit()
self.cur = self.conn.cursor()
def query(self, arg):
self.cur.execute(arg)
self.conn.commit()
return self.cur
def __del__(self):
self.conn.close()
###############################################################################
#------------------------------------------------------------------------------
# Class Iterate
#------------------------------------------------------------------------------
###############################################################################
class Iterate(object):
def search(self, row, filenamedb, cc1, cc2, cc3, cem, outputdirectory):
ParseChildSearch = ParseChild()
dbmgr1 = DatabaseManager(filenamedb)
dbmgr2 = DatabaseManager(filenamedb)
dbmgr3 = DatabaseManager(filenamedb)
dbmgr4 = DatabaseManager(filenamedb)
dbmgr5 = DatabaseManager(filenamedb)
dbmgr6 = DatabaseManager(filenamedb)
dbmgr7 = DatabaseManager(filenamedb)
dbmgr8 = DatabaseManager(filenamedb)
dbmgr9 = DatabaseManager(filenamedb)
dbmgr10 = DatabaseManager(filenamedb)
dbmgrbiblioentry = DatabaseManager(filenamedb)
dbmgrpara1 = DatabaseManager(filenamedb)
dbmgrpara2 = DatabaseManager(filenamedb)
dbmgrpara3 = DatabaseManager(filenamedb)
dbmgrpara4 = DatabaseManager(filenamedb)
dbmgritem = DatabaseManager(filenamedb)
dbmgrlist= DatabaseManager(filenamedb)
child2_query = 'SELECT id, parentkey, idelement, title, name, paratext, element, entity, width, height FROM child2 WHERE parentkey = '+str(row[0]) +' ORDER BY id'
for row2 in dbmgr2.query(child2_query):
ParseChildSearch.child2_to_html(row[3], dbmgrbiblioentry, dbmgrpara1, row2, cc1, cc2, cc3, cem, outputdirectory)
child3_query = 'SELECT id, parentkey, idelement, title, name, paratext, element, entity, width, height FROM child3 WHERE parentkey = '+str(row2[0])+' ORDER BY id'
for row3 in dbmgr3.query(child3_query):
ParseChildSearch.child3_to_html(row[3], row2[6], dbmgrbiblioentry, dbmgrpara1, dbmgrpara2, dbmgrpara3, dbmgrpara4, dbmgritem, dbmgrlist, row3,cc1, cc2, cc3, cem, outputdirectory)
child4_query = 'SELECT id, parentkey, idelement, title, name, paratext, element, entity, width, height FROM child4 WHERE parentkey = '+str(row3[0])+' ORDER BY id'
for row4 in dbmgr4.query(child4_query):
ParseChildSearch.child4_to_html(row[3], row2[6], row3[6], dbmgrbiblioentry, dbmgrpara1, dbmgrpara2, dbmgrpara3, dbmgrpara4, dbmgritem, dbmgrlist, row4, cc1, cc2, cc3, cem, outputdirectory)
child5_query = 'SELECT id, parentkey, idelement, title, name, paratext, element, entity, width, height FROM child5 WHERE parentkey = '+str(row4[0])+' ORDER BY id'
for row5 in dbmgr5.query(child5_query):
ParseChildSearch.child5_to_html(row[3], row2[6], row3[6], row4[6], dbmgrbiblioentry, dbmgrpara1, dbmgrpara2, dbmgrpara3, dbmgrpara4, dbmgritem, dbmgrlist, row5, cc1, cc2, cc3, cem, outputdirectory)
child6_query = 'SELECT id, parentkey, idelement, title, paratext, element, entity FROM child6 WHERE parentkey = '+str(row5[0])+' ORDER BY id'
for row6 in dbmgr6.query(child6_query):
ParseChildSearch.child6_to_html(row[3], row2[6], row3[6], row4[6], row5[5], dbmgrbiblioentry, dbmgrpara1, dbmgrpara2, dbmgrpara3, dbmgrpara4, dbmgritem, dbmgrlist, row6, cc1, cc2, cc3, cem, outputdirectory)
child7_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child7 WHERE parentkey = '+str(row6[0])+' ORDER BY id'
for row7 in dbmgr7.query(child7_query):
ParseChildSearch.child7_to_html(row[3], row2[6], row3[6], row4[6], row5[5], row6[5], dbmgrbiblioentry, dbmgrpara1, dbmgrpara2, dbmgrpara3, dbmgrpara4, dbmgritem, dbmgrlist, row7, cc1, cc2, cc3, cem, outputdirectory)
child8_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child8 WHERE parentkey = '+str(row7[0])+' ORDER BY id'
for row8 in dbmgr8.query(child8_query):
ParseChildSearch.child8_to_html(row[3], row2[6], row3[6], row4[6], row5[5], row6[5], row7[5], dbmgrbiblioentry, dbmgrpara1, dbmgrpara2, dbmgrpara3, dbmgrpara4, dbmgritem, dbmgrlist, row8, cc1, cc2, cc3, cem, outputdirectory)
child9_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child9 WHERE parentkey = '+str(row8[0])+' ORDER BY id'
for row9 in dbmgr9.query(child9_query):
ParseChildSearch.child9_to_html(row[3], row2[6], row3[6], row4[6], row5[5], row6[5], row7[5], row8[5],dbmgrbiblioentry, dbmgrpara1, dbmgrpara2, dbmgrpara3, dbmgrpara4, dbmgritem, dbmgrlist, row9, cc1, cc2, cc3, cem, outputdirectory)
child10_query = 'SELECT id, parentkey, idelement, paratext, element FROM child10 WHERE parentkey = '+str(row9[0])+' ORDER BY id'
for row10 in dbmgr10.query(child10_query):
ParseChildSearch.child10_to_html(row[3], row2[6], row3[6], row4[6], row5[5], row6[5], row7[5], row8[5], row9[4], dbmgrbiblioentry, dbmgrpara1, dbmgrpara2, dbmgrpara3, dbmgrpara4, dbmgritem, dbmgrlist, row10, cc1, cc2, cc3, cem, outputdirectory)
###############################################################################
#------------------------------------------------------------------------------
# Class ParseChild
#------------------------------------------------------------------------------
###############################################################################
class ParseChild(object):
def child1_to_html(self, rowquery, cc1, cc2, cc3, cem, outputdirectory):
if (rowquery[1]):
child1_title = str(rowquery[1])
elif (rowquery[2]):
child1_title = str(rowquery[2])
else:
child1_title = str(rowquery[3])
if ((rowquery[0]) == 69):
child1_title = "Evaluation assurance level 1 (EAL1) - " + child1_title
elif ((rowquery[0]) == 70):
child1_title = "Evaluation assurance level 2 (EAL2) - " + child1_title
elif ((rowquery[0]) == 71):
child1_title = "Evaluation assurance level 3 (EAL3) - " + child1_title
elif ((rowquery[0]) == 72):
child1_title = "Evaluation assurance level 4 (EAL4) - " + child1_title
elif ((rowquery[0]) == 73):
child1_title = "Evaluation assurance level 5 (EAL5) - " + child1_title
elif ((rowquery[0]) == 74):
child1_title = "Evaluation assurance level 6 (EAL6) - " + child1_title
elif ((rowquery[0]) == 75):
child1_title = "Evaluation assurance level 7 (EAL7) - " + child1_title
elif ((rowquery[0]) == 76):
child1_title = "Composition assurance level A (CAP-A) - " + child1_title
elif ((rowquery[0]) == 77):
child1_title = "Composition assurance level B (CAP-B) - " + child1_title
elif ((rowquery[0]) == 78):
child1_title = "Composition assurance level C (CAP-C) - " + child1_title
elif ((rowquery[0]) == 65):
child1_title = "Class APE: " + child1_title
elif ((rowquery[0]) == 66):
child1_title = "Class ASE: " + child1_title
elif ((rowquery[0]) == 62):
child1_title = "Class ADV: " + child1_title
elif ((rowquery[0]) == 63):
child1_title = "Class AGD: " + child1_title
elif ((rowquery[0]) == 64):
child1_title = "Class ALC: " + child1_title
elif ((rowquery[0]) == 67):
child1_title = "Class ATE: " + child1_title
elif ((rowquery[0]) == 68):
child1_title = "Class AVA: " + child1_title
elif ((rowquery[0]) == 61):
child1_title = "Class ACO: " + child1_title
elif ((rowquery[0]) == 7):
child1_title = "ANNEX A: " + child1_title
elif ((rowquery[0]) == 6):
child1_title = "ANNEX B: " + child1_title
elif ((rowquery[0]) == 50):
child1_title = "CLASS FAU: " + child1_title
elif ((rowquery[0]) == 51):
child1_title = "CLASS FCO: " + child1_title
elif ((rowquery[0]) == 52):
child1_title = "CLASS FCS: " + child1_title
elif ((rowquery[0]) == 53):
child1_title = "CLASS FDP: " + child1_title
elif ((rowquery[0]) == 54):
child1_title = "CLASS FIA: " + child1_title
elif ((rowquery[0]) == 55):
child1_title = "CLASS FMT: " + child1_title
elif ((rowquery[0]) == 56):
child1_title = "CLASS FPR: " + child1_title
elif ((rowquery[0]) == 57):
child1_title = "CLASS FPT: " + child1_title
elif ((rowquery[0]) == 58):
child1_title = "CLASS FRU: " + child1_title
elif ((rowquery[0]) == 59):
child1_title = "CLASS FTA: " + child1_title
elif ((rowquery[0]) == 60):
child1_title = "CLASS FTP: " + child1_title
elif ((rowquery[0]) == 22):
child1_title = "ANNEX A: " + child1_title
elif ((rowquery[0]) == 10):
child1_title = "ANNEX B: " + child1_title
print_titles(child1_title, "href", cc1, cc2, cc3, cem, outputdirectory)
return (child1_title)
#------------------------------------------------------------------------------
def child2_to_html(self, element1, dbmgrbiblioentry, dbmgrpara1, row2, cc1, cc2, cc3, cem, outputdirectory):
if ((row2[6]) == "biblioentry"): # element
child2_biblioentry_query = 'SELECT id, parentkey, idelement, title, name, paratext, element FROM child3 WHERE parentkey = '+str(row2[0])+' ORDER BY id'
for row_biblioentry in dbmgrbiblioentry.query(child2_biblioentry_query):
if ((row_biblioentry[6]) == "biblioterm"): # element
child2_biblioentry_text = (row_biblioentry[5]).encode('utf-8') # item
print_results(child2_biblioentry_text, cc1, cc2, cc3, cem, outputdirectory)
if ((row_biblioentry[6]) == "bibliodef"): # element
child2_biblioentry_text = (row_biblioentry[5]).encode('utf-8') # item
print_results(child2_biblioentry_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row2[6]) == "item"): # element
child2_text = ""
elif ((row2[6]) == "xref"): # element
child2_text = ""
elif ((row2[6]) == "acronym"): # element
child2_text = ""
elif ((row2[6]) == "eal-component"): # element
child2_text = (row2[5]).encode('utf-8') # acomponent
print_results_item(child2_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row2[6]) == "cap-component"): # element
child2_text = (row2[5]).encode('utf-8') # acomponent
print_results_item(child2_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row2[6]) == "glossentry"): # element
if ((row2[5]).encode('utf-8') != ""):
child2_text = "<b> " + (row2[5]).encode('utf-8') + ": </b> "
print_results(child2_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row2[6]) == "glossterm"): # element
child2_text = "<b> " + (row2[5]).encode('utf-8') + ": </b> "
print_results(child2_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row2[6]) == "glossdef"): # element
child2_text = (row2[5]).encode('utf-8') # acomponent
child3_para_query = 'SELECT id, parentkey, idelement, title, name, paratext, element FROM child3 WHERE parentkey = '+str(row2[0])+' ORDER BY id'
for para_row_3 in dbmgrpara1.query(child3_para_query):
if ((para_row_3[6]) == "bold"):
child2_text += "<b> " + (para_row_3[5]).encode('utf-8') + " </b>"
if ((para_row_3[6]) == "italic"):
child2_text += "<i> " + (para_row_3[5]).encode('utf-8') + " </i>"
if ((para_row_3[6]) == "xref"):
child2_text += (para_row_3[5]).encode('utf-8') # paratext
print_results(child2_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row2[6]) == "glossnote"): # element
child2_text = (row2[5]).encode('utf-8') # acomponent
print_results(child2_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row2[6]) == "para"): # element
child2_text = (row2[5]).encode('utf-8') # paratext
child3_para_query = 'SELECT id, parentkey, idelement, title, name, paratext, element FROM child3 WHERE parentkey = '+str(row2[0])+' ORDER BY id'
for para_row_3 in dbmgrpara1.query(child3_para_query):
if ((para_row_3[6]) == "bold"):
child2_text += "<b> " + (para_row_3[5]).encode('utf-8') + " </b>"
if ((para_row_3[6]) == "italic"):
child2_text += "<i> " + (para_row_3[5]).encode('utf-8') + " </i>"
if ((para_row_3[6]) == "xref"):
child2_text += (para_row_3[5]).encode('utf-8') # paratext
print_results(child2_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row2[6]) == "figure"): # element
figure_title = (row2[3]).encode('utf-8')
figure_entity = (row2[7]).encode('utf-8')
figure_width = (row2[8]).encode('utf-8')
figure_height = (row2[9]).encode('utf-8')
print_results_figure(figure_title, figure_entity, figure_width, figure_height, cc1, cc2, cc3, cem, outputdirectory)
elif ((row2[6]) == "subclause"): # element
child2_text = str(row2[3]) #title
print_titles_subclase(child2_text, "href", cc1, cc2, cc3, cem, outputdirectory)
elif (row2[3]):
child2_text = str(row2[3]) #title
print_titles(child2_text, "href", cc1, cc2, cc3, cem, outputdirectory)
elif (row2[4]):
child2_text = str(row2[4]) #name
print_titles(child2_text, "href", cc1, cc2, cc3, cem, outputdirectory)
else:
child2_text = str(row2[2])
#print_results(child2_text, cc1, cc2, cc3, cem, outputdirectory)
#------------------------------------------------------------------------------
def child3_to_html(self, element1, element2, dbmgrbiblioentry, dbmgrpara1, dbmgrpara2, dbmgrpara3, dbmgrpara4, dbmgritem, dbmgrlist, row3, cc1, cc2, cc3, cem, outputdirectory):
if ((row3[6]) == "item"): # element
child3_text = ""
elif ((row3[6]) == "a-component"): # element
child3_text = "<b> Evaluation of sub-activity (" + (row3[5]).encode('utf-8') + ")</b> "
print_results(child3_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row3[6]) == "glossentry"): # element
if ((row3[5]).encode('utf-8') != ""):
child3_text = "<b> " + (row3[5]).encode('utf-8') + ": </b> "
print_results(child3_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row3[6]) == "acronymterm"): # element
child3_text = (row3[5]).encode('utf-8')
print_results(child3_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row3[6]) == "acronymdef"): # element
child3_text = (row3[5]).encode('utf-8')
print_results(child3_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row3[6]) == "glossterm"): # element
child3_text = "<b> " + (row3[5]).encode('utf-8') + ": </b> "
print_results(child3_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row3[6]) == "glossdef"): # element
child3_text = (row3[5]).encode('utf-8') # acomponent
child4_para_query = 'SELECT id, parentkey, idelement, title, name, paratext, element FROM child4 WHERE parentkey = '+str(row3[0])+' ORDER BY id'
for para_row_4 in dbmgrpara1.query(child4_para_query):
if ((para_row_4[6]) == "bold"):
child3_text += "<b> " + (para_row_4[5]).encode('utf-8') + " </b>"
if ((para_row_4[6]) == "italic"):
child3_text += "<i> " + (para_row_4[5]).encode('utf-8') + " </i>"
if ((para_row_4[6]) == "xref"):
child3_text += (para_row_4[5]).encode('utf-8') # paratext
print_results(child3_text, cc1, cc2, cc3, cem, outputdirectory)
elif (((row3[6]) == "glossnote") or ((row3[6]) == "glossalt") or ((row3[6]) == "glosssource")): # element
child3_text = (row3[5]).encode('utf-8') # acomponent
child4_para_query = 'SELECT id, parentkey, idelement, title, name, paratext, element FROM child4 WHERE parentkey = '+str(row3[0])+' ORDER BY id'
for para_row_4 in dbmgrpara1.query(child4_para_query):
if ((para_row_4[6]) == "bold"):
child3_text += "<b> " + (para_row_4[5]).encode('utf-8') + " </b>"
if ((para_row_4[6]) == "italic"):
child3_text += "<i> " + (para_row_4[5]).encode('utf-8') + " </i>"
if ((para_row_4[6]) == "xref"):
child3_text += (para_row_4[5]).encode('utf-8') # paratext
child5_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child5 WHERE parentkey = '+str(para_row_4[0])+' ORDER BY id'
for para_row_5 in dbmgrpara2.query(child5_para_query):
if ((para_row_5[5]) == "bold"):
child3_text += "<b> " + (para_row_5[4]).encode('utf-8') + " </b>"
if ((para_row_5[5]) == "italic"):
child3_text += "<i> " + (para_row_5[4]).encode('utf-8') + " </i>"
if ((para_row_5[5]) == "xref"):
child3_text += (para_row_5[4]).encode('utf-8') # paratext
print_results(child3_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row3[6]) == "table"): # element
child3_text = ""
print_results_table(cc1, cc2, cc3, cem, outputdirectory)
#<table border="1">
child4_para_query = 'SELECT id, parentkey, idelement, title, name, paratext, element FROM child4 WHERE parentkey = '+str(row3[0])+' ORDER BY id'
for para_row_4 in dbmgrpara1.query(child4_para_query):
if ((para_row_4[6]) == "title"): # element
child3_text += (para_row_4[5]).encode('utf-8') # paratext
# TITLE
if ((para_row_4[6]) == "tgroup"): # element
child3_table_text = ""
child5_item_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child5 WHERE parentkey = '+str(para_row_4[0])+' ORDER BY id'
for para_item_5 in dbmgritem.query(child5_item_query):
if ((para_item_5[5]) == "thead"): # element
child8_extra_row = 0
child6_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child6 WHERE parentkey = '+str(para_item_5[0])+' ORDER BY id'
for para_item_6 in dbmgrpara2.query(child6_para_query):
if ((para_item_6[5]) == "row"): # element
#<tr>
print_results_tr(cc1, cc2, cc3, cem, outputdirectory)
if (child8_extra_row == 1 ):
print_results_rowth("", "1", cc1, cc2, cc3, cem, outputdirectory)
child8_extra_row = 0
child7_para_query = 'SELECT id, parentkey, idelement, title, paratext, element, columnspan FROM child7 WHERE parentkey = '+str(para_item_6[0])+' ORDER BY id'
for para_item_7 in dbmgrpara3.query(child7_para_query):
columnspan = 1
if ((para_item_7[5]) == "entry"): # element
child7_text_row = ""
child7_text_row += (para_item_7[4]).encode('utf-8') # paratext
if (child7_text_row == ""): child8_extra_row = 1
if ((para_item_7[6]).encode('utf-8')): columnspan = (para_item_7[6]).encode('utf-8')
child8_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child8 WHERE parentkey = '+str(para_item_7[0])+' ORDER BY id'
for para_row_8 in dbmgrpara4.query(child8_para_query):
if ((para_row_8[5]) == "bold"):
child7_text_row += "<b> " + (para_row_8[4]).encode('utf-8') + " </b>"
if ((para_row_8[5]) == "italic"):
child7_text_row += "<i> " + (para_row_8[4]).encode('utf-8') + " </i>"
if ((para_row_8[5]) == "xref"):
child7_text_row += (para_row_8[4]).encode('utf-8') # paratext
#<th>row</th>
print_results_rowth(child7_text_row, columnspan, cc1, cc2, cc3, cem, outputdirectory)
#</tr>
print_results_tr_end(cc1, cc2, cc3, cem, outputdirectory)
if ((para_item_5[5]) == "tbody"): # element
child3_table_text += (para_item_5[4]).encode('utf-8') # paratext
child6_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child6 WHERE parentkey = '+str(para_item_5[0])+' ORDER BY id'
for para_item_6 in dbmgrpara1.query(child6_para_query):
if ((para_item_6[5]) == "row"): # element
#<tr>
print_results_tr(cc1, cc2, cc3, cem, outputdirectory)
child7_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child7 WHERE parentkey = '+str(para_item_6[0])+' ORDER BY id'
for para_item_7 in dbmgrpara2.query(child7_para_query):
if ((para_item_7[5]) == "entry"): # element
child7_text_row = ""
child7_text_row += (para_item_7[4]).encode('utf-8') # paratext
child8_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child8 WHERE parentkey = '+str(para_item_7[0])+' ORDER BY id'
for para_row_8 in dbmgrpara3.query(child8_para_query):
if ((para_row_8[5]) == "bold"):
child7_text_row += "<b> " + (para_row_8[4]).encode('utf-8') + " </b>"
if ((para_row_8[5]) == "italic"):
child7_text_row += "<i> " + (para_row_8[4]).encode('utf-8') + " </i>"
if ((para_row_8[5]) == "xref"):
child7_text_row += (para_row_8[4]).encode('utf-8') # paratext
#<td>row</td>
print_results_rowtd(child7_text_row, cc1, cc2, cc3, cem, outputdirectory)
#</tr>
print_results_tr_end(cc1, cc2, cc3, cem, outputdirectory)
print_results_table_end(cc1, cc2, cc3, cem, outputdirectory)
# Imprimir titulo tabla
print_results(child3_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row3[6]) == "xref"): # element
#child4_text = (row4[5]).encode('utf-8') # item
child3_text = ""
#print_results(child3_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row3[6]) == "para"): # element
child3_text = (row3[5]).encode('utf-8') # paratext
child4_para_query = 'SELECT id, parentkey, idelement, title, name, paratext, element FROM child4 WHERE parentkey = '+str(row3[0])+' ORDER BY id'
for para_row_4 in dbmgrpara1.query(child4_para_query):
if ((para_row_4[6]) == "bold"):
child3_text += "<b> " + (para_row_4[5]).encode('utf-8') + " </b>"
if ((para_row_4[6]) == "italic"):
child3_text += "<i> " + (para_row_4[5]).encode('utf-8') + " </i>"
if ((para_row_4[6]) == "xref"):
child3_text += (para_row_4[5]).encode('utf-8') # paratext
if ((para_row_4[6]) == "italic" or (para_row_4[6]) == "bold" or (para_row_4[6]) == "xref"): # element
child5_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child5 WHERE parentkey = '+str(para_row_4[0])+' ORDER BY id'
for para_row_5 in dbmgrpara2.query(child5_para_query):
if ((para_row_5[5]) == "bold"):
child3_text += "<b> " + (para_row_5[4]).encode('utf-8') + " </b>"
if ((para_row_5[5]) == "italic"):
child3_text += "<i> " + (para_row_5[4]).encode('utf-8') + " </i>"
if ((para_row_5[5]) == "xref"):
child3_text += (para_row_5[4]).encode('utf-8') # paratext
print_results_aclass(element1, element2, child3_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row3[6]) == "figure"): # element
figure_title = (row3[3]).encode('utf-8')
figure_entity = (row3[7]).encode('utf-8')
figure_width = (row3[8]).encode('utf-8')
figure_height = (row3[9]).encode('utf-8')
print_results_figure(figure_title, figure_entity, figure_width, figure_height, cc1, cc2, cc3, cem, outputdirectory)
elif ((row3[6]) == "list"): # element
print_results_list(cc1, cc2, cc3, cem, outputdirectory)
child3_list_query = 'SELECT id, parentkey, idelement, title, name, paratext, element FROM child4 WHERE parentkey = '+str(row3[0])+' ORDER BY id'
for row33 in dbmgrlist.query(child3_list_query):
if ((row33[6]) == "item"): # element
child3_list_text = (row33[5]).encode('utf-8') # item
child5_para_query = 'SELECT id, parentkey, idelement, title, name, paratext, element FROM child5 WHERE parentkey = '+str(row33[0])+' ORDER BY id'
for para_item_5 in dbmgrpara1.query(child5_para_query):
if ((para_item_5[6]) == "bold"):
child3_list_text += "<b> " + (para_item_5[5]).encode('utf-8') + " </b>"
if ((para_item_5[6]) == "italic"):
child3_list_text += "<i> " + (para_item_5[5]).encode('utf-8') + " </i>"
if ((para_item_5[6]) == "xref"):
child3_list_text += (para_item_5[5]).encode('utf-8') # paratext
print_results_item(child3_list_text, cc1, cc2, cc3, cem, outputdirectory)
print_results_list_end(cc1, cc2, cc3, cem, outputdirectory)
elif ((row3[6]) == "biblioentry"): # element
child3_biblioentry_query = 'SELECT id, parentkey, idelement, title, name, paratext, element FROM child4 WHERE parentkey = '+str(row3[0])+' ORDER BY id'
for row_biblioentry in dbmgrbiblioentry.query(child3_biblioentry_query):
if ((row_biblioentry[6]) == "biblioterm"): # element
child3_biblioentry_text = (row_biblioentry[5]).encode('utf-8') # item
print_results(child3_biblioentry_text, cc1, cc2, cc3, cem, outputdirectory)
if ((row_biblioentry[6]) == "bibliodef"): # element
child3_biblioentry_text = (row_biblioentry[5]).encode('utf-8') # item
print_results(child3_biblioentry_text, cc1, cc2, cc3, cem, outputdirectory)
elif (row3[3]):
child3_text = str(row3[3]) #title
print_titles_aclass(element1, element2, child3_text, "href", cc1, cc2, cc3, cem, outputdirectory)
elif (row3[4]):
child3_text = str(row3[4]) #name
print_titles_aclass(element1, element2, child3_text, "href", cc1, cc2, cc3, cem, outputdirectory)
else:
child3_text = str(row3[2])
#print_results(child3_text, cc1, cc2, cc3, cem, outputdirectory)
#------------------------------------------------------------------------------
def child4_to_html(self, element1, element2, element3, dbmgrbiblioentry, dbmgrpara1, dbmgrpara2, dbmgrpara3, dbmgrpara4, dbmgritem, dbmgrlist, row4, cc1, cc2, cc3, cem, outputdirectory):
if ((row4[6]) == "item"): # element
child4_text = ""
elif ((row4[6]) == "acronymterm"): # element
child4_text = (row4[5]).encode('utf-8') # acomponent
print_results(child4_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row4[6]) == "acronymterm"): # element
child4_text = (row4[5]).encode('utf-8') # acomponent
print_results(child4_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row4[6]) == "glossentry"): # element
if ((row4[5]).encode('utf-8') != ""):
child4_text = "<b> " + (row4[5]).encode('utf-8') + ": </b> "
print_results(child4_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row4[6]) == "glossterm"): # element
child4_text = "<b> " + (row4[5]).encode('utf-8') + ": </b> "
print_results(child4_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row4[6]) == "glossdef"): # element
child4_text = (row4[5]).encode('utf-8') # acomponent
child5_para_query = 'SELECT id, parentkey, idelement, title, name, paratext, element FROM child5 WHERE parentkey = '+str(row4[0])+' ORDER BY id'
for para_row_5 in dbmgrpara2.query(child5_para_query):
if ((para_row_5[6]) == "bold"):
child4_text += "<b> " + (para_row_5[5]).encode('utf-8') + " </b>"
if ((para_row_5[6]) == "italic"):
child4_text += "<i> " + (para_row_5[5]).encode('utf-8') + " </i>"
if ((para_row_5[6]) == "xref"):
child4_text += (para_row_5[5]).encode('utf-8') # paratext
print_results(child4_text, cc1, cc2, cc3, cem, outputdirectory)
elif (((row4[6]) == "glossnote") or ((row4[6]) == "glossalt") or ((row4[6]) == "glosssource")): # element
child4_text = (row4[5]).encode('utf-8') # acomponent
child5_para_query = 'SELECT id, parentkey, idelement, title, name, paratext, element FROM child5 WHERE parentkey = '+str(row4[0])+' ORDER BY id'
for para_row_5 in dbmgrpara2.query(child5_para_query):
if ((para_row_5[6]) == "bold"):
child4_text += "<b> " + (para_row_5[5]).encode('utf-8') + " </b>"
if ((para_row_5[6]) == "italic"):
child4_text += "<i> " + (para_row_5[5]).encode('utf-8') + " </i>"
if ((para_row_5[6]) == "xref"):
child4_text += (para_row_5[5]).encode('utf-8') # paratext
if ((para_row_5[6]) == "italic" or (para_row_5[6]) == "bold" or (para_row_5[6]) == "xref"): # element
child6_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child6 WHERE parentkey = '+str(para_row_5[0])+' ORDER BY id'
for para_row_6 in dbmgrpara3.query(child6_para_query):
if ((para_row_6[5]) == "bold"):
child4_text += "<b> " + (para_row_6[4]).encode('utf-8') + " </b>"
if ((para_row_6[5]) == "italic"):
child4_text += "<i> " + (para_row_6[4]).encode('utf-8') + " </i>"
if ((para_row_6[5]) == "xref"):
child4_text += (para_row_6[4]).encode('utf-8') # paratext
print_results(child4_text, cc1, cc2, cc3, cem, outputdirectory)
elif (((row4[6]) == "f-element")): # element
child4_text = "<b> " + (row4[5]).encode('utf-8') + "</b> "
elif ((row4[6]) == "table"): # element
child4_text = ""
print_results_table(cc1, cc2, cc3, cem, outputdirectory)
#<table border="1">
child5_para_query = 'SELECT id, parentkey, idelement, title, name, paratext, element FROM child5 WHERE parentkey = '+str(row4[0])+' ORDER BY id'
for para_row_5 in dbmgrpara1.query(child5_para_query):
if ((para_row_5[6]) == "title"): # element
child4_text += (para_row_5[5]).encode('utf-8') # paratext
# TITULO TABLA
if ((para_row_5[6]) == "tgroup"): # element
child4_table_text = ""
child6_item_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child6 WHERE parentkey = '+str(para_row_5[0])+' ORDER BY id'
for para_item_6 in dbmgritem.query(child6_item_query):
if ((para_item_6[5]) == "thead"): # element
child9_extra_row = 0
child7_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child7 WHERE parentkey = '+str(para_item_6[0])+' ORDER BY id'
for para_item_7 in dbmgrpara2.query(child7_para_query):
if ((para_item_7[5]) == "row"): # element
#<tr>
print_results_tr(cc1, cc2, cc3, cem, outputdirectory)
if (child9_extra_row == 1 ):
print_results_rowth("", "1", cc1, cc2, cc3, cem, outputdirectory)
child9_extra_row = 0
child8_para_query = 'SELECT id, parentkey, idelement, title, paratext, element, columnspan FROM child8 WHERE parentkey = '+str(para_item_7[0])+' ORDER BY id'
for para_item_8 in dbmgrpara3.query(child8_para_query):
columnspan = 1
if ((para_item_8[5]) == "entry"): # element
child8_text_row = ""
child8_text_row += (para_item_8[4]).encode('utf-8') # paratext
if (child8_text_row == ""): child9_extra_row = 1
if ((para_item_8[6]).encode('utf-8')): columnspan = (para_item_8[6]).encode('utf-8')
child9_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child9 WHERE parentkey = '+str(para_item_8[0])+' ORDER BY id'
for para_row_9 in dbmgrpara4.query(child9_para_query):
if ((para_row_9[5]) == "bold"):
child8_text_row += "<b> " + (para_row_9[4]).encode('utf-8') + " </b>"
if ((para_row_9[5]) == "italic"):
child8_text_row += "<i> " + (para_row_9[4]).encode('utf-8') + " </i>"
if ((para_row_9[5]) == "xref"):
child8_text_row += (para_row_9[4]).encode('utf-8') # paratext
#<th>row</th>
print_results_rowth(child8_text_row, columnspan, cc1, cc2, cc3, cem, outputdirectory)
#</tr>
print_results_tr_end(cc1, cc2, cc3, cem, outputdirectory)
if ((para_item_6[5]) == "tbody"): # element
child4_table_text += (para_item_6[4]).encode('utf-8') # paratext
child7_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child7 WHERE parentkey = '+str(para_item_6[0])+' ORDER BY id'
for para_item_7 in dbmgritem.query(child7_para_query):
if ((para_item_7[5]) == "row"): # element
#<tr>
print_results_tr(cc1, cc2, cc3, cem, outputdirectory)
child8_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child8 WHERE parentkey = '+str(para_item_7[0])+' ORDER BY id'
for para_item_8 in dbmgrpara1.query(child8_para_query):
if ((para_item_8[5]) == "entry"): # element
child8_text_row = ""
child8_text_row += (para_item_8[4]).encode('utf-8') # paratext
child9_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child9 WHERE parentkey = '+str(para_item_8[0])+' ORDER BY id'
for para_row_9 in dbmgrpara2.query(child9_para_query):
if ((para_row_9[5]) == "bold"):
child8_text_row += "<b> " + (para_row_9[4]).encode('utf-8') + " </b>"
if ((para_row_9[5]) == "italic"):
child8_text_row += "<i> " + (para_row_9[4]).encode('utf-8') + " </i>"
if ((para_row_9[5]) == "xref"):
child8_text_row += (para_row_9[4]).encode('utf-8') # paratext
#<td>row</td>
print_results_rowtd(child8_text_row, cc1, cc2, cc3, cem, outputdirectory)
#</tr>
print_results_tr_end(cc1, cc2, cc3, cem, outputdirectory)
print_results_table_end(cc1, cc2, cc3, cem, outputdirectory)
print_results(child4_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row4[6]) == "xref"): # element
child4_text = ""
elif ((row4[6]) == "para"): # element
child4_text = (row4[5]).encode('utf-8') # paratext
child5_para_query = 'SELECT id, parentkey, idelement, title, name, paratext, element FROM child5 WHERE parentkey = '+str(row4[0])+' ORDER BY id'
for para_row_5 in dbmgrpara2.query(child5_para_query):
if ((para_row_5[6]) == "bold"):
child4_text += "<b> " + (para_row_5[5]).encode('utf-8') + " </b>"
if ((para_row_5[6]) == "italic"):
child4_text += "<i> " + (para_row_5[5]).encode('utf-8') + " </i>"
if ((para_row_5[6]) == "xref"):
child4_text += (para_row_5[5]).encode('utf-8') # paratext
if ((para_row_5[6]) == "italic" or (para_row_5[6]) == "bold" or (para_row_5[6]) == "xref"): # element
child6_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child6 WHERE parentkey = '+str(para_row_5[0])+' ORDER BY id'
for para_row_6 in dbmgrpara3.query(child6_para_query):
if ((para_row_6[5]) == "bold"):
child4_text += "<b> " + (para_row_6[4]).encode('utf-8') + " </b>"
if ((para_row_6[5]) == "italic"):
child4_text += "<i> " + (para_row_6[4]).encode('utf-8') + " </i>"
if ((para_row_6[5]) == "xref"):
child4_text += (para_row_6[4]).encode('utf-8') # paratext
print_results_aclass_child4(element1, element2, element3, child4_text, cc1, cc2, cc3, cem, outputdirectory) # ase-app-reuse-pp2
elif ((row4[6]) == "ae-developer"): # element
child4_text = "<b>" + (row4[5]).encode('utf-8') + "</b>"
print_results_aclass_child4(element1, element2, element3, child4_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row4[6]) == "ae-content"): # element
child4_text = "<b>" + (row4[5]).encode('utf-8') + "</b>"
print_results_aclass_child4(element1, element2, element3, child4_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row4[6]) == "ae-evaluator"): # element
child4_text = "<b>" + (row4[5]).encode('utf-8') + "</b>"
print_results_aclass_child4(element1, element2, element3, child4_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row4[6]) == "ae-dc-element"): # element
child4_text = (row4[5]).encode('utf-8') # paratext
print_results_aclass_child4(element1, element2, element3, child4_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row4[6]) == "figure"): # element
figure_title = (row4[3]).encode('utf-8')
figure_entity = (row4[7]).encode('utf-8')
figure_width = (row4[8]).encode('utf-8')
figure_height = (row4[9]).encode('utf-8')
print_results_figure(figure_title, figure_entity, figure_width, figure_height, cc1, cc2, cc3, cem, outputdirectory)
elif ((row4[6]) == "equation"): # element
figure_title = (row4[3]).encode('utf-8')
figure_entity = (row4[7]).encode('utf-8')
figure_width = (row4[8]).encode('utf-8')
figure_height = (row4[9]).encode('utf-8')
print_results_figure(figure_title, figure_entity, figure_width, figure_height, cc1, cc2, cc3, cem, outputdirectory)
elif ((row4[6]) == "list"): # element
print_results_list_aclass(element1, element2, cc1, cc2, cc3, cem, outputdirectory)
child4_list_query = 'SELECT id, parentkey, idelement, title, name, paratext, element FROM child5 WHERE parentkey = '+str(row4[0])+' ORDER BY id'
for row_c4 in dbmgrlist.query(child4_list_query):
if ((row_c4[6]) == "item"): # element
child4_list_text = (row_c4[5]).encode('utf-8') # item
child6_item_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child6 WHERE parentkey = '+str(row_c4[0])+' ORDER BY id'
for para_item_6 in dbmgritem.query(child6_item_query):
if ((para_item_6[5]) == "bold"):
child4_list_text += "<b> " + (para_item_6[4]).encode('utf-8') + " </b>"
if ((para_item_6[5]) == "italic"):
child4_list_text += "<i> " + (para_item_6[4]).encode('utf-8') + " </i>"
if ((para_item_6[5]) == "xref"):
child4_list_text += (para_item_6[4]).encode('utf-8') # paratext
elif ((para_item_6[5]) == "url"): # element
child4_list_text += " " + (para_item_6[2]).encode('utf-8') + " " # idelement
child4_list_text += (para_item_6[4]).encode('utf-8') # paratext
print_results_item_aclass(element1, element2, child4_list_text, cc1, cc2, cc3, cem, outputdirectory)
#--------------------------------------------
child6_item_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child6 WHERE parentkey = '+str(row_c4[0])+' ORDER BY id'
for para_item_6 in dbmgritem.query(child6_item_query):
if ((para_item_6[5]) == "list"): # element
print_results_list_aclass(element1, element2,cc1, cc2, cc3, cem, outputdirectory)
child7_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child7 WHERE parentkey = '+str(para_item_6[0])+' ORDER BY id'
for para_item_7 in dbmgrpara1.query(child7_para_query):
if ((para_item_7[5]) == "item"): # element
child7_text = (para_item_7[4]).encode('utf-8') # paratext
child8_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child8 WHERE parentkey = '+str(para_item_7[0])+' ORDER BY id'
for para_row_8 in dbmgrpara2.query(child8_para_query):
if ((para_row_8[5]) == "bold"):
child7_text += "<b> " + (para_row_8[4]).encode('utf-8') + " </b>"
if ((para_row_8[5]) == "italic"):
child7_text += "<i> " + (para_row_8[4]).encode('utf-8') + " </i>"
if ((para_row_8[5]) == "xref"):
child7_text += (para_row_8[4]).encode('utf-8') # paratext
print_results_item_aclass(element1, element2, child7_text, cc1, cc2, cc3, cem, outputdirectory)
print_results_list_end_aclass(element1, element2, cc1, cc2, cc3, cem, outputdirectory)
#--------------------------------------------
print_results_list_end_aclass(element1, element2, cc1, cc2, cc3, cem, outputdirectory)
child4_text = (row4[5]).encode('utf-8') # paratext
print_results_aclass(element1, element2, child4_text, cc1, cc2, cc3, cem, outputdirectory)
elif (row4[3]):
child4_text = str(row4[3]) #title
print_titles(child4_text, "href", cc1, cc2, cc3, cem, outputdirectory)
elif (row4[4]):
child4_text = str(row4[4]) #title
print_titles(child4_text, "href", cc1, cc2, cc3, cem, outputdirectory)
else:
child4_text = str(row4[2])
#print_results(child4_text, cc1, cc2, cc3, cem, outputdirectory)
#------------------------------------------------------------------------------
def child5_to_html(self, element1, element2, element3, element4, dbmgrbiblioentry, dbmgrpara1, dbmgrpara2, dbmgrpara3, dbmgrpara4, dbmgritem, dbmgrlist, row5, cc1, cc2, cc3, cem, outputdirectory):
if ((row5[6]) == "item"): # element
child5_text = ""
elif ((row5[6]) == "m-workunit"): # element
child5_text = "<b>Workunit</b> " + (row5[5]).encode('utf-8') # acomponent
child6_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child6 WHERE parentkey = '+str(row5[0])+' ORDER BY id'
for para_row_6 in dbmgrpara1.query(child6_para_query):
if ((para_row_6[5]) == "ae-dc-element"): # element
child5_text += "<b>" + (para_row_6[4]).encode('utf-8') + "</b>" # paratext
print_results(child5_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row5[6]) == "glossentry"): # element
if ((row5[5]).encode('utf-8') != ""):
child5_text = "<b> " + (row5[5]).encode('utf-8') + ": </b> "
print_results(child5_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row5[6]) == "glossterm"): # element
child5_text = "<b> " + (row5[5]).encode('utf-8') + ": </b> "
print_results(child5_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row5[6]) == "glossdef"): # element
child5_text = (row5[5]).encode('utf-8') # acomponent
child6_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child6 WHERE parentkey = '+str(row5[0])+' ORDER BY id'
for para_row_6 in dbmgrpara1.query(child6_para_query):
if ((para_row_6[5]) == "bold"):
child5_text += "<b> " + (para_row_6[4]).encode('utf-8') + " </b>"
if ((para_row_6[5]) == "italic"):
child5_text += "<i> " + (para_row_6[4]).encode('utf-8') + " </i>"
if ((para_row_6[5]) == "xref"):
child5_text += (para_row_6[4]).encode('utf-8') # paratext
print_results(child5_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row5[6]) == "glossnote"): # element
child5_text = (row5[5]).encode('utf-8') # acomponent
print_results(child5_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row5[6]) == "xref"): # element
child5_text = ""
elif ((row5[6]) == "table"): # element
child5_text = ""
child6_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child6 WHERE parentkey = '+str(row5[0])+' ORDER BY id'
for para_row_6 in dbmgrpara1.query(child6_para_query):
if ((para_row_6[5]) == "title" ): # element
child5_text += (para_row_6[4]).encode('utf-8') # paratext
print_results(child5_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row5[6]) == "para"): # element
child5_text = (row5[5]).encode('utf-8') # paratext
child6_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child6 WHERE parentkey = '+str(row5[0])+' ORDER BY id'
for para_row_6 in dbmgrpara1.query(child6_para_query):
if ((para_row_6[5]) == "bold"):
child5_text += "<b> " + (para_row_6[4]).encode('utf-8') + " </b>"
if ((para_row_6[5]) == "italic"):
child5_text += "<i> " + (para_row_6[4]).encode('utf-8') + " </i>"
if ((para_row_6[5]) == "xref"):
child5_text += (para_row_6[4]).encode('utf-8') # paratext
print_results_aclass_child5(element1, element2, element3, element4, child5_text, cc1, cc2, cc3, cem, outputdirectory)
elif ((row5[6]) == "figure"): # element
figure_title = (row5[3]).encode('utf-8')
figure_entity = (row5[7]).encode('utf-8')
figure_width = (row5[8]).encode('utf-8')
figure_height = (row5[9]).encode('utf-8')
print_results_figure(figure_title, figure_entity, figure_width, figure_height, cc1, cc2, cc3, cem, outputdirectory)
elif ((row5[6]) == "list"): # element
print_results_list_aclass_child6(element1, element2, element3, element4, cc1, cc2, cc3, cem, outputdirectory)
child5_list_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child6 WHERE parentkey = '+str(row5[0])+' ORDER BY id'
for row_c5 in dbmgrlist.query(child5_list_query):
if ((row_c5[5]) == "item"): # element
child5_list_text = (row_c5[4]).encode('utf-8') # item
child7_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child7 WHERE parentkey = '+str(row_c5[0])+' ORDER BY id'
for para_item_7 in dbmgrpara1.query(child7_para_query):
if ((para_item_7[5]) == "bold"):
child5_list_text += "<b> " + (para_item_7[4]).encode('utf-8') + " </b>"
if ((para_item_7[5]) == "italic"):
child5_list_text += "<i> " + (para_item_7[4]).encode('utf-8') + " </i>"
if ((para_item_7[5]) == "xref"):
child5_list_text += (para_item_7[4]).encode('utf-8') # paratext
print_results_item_aclass_child6(element1, element2, element3, element4, child5_list_text, cc1, cc2, cc3, cem, outputdirectory)
#--------------------------------------------
child7_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child7 WHERE parentkey = '+str(row_c5[0])+' ORDER BY id'
for para_item_7 in dbmgrpara1.query(child7_para_query):
if ((para_item_7[5]) == "list"):
print_results_list_aclass_child6(element1, element2, element3, element4, cc1, cc2, cc3, cem, outputdirectory)
child8_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child8 WHERE parentkey = '+str(para_item_7[0])+' ORDER BY id'
for para_item_8 in dbmgrpara2.query(child8_para_query):
if ((para_item_8[5]) == "item"): # element
child8_text = (para_item_8[4]).encode('utf-8') # paratext
child9_para_query = 'SELECT id, parentkey, idelement, title, paratext, element FROM child9 WHERE parentkey = '+str(para_item_8[0])+' ORDER BY id'
for para_row_9 in dbmgrpara3.query(child9_para_query):
if ((para_row_9[5]) == "bold"):
child8_text += "<b> " + (para_row_9[4]).encode('utf-8') + " </b>"
if ((para_row_9[5]) == "italic"):
child8_text += "<i> " + (para_row_9[4]).encode('utf-8') + " </i>"
if ((para_row_9[5]) == "xref"):
child8_text += (para_row_9[4]).encode('utf-8') # paratext
print_results_item_aclass_child6(element1, element2, element3, element4, child8_text, cc1, cc2, cc3, cem, outputdirectory)
print_results_list_end_aclass_child6(element1, element2, element3, element4, cc1, cc2, cc3, cem, outputdirectory)