aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/hub.org
blob: 2852840fb3b0cd263b64941664cc9768bdbf540b (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
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
-*- mode: org -*-
#+TITLE:       sisu hub
#+DESCRIPTION: documents - structuring, various output representations & search
#+FILETAGS:    :sisu:hub:
#+AUTHOR:      Ralph Amissah
#+EMAIL:       [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]]
#+COPYRIGHT:   Copyright (C) 2015 - 2021 Ralph Amissah
#+LANGUAGE:    en
#+STARTUP:     content hideblocks hidestars noindent entitiespretty
#+OPTIONS:     H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil _:nil -:t f:t *:t <:t
#+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
#+PROPERTY:    header-args+ :mkdirp yes

* hub
** hub.rb

#+BEGIN_SRC ruby  :tangle "../lib/sisu/hub.rb"
<<sisu_document_header>>
module SiSU
  require_relative 'constants'                         # constants.rb
  require_relative 'se'                                # se.rb
    include SiSU_Env
    include SiSU_Screen
  require_relative 'hub_actions'                       # hub_actions.rb
  require_relative 'hub_loop_markup_files'             # hub_loop_markup_files.rb
  require_relative 'hub_options'                       # hub_options.rb
  require_relative 'dp'                                # dp.rb
    include SiSU_Param
  require_relative 'utils'                             # utils.rb
  begin
    require 'uri'
  rescue LoadError
    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
      error('uri NOT FOUND (LoadError)')
  end
  class HubMaster
    def initialize(argv,sisu_runtime)
      begin
        opt=SiSU_Commandline::Options.new(argv,sisu_runtime)
        SiSU::Processing.new(opt).actions_without_files
        SiSU::Processing.new(opt).actions_on_files
        SiSU::Processing.new(opt).actions_without_files_post
      rescue
        selection=(opt ? opt.selections.src : argv)
        SiSU_Screen::Ansi.new(selection,$!,$@).rescue do
          __LINE__.to_s + ':' + __FILE__
        end
      ensure
        Dir.chdir(sisu_runtime[:call_path])
      end
    end
  end
  class Processing
    begin
      require 'fileutils'
        include FileUtils
    rescue LoadError
      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
        error('fileutils NOT FOUND (LoadError)')
    end
    @@env=nil
    attr_accessor :op
    def initialize(opt)
      @opt=opt
      @@env=@env=SiSU_Env::InfoEnv.new
      @msg,@msgs='',nil
      @tell=lambda {
        SiSU_Screen::Ansi.new(
          @opt.selections.str,
          @msg,
          "#{@msgs.inspect if @msgs}"
        )
      }
    end
    def remove_skipped_files_if_any_from_processing_files_array
      if @remove_faulty_markup_files_array.length > 0
        @opt.files = (@opt.files - @remove_faulty_markup_files_array)
      end
    end
    def print_error_message_if_files_skipped
      if @remove_faulty_markup_files_array.length > 0
        puts '---'
        STDERR.puts 'ERROR with file(s), did not process: ' +
          @remove_faulty_markup_files_array.join(',')
      end
    end
    def do_each_file_loop_check_and_perform_selected_actions(opt)
      actions=SiSU_Hub_Actions::HubActions.new(opt)
      actions.outputs.each_file.abstract_objects?
      actions.outputs.each_file.qrcode?
      actions.outputs.each_file.hash_digests?
      actions.outputs.each_file.text?
      actions.outputs.each_file.html?
      actions.outputs.each_file.xhtml?
      actions.outputs.each_file.xml?
      actions.outputs.each_file.json?
      actions.outputs.each_file.pdf?
      actions.outputs.each_file.man_or_info?
      actions.outputs.each_file.po4a_make?
      actions.outputs.each_file.sqlite_discrete?
      actions.outputs.each_file.manifest?
    end
    def do_each_file_loop_options
      if @opt.files.length > 0
        @opt.files.each_with_index do |fno,i|
          @opt.fno=fno
          @opt.fns=fno.
            gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst').
            gsub(/\.ssm$/,'.ssm.sst')
          @opt.f_pth=@opt.f_pths[i]
          if @opt.fns !~/\.-sst$/
            @opt.pth=@opt.f_pths[i][:pth]
            @opt.lng=@opt.f_pths[i][:lng]
          else
            @opt.pth=Dir.pwd
            @opt.lng='en'
          end
          unless @opt.pth.nil?
            @@pwd=@opt.pth
            Dir.chdir(@opt.pth) #watch
          end
          #@env=SiSU_Env::InfoEnv.new(@opt.fns)
          do_each_file_loop_check_and_perform_selected_actions(@opt)
        end
      else
        do_each_file_loop_check_and_perform_selected_actions(@opt)
      end
    end
    def do_loop_files_on_given_option_pre
      begin
        if @opt.act[:zap][:set]==:on                   #% --zap, -Z
          SiSU_Hub_Loops::OptionLoopFiles.new(@opt).loop_files_on_given_option do
            require_relative 'zap'
            SiSU_Zap::Source.new(@opt).read            # -Z     zap.rb
          end
        end
      ensure
      end
    end
    def do_loop_files_on_given_option_post
      actions=SiSU_Hub_Actions::HubActions.new(@opt)
      if defined? actions.outputs.loop_files.share_source?
        actions.outputs.loop_files.share_source?
      end
      if defined? actions.outputs.loop_files.run_termsheet?
        actions.outputs.loop_files.run_termsheet?
      end
      if defined? actions.outputs.loop_files.po4a_setup?
        actions.outputs.loop_files.po4a_setup?
      end
      if defined? actions.outputs.loop_files.sql?
        actions.outputs.loop_files.sql?
      end
      SiSU_Hub_Actions::Operations.new.counter
      if defined? actions.outputs.loop_files.manifest?
        actions.outputs.loop_files.manifest?
      end
      if defined? actions.outputs.loop_files.sitemaps?
        actions.outputs.loop_files.sitemaps?
      end
      if defined? actions.outputs.loop_files.urls?
        actions.outputs.loop_files.urls?
      end
    end
    def actions_without_files
      actions=SiSU_Hub_Actions::HubActions.new(@opt)
      actions.report.version_info?
      actions.report.version_info_extra?
      actions.prepare.site?
      actions.prepare.sql?
    end
    def actions_without_files_post
      actions=SiSU_Hub_Actions::HubActions.new(@opt)
      actions.prepare.remote_site?
      actions.prepare.search_form?
      actions.prepare.webrick?
    end
    def actions_on_files
      if @opt.act[:profile][:set]==:on
        begin
          require 'profile'
        rescue LoadError
          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
            error('profile NOT FOUND (LoadError)')
        end
      end
      actions=SiSU_Hub_Actions::HubActions.new(@opt)
      actions.outputs.each_file.harvest?
      actions.outputs.init?
      do_loop_files_on_given_option_pre
      do_each_file_loop_options
      #remove_skipped_files_if_any_from_processing_files_array # NEEDS WORK
      do_loop_files_on_given_option_post
      #print_error_message_if_files_skipped
      if (@opt.act[:verbose][:set]==:on \
      || @opt.act[:verbose_plus][:set]==:on \
      || @opt.act[:maintenance][:set]==:on)
        @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil
      end
      if (@opt.act[:verbose][:set]==:on \
      || @opt.act[:verbose_plus][:set]==:on \
      || @opt.act[:maintenance][:set]==:on \
      || @opt.act[:urls_selected][:set]==:on \
      || @opt.act[:urls_all][:set]==:on)
        @tell.call.print_brown unless @opt.files.join.empty?
      end
      if defined? @@env.processing_path.processing \
      and @@env.user \
      and FileTest.directory?(@@env.processing_path.processing) \
      and @@env.processing_path.processing =~/#{@@env.user}$/
        #clean tmp processing dir of content as is located in public area
        if @@env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/
          FileUtils::cd(@@env.processing_path.processing_base_tmp) do
            FileUtils::rm_rf('.') unless @opt.act[:maintenance][:set] ==:on
          end
        end
      end
    end
  end
  class HubClose
    def initialize(call_path,argv)
      begin
        env=SiSU_Env::InfoEnv.new
      rescue
      ensure
        if FileTest.directory?(env.processing_path.processing) \
        and FileTest.directory?(env.processing_path.processing_base_tmp) \
        and env.processing_path.processing_base_tmp =~ /#{env.processing_path.processing}/ \
        and env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/ \
        and not argv.inspect =~/"--maintenance"|"-M"/
          FileUtils::cd(env.processing_path.processing_base_tmp) do
            FileUtils::rm_rf('.')
          end
        end
        Dir.chdir(call_path)
      end
    end
  end
end
__END__
#+END_SRC

** hub_options.rb

#+BEGIN_SRC ruby  :tangle "../lib/sisu/hub_options.rb"
<<sisu_document_header>>
module SiSU_Commandline
  begin
    require 'pathname'
  rescue LoadError
    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
      error('pathname NOT FOUND (LoadError)')
  end
  require_relative 'se'                                 # se.rb
  require_relative 'dp_make'                            # dp_make.rb
  class HeaderCommon
    def sisu_document_make_instructions(make_instruct_array=:nil)
      @pagenew=
        @pagebreak=
        @pageline=
        @toc=
        @lv1=@lv2=@lv3=@lv4=@lv5=@lv6=
        @num_top=
        @i18n=
        @man_section=
        @emphasis_set_to=
        @bold_match_list=
        @italics_match_list=
        @substitution_match_list=
        @footer_links=
        @home_button_links=
        @links=
        nil
      make_instruct_array=make_instruct_array==:nil \
      ? SiSU_Env::GetInit.new.sisu_document_make.makefile_read
      : make_instruct_array
      @makeset=false
      if make_instruct_array
        make_instruct_array.each do |para|                                     #% scan document
          if para =~/^(?:@make:|@links:)[+-]?\s/
            case para
            when /^@make:(.+)/m                                                #% header processing - make
              @env=SiSU_Env::InfoEnv.new
              @make=SiSU_Param_Make::MdMake.new($1.strip,@opt,@env).make
              makes=SiSU_Param_Make::MakeHead.new(@make).make_instruct
              @makeset=true
              @pagenew=makes[:pagenew]
              @pagebreak=makes[:pagenew]
              @pageline=makes[:pageline]
              @toc=makes[:toc]
              @lv1=makes[:lv1]
              @lv2=makes[:lv2]
              @lv3=makes[:lv3]
              @lv4=makes[:lv4]
              @lv5=makes[:lv5]
              @lv6=makes[:lv6]
              @num_top=makes[:num_top]
              @i18n=makes[:i18n]
              @man_section=makes[:man_section]
              @emphasis_set_to=makes[:emphasis_set_to]
              @bold_match_list=makes[:bold_match_list]
              @italics_match_list=makes[:italics_match_list]
              @substitution_match_list=makes[:substitution_match_list]
              @footer_links=makes[:footer_links]
              @home_button_links=makes[:home_button_links]
              @home_button_image=makes[:home_button_image]
              @cover_image=makes[:cover_image]
            when /^@links:(.+)/m                                                #% header processing - make
              make_links=SiSU_Param::Parameters::MdMake.new($1.strip,@opt,@env).make_links
              @links,@links_append=make_links.links,make_links.append?
            end
          end
        end                                                                    #% here endeth the common header loop
      end
      { makeset: @makeset,
        pagenew: @pagenew,
        pagebreak: @pagebreak,
        pageline: @pageline,
        toc: @toc,
        lv1: @lv1,
        lv2: @lv2,
        lv3: @lv3,
        lv4: @lv4,
        lv5: @lv5,
        lv6: @lv6,
        num_top: @num_top,
        i18n: @i18n,
        man_section: @man_section,
        emphasis_set_to: @emphasis_set_to,
        bold_match_list: @bold_match_list,
        italics_match_list: @italics_match_list,
        substitution_match_list: @substitution_match_list,
        footer_links: @footer_links,
        home_button_links: @home_button_links,
        home_button_image: @home_button_image,
        cover_image: @cover_image,
        links: @links,
        links_append: @links_append
      }
    end
  end
  class Options
    attr_accessor :selections,:opt_ch,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:image_src_path,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod,:sisu_run_path,:sisu_install_type
    @@act=nil
    def initialize(a,sisu_runtime)
      @opt_ch=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@image_src_path=@sub_location=''
      @f_pths,@files,@files_mod,@paths,@select_arr,@act=Array.new(5){[]}
      @select_str=nil
      @env=SiSU_Env::InfoEnv.new
      @lng_base=@env.language_default_set
      @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by?
      @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual?
      @sisu_run_from=sisu_runtime[:runtime_path]
      @sisu_install_type=sisu_runtime[:runtime_type]
      @call_path=sisu_runtime[:call_path]
      pth=SiSU_Utils::Path.new(call_path)
      @base_path=pth.base_markup
      @base_stub=pth.base_markup_stub
      @image_src_path=pth.image_src
      @a=sisu_glob_rules(a)
      @a.freeze
      @make_instructions=HeaderCommon.new.sisu_document_make_instructions
      @make_instructions_pod=nil
      init
    end
    def sisu_called_from?
      @call_path
    end
    def sisu_bin_filepath?
      @sisu_run_from
    end
    def sisu_install_type?
      @sisu_install_type
    end
    def sisu_lib_dir?
      File.dirname(__FILE__)
    end
    def sisu_data_dir?
      env=RbConfig::CONFIG
      if sisu_install_type? ==:full_path_to_sisu_bin_in_sisu_dir_tree
        sisu_bin_filepath?.gsub(/\/bin\/sisu\S*/,'/data/sisu')
        #sisu_lib_dir?.gsub(/\/lib\/sisu\/(?:current|develop)\S*/,'/data/sisu')
      elsif sisu_install_type? ==:gem_install
        #sisu_run_from?.gsub(/\/bin\/.+/,'/data/sisu')
        env['datadir']
      elsif sisu_install_type? ==:system_install
        #SiSU_Info_Env::InfoEnv.new.path.share
        env['datadir']
      else
        env['datadir']
      end
    end
    def find_all(find_flag,opt)
      if find_flag
        x=Dir.glob('*.ss[tm]')
        Px[:lng_lst].each do |d|
          if FileTest.directory?(d)
            x << Dir.glob("#{d}/*.ss[tm]")
          end
        end
        x=x.flatten
        opt + x
      end
    end
    def find_select(find_flag,opt)
      if find_flag
        x=[]
        if opt.inspect =~/"[a-zA-Z][a-zA-Z0-9._-]+?"/
          opt.each do |g|
            x <<=if g =~/.ss[tm]/
              Dir.glob("*#{g}")
            else
              Dir.glob("*#{g}*.ss[tm]")
            end
            Px[:lng_lst].each do |d|
              if FileTest.directory?(d)
                x <<=if g =~/.ss[tm]/
                  Dir.glob("#{d}/*#{g}")
                else
                  Dir.glob("#{d}/*#{g}*.ss[tm]")
                end
              end
            end
          end
        end
        x.flatten
      end
    end
    def sisu_glob_rules(a)
      a=if a.inspect =~/"-[A-Za-z0-9]*[fG]/ \
      or a.inspect =~/"--find"|"--glob"/
        b,f=[],[]
        find_flag=false
        a.each do |y|
          if y =~ /^-/
            if y =~/^-/ \
            && y =~/[fG]|--find|--glob/
              find_flag=true
            end
            b << y
          end
          if find_flag \
          && y !~ /^-/ \
          && y =~ /\S+/
            if y !~/\//
              f << y
            else
              find_flag=false
              puts %{sub-directories "#{y}" cannot be provided for --find or --glob at this time}
            end
          end
        end
        r=Px[:lng_lst_rgx].gsub(/\|#{lng_base}\|/,'|')
        @lang_regx=%r{(?:#{r})}
        if find_flag
          (f.length > 0) \
          ? (b + find_select(find_flag,f))
          : find_all(find_flag,b)
        elsif a.inspect =~/"(?:-\S+?|--\S+?)"/ \
        && a.inspect =~/"#{@lang_regx}\/?"/ \
        && a.inspect =~/"#{lng_base}\/\S+?\.ss[tm]"/
          init_selected_lang_dirs(a)
        else b
        end
      else a
      end
    end
    def init_selected_lang_dirs(a)
      @z=a.each.map do |y|
        if y =~/^#{lng_base}\/(\S+?\.ss[tm])$/
          @fn=$1
          y
        elsif y =~/^#{@lang_regx}\/?$/
          "#{y}/#{@fn}"
        else y
        end
      end
    end
    def init
      a=@a
      s=expand_numeric_shortcuts(a)
      q=set_files_and_paths_and_general_extract(s)
      files=(q[:files].length > 0) ? :true : :false
      @select_arr=opt_cmd_and_mod_adjust(q[:opt_ch],q[:selections],files)
      if a.length > 0
        @what=q[:what] unless q[:what].empty?
        @paths = q[:paths]
        @files = q[:files]
        @f_pths = q[:f_pths]
        @lngs = q[:lngs]
        if @files.length > 0 \
        and @opt_ch.empty? \
        and @select_arr.length==0 #% if no other action called on filename given, default is sisu --v5 -0 [filename(s)] configured as flag default
          shortcut=SiSU_Env::InfoProcessingFlag.new
          @select_arr=['--v5']
          @select_arr << shortcut.act_0.arr #+ ' --dal'
        end
        if @select_arr.inspect =~/--verbose/ \
        && @opt_ch !~/-[ku]*v[ku]*$/
          SiSU_Screen::Ansi.new(
            @opt_ch,
            "\tsisu " + @opt_ch +  ' ' + @select_arr.join(' ') + ' ' + @files.join(' ') + "\n"
          ).print_brown
        end
      end
      @@act ? @act=@@act : @@act=@act=opt_act
      self
    end
    def sisu_document_make_pod
      def makefile_name
        SiSU_Env::GetInit.new.sisu_document_make.makefile_name
      end
      def makefile(pod_make_path)
        "#{pod_make_path}/#{makefile_name}"
      end
      def makefile_read(pod_make_path)
        if FileTest.file?(makefile(pod_make_path))
          sisu_doc_makefile=IO.read(makefile(pod_make_path), mode: 'r:utf-8')
          sisu_doc_makefile.split(/\s*\n\s*\n/m)
        else nil
        end
      end
      self
    end
    def set_files_and_paths_and_general_extract(s)
      c,w='',''
      m,f,pth,lng,lngs=[],[],[],[],[]
      lng_is=''
      a=(s.nil?) \
      ? ['-v']
      : s.split(/\s+/)
      r_l=Px[:lng_lst].join('|')
      a.uniq.each do |x|
        if x =~/^-[a-z0-5]+/i \
        or x =~/^--\S+/
          if x =~/^-([a-z0-5]+)/i
            c << $1
          end
          if x =~/^--\S+/
            m << x
          end
        elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip))$/
          if x =~/\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)/
            if x =~/^(?:https?|file):\/\/\S+/ #\
            end
            pwd=Dir.pwd
            fn_pod=x.gsub(/([^\/]+)\.txz$/,'\1')
            fullname=@env.processing_path.processing + '/sisupod/' + fn_pod
            pt=Pathname.new(fullname)
            FileUtils::mkdir_p(pt.to_s)
            pod_make_path=fullname + '/sisupod/doc/_sisu'
            make_instruct_array=sisu_document_make_pod.makefile_read(pod_make_path)
            @make_instructions_pod=
              HeaderCommon.new.sisu_document_make_instructions(make_instruct_array)
            Dir.chdir(pt.realpath)
            system("
              chdir #{fullname}
              tar xaf #{pwd}/#{x}
              chdir #{pwd}
            ")
            Dir.chdir(pt.realpath.to_s + '/sisupod/doc')
            r=Px[:lng_lst_rgx]
            Dir.entries("#{fullname}/sisupod/doc").each do |d_lng|
              if d_lng =~/^(?:#{r})$/
                Dir.chdir(pt.realpath.to_s + "/sisupod/doc/#{d_lng}")
                filenames=Dir.glob("*.ss[mt]")
                filenames.each do |fn|
                  f_pths << {
                    pth: "#{fullname}/sisupod/doc/#{d_lng}",
                    f: "#{fn}",
                    pth_stub: 'doc',
                    lng: d_lng,
                    lng_is: d_lng,
                    url_base: '',
                    url: ''
                  }
                  Dir.chdir(pwd)
                  f << fn
                end
              end
            end
          elsif x =~/^(?:https?|file):\/\/\S+/ \
          and x =~/\S+?\.ss[mt]$/
            r_url=/(http:\/\/\S+?\/\S+?\/src(?:\/(?:#{r_l}))?)\//
            url_base = (x[r_url,1])
            url = x
            y=x.gsub(/http:\/\/\S+?\/\S+?\/src\//,'')
            t=/(#{r_l})\/[^\/]+?\.ss[tm]$/
            l_p = (y[t,1]) \
              ? y[t,1]
              : nil
            lng << l_p
            lngs << if l_p
              l_p
            elsif x =~/~(#{r_l})\.ss[tm]/
              $1
            else lng_base
            end
            r_f=/(?:#{r_l})\/([^\/]+?\.ss[tm])$/
            fn = (y[r_f,1]) \
              ? y[r_f,1]
              : y
            fn=fn.gsub(/\.((?:ssm\.)?sst)/,'.-\1')
            fullname=Dir.pwd + '/' + fn
            pt=Pathname.new(fullname)
            pth << Dir.pwd
            r_u=/.+?\/([^\/]+)(?:\/(?:#{r_l})$|$)/
            lng_is =if l_p
              l_p
            elsif x =~/~(#{r_l})\.ss[tm]/
              $1
            else lng_base
            end
            f_pths << {
              pth: pt.split[0].realpath.to_s,
              f: pt.split[1].to_s,
              pth_stub: pt.split[0].realpath.to_s[r_u,1],
              lng: (pt.split[0].realpath.to_s[t,1]) \
                ? pt.split[0].realpath.to_s[t,1]
                : nil,
              lng_is: lng_is,
              url_base: url_base,
              url: url
            }
            f << fn
          elsif FileTest.file?(x)
            pt=Pathname.new(x)
            pth << pt.split[0].realpath.to_s     #remove?
            f << pt.split[1].to_s                #remove?
            r_u=/.+?\/([^\/]+)(?:\/(?:#{r_l})$|$)/
            t=/.+\/(#{r_l})$/
            l_p = (pt.split[0].realpath.to_s[t,1]) \
              ? pt.split[0].realpath.to_s[t,1]
              : nil
            lngs << lng_is = if l_p
              l_p
            elsif x =~/~(#{r_l})\.ss[tm]/
              $1
            else lng_base
            end
            f_pths << {
              pth: pt.split[0].realpath.to_s,
              f: pt.split[1].to_s,
              pth_stub: pt.split[0].realpath.to_s[r_u,1],
              lng: lng_is,
              lng_is: lng_is,
              url_base: nil,
              url: nil,
            }
          else  puts "file not found: #{x}"
          end
        elsif x =~ /\.termsheet\.rb$/
          (FileTest.file?(x)) \
          ? (f << x)
          : (puts "file not found: #{x}")
        else w=x
          puts "#{x} in #{a.join(' ')}?"
        end
      end
      {
        opt_ch: c,
        selections: m,
        what: w,
        paths: pth,
        files: f,
        f_pths: f_pths,
        lng: lng_is,
        lngs: lngs,
      }
    end
    def expand_numeric_shortcuts(a)
      s=''
      a.each do |x|
        y=case x
        when /0/
          (x=~/^-0\S+/) \
          ? x.gsub(/^-0(\S+)/,'--act0' + ' -\1')
          : x.gsub(/^-0/,'--act0' + ' ')
        when /1/
          (x=~/^-1\S+/) \
          ? x.gsub(/^-1(\S+)/,'--act1' + ' -\1')
          : x.gsub(/^-1/,'--act1' + ' ')
        when /2/
          (x=~/^-2\S+/) \
          ? x.gsub(/^-2(\S+)/,'--act2' + ' -\1')
          : x.gsub(/^-2/,'--act2' + ' ')
        when /3/
          (x=~/^-3\S+/) \
          ? x.gsub(/^-3(\S+)/,'--act3' + ' -\1')
          : x.gsub(/^-3/,'--act3' + ' ')
        when /4/
          (x=~/^-4\S+/) \
          ? x.gsub(/^-4(\S+)/,'--act4' + ' -\1')
          : x.gsub(/^-4/,'--act4' + ' ')
        when /5/
          (x=~/^-5\S+/) \
          ? x.gsub(/^-5(\S+)/,'--act5' + ' -\1')
          : x.gsub(/^-5/,'--act5' + ' ')
        when /6/
          (x=~/^-6\S+/) \
          ? x.gsub(/^-6(\S+)/,'--act6' + ' -\1')
          : x.gsub(/^-6/,'--act6' + ' ')
        when /7/
          (x=~/^-7\S+/) \
          ? x.gsub(/^-7(\S+)/,'--act7' + ' -\1')
          : x.gsub(/^-7/,'--act7' + ' ')
        when /8/
          (x=~/^-8\S+/) \
          ? x.gsub(/^-8(\S+)/,'--act8' + ' -\1')
          : x.gsub(/^-8/,'--act8' + ' ')
        when /9/
          (x=~/^-9\S+/) \
          ? x.gsub(/^-9(\S+)/,'--act9' + ' -\1')
          : x.gsub(/^-9/,'--act9' + ' ')
        else x
        end
        s << " #{y}" unless y.empty?
      end
      s.strip!
    end
    def opt_cmd_and_mod_adjust(ch,select_arr,files)
      select_arr=select_arr.flatten
      sel_init=select_arr.flatten
      shortcut=SiSU_Env::InfoProcessingFlag.new
      if files ==:true
        if not sel_init.empty? \
        and sel_init.inspect =~/"--act[s0-9]?/
          sel_init.each do |s|
            select_arr <<=case s
            when /--act0/ then shortcut.act_0.arr
            when /--act1/ then shortcut.act_1.arr
            when /--act2/ then shortcut.act_2.arr
            when /--act3/ then shortcut.act_3.arr
            when /--act4/ then shortcut.act_4.arr
            when /--act5/ then shortcut.act_5.arr
            when /--act6/ then shortcut.act_6.arr
            when /--act7/ then shortcut.act_7.arr
            when /--act8/ then shortcut.act_8.arr
            when /--act9/ then shortcut.act_9.arr
            when /--act/  then shortcut.act_info
            end
          end
        end
        if not sel_init.empty? \
        and sel_init.inspect =~/"--pdf-/
          select_arr << '--pdf'
          sel_init.each do |s|
            if s =~ /^--pdf-(?:(?:l|landscape)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:l|landscape))$/
              select_arr << '--landscape'
            end
            if s =~ /^--pdf-(?:(?:p|portrait)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:p|portrait))$/
              select_arr << '--portrait'
            end
            if s =~ /^--pdf(?:-(?:a4|letter|a5|b5|legal)(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))(?:-(?:a4|letter|a5|b5|legal)))$/
              if s =~ /^--pdf(?:-a4(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a4)$/
                select_arr << '--papersize-a4'
              end
              if s =~ /^--pdf(?:-a5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a5)$/
                select_arr << '--papersize-a5'
              end
              if s =~ /^--pdf(?:-b5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-b5)$/
                select_arr << '--papersize-b5'
              end
              if s =~ /^--pdf(?:-letter(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-letter)$/
                select_arr << '--papersize-letter'
              end
              if s =~ /^--pdf(?:-legal(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-legal)$/
                select_arr << '--papersize-legal'
              end
            end
          end
          select_arr=select_arr.uniq
        end
        if ch.empty? \
        and sel_init.length == 0
          select_arr << shortcut.act_0.arr ################ & --flag empty
        elsif not ch.empty?
          if ch =~/c/ then select_arr << '--color-toggle'
            ch=ch.gsub(/[c]/,'')
          end
          if ch =~/k/ then select_arr << '--color-off'
            ch=ch.gsub(/[k]/,'')
          end
          if ch =~/C/ then select_arr << '--config'
            ch=ch.gsub(/[C]+/,'')
          end
          if ch =~/m/ then select_arr << '--dal'
            ch=ch.gsub(/[m]/,'')
          end
          if ch =~/t/ then select_arr << '--txt'
            ch=ch.gsub(/[t]/,'')
          end
          if ch =~/h/ then select_arr << '--html'
            ch=ch.gsub(/[h]/,'')
          end
          if ch =~/e/ then select_arr << '--epub'
            ch=ch.gsub(/[e]/,'')
          end
          if ch =~/o/ then select_arr << '--odt'
            ch=ch.gsub(/[o]/,'')
          end
          if ch =~/d/ then select_arr << '--docbook'
            ch=ch.gsub(/[d]/,'')
          end
          if ch =~/p/ then select_arr << '--pdf'
            ch=ch.gsub(/[p]/,'')
          end
          if ch =~/w/ then select_arr << '--concordance'
            ch=ch.gsub(/[w]/,'')
          end
          if ch =~/i/ then select_arr << '--manpage'
            ch=ch.gsub(/[i]/,'')
          end
          if ch =~/I/ then select_arr << '--texinfo'
            ch=ch.gsub(/[I]/,'')
          end
          if ch =~/b/ then select_arr << '--xhtml'
            ch=ch.gsub(/[b]/,'')
          end
          if ch =~/x/ then select_arr << '--xml-sax'
            ch=ch.gsub(/[x]/,'')
          end
          if ch =~/X/ then select_arr << '--xml-dom'
            ch=ch.gsub(/[X]/,'')
          end
          if ch =~/j/ then select_arr << '--images'
            ch=ch.gsub(/[j]/,'')
          end
          if ch =~/J/ then select_arr << '--json'
            ch=ch.gsub(/[J]/,'')
          end
          if ch =~/N/ then select_arr << '--digests'
            ch=ch.gsub(/[N]/,'')
          end
          if ch =~/P/ then select_arr << '--po4a-sst'
            ch=ch.gsub(/[P]/,'')
          end
          if ch =~/d/ then select_arr << '--sqlite'
            ch=ch.gsub(/[d]/,'')
          end
          if ch =~/D/ then select_arr << '--pg'
            ch=ch.gsub(/[D]/,'')
          end
          if ch =~/Q/ then select_arr << '--qrcode'
            ch=ch.gsub(/[Q]/,'')
          end
          if ch =~/s/ then select_arr << '--source'
            ch=ch.gsub(/[s]/,'')
          end
          if ch =~/S/ then select_arr << '--sisupod'
            ch=ch.gsub(/[S]/,'')
          end
          if ch =~/m/ then select_arr << '--manifest'
            ch=ch.gsub(/[m]/,'')
          end
          if ch =~/R/ then select_arr << '--rsync'
            ch=ch.gsub(/[R]/,'')
          end
          if ch =~/r/ then select_arr << '--scp'
            ch=ch.gsub(/[r]/,'')
          end
          if ch =~/g/ then select_arr << '--git'
            ch=ch.gsub(/[g]/,'')
          end
          if ch =~/U/ then select_arr << '--urls'
            ch=ch.gsub(/[u]/,'')
          end
          if ch =~/Z/ then select_arr << '--zap'
            ch=ch.gsub(/[Z]/,'')
          end
          if ch =~/F/ then select_arr << '--sample-search-form'
            ch=ch.gsub(/[F]/,'')
          end
          if ch =~/W/ then select_arr << '--webrick'
            ch=ch.gsub(/[w]/,'')
          end
          if ch =~/M/ then select_arr << '--maintenance'
            ch=ch.gsub(/[M]/,'')
          end
          if ch =~/V/ then select_arr << '--very-verbose'
            ch=ch.gsub(/[V]/,'')
          end
          if ch =~/v/ then select_arr << '--verbose'
            ch=ch.gsub(/[v]/,'')
          end
          if ch =~/q/ then select_arr << '--quiet'
            ch=ch.gsub(/[q]/,'')
          end
          if select_arr.inspect !~/--urls/ \
          and select_arr.inspect \
          !~/"--harvest/
            select_arr << '--urls'
          end
          if select_arr.inspect !~/--dal/ \
          and select_arr.inspect =~/txt|text|html|odt|epub|docbook|xml|pdf|manpage|texinfo|concordance|qrcode|source|sisupod|pg|sqlite|zap/
            select_arr << '--dal'
          end
          if select_arr.inspect !~/--manifest/ \
          and select_arr.inspect =~/txt|text|html|odt|epub|docbook|xml|pdf|manpage|texinfo|concordance|qrcode|source|sisupod|pg|sqlite|zap/
            select_arr << '--manifest'
          end
          if select_arr.inspect !~/--images/ \
          and select_arr.inspect =~/html|odt|docbook|xml|qrcode/
            select_arr << '--images'
          end
        end
      else
        if not sel_init.empty? \
        and sel_init.inspect =~/"--acts?/
          shortcut.act_info
          exit
        end
        if ch =~/c/ then select_arr << '--color-toggle'
          ch=ch.gsub(/[c]/,'')
        end
        if ch =~/k/ then select_arr << '--color-off'
          ch=ch.gsub(/[k]/,'')
        end
        if ch =~/C/ then select_arr << '--config'
          ch=ch.gsub(/[C]+/,'')
        end
        if sel_init.inspect =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"/
          if ch =~/d/ then select_arr << '--sqlite'
            ch=ch.gsub(/[d]/,'')
          end
          if ch =~/D/ then select_arr << '--pg'
            ch=ch.gsub(/[D]/,'')
          end
        end
        if ch =~/W/ then select_arr << '--webrick'
          ch=ch.gsub(/[w]/,'')
        end
        if ch =~/v/ then select_arr << '--version'
          ch=ch.gsub(/[v]/,'')
        end
        if ch =~/M/ then select_arr << '--maintenance'
          ch=ch.gsub(/[M]/,'')
        end
        if ch =~/V/ then select_arr << '--very-verbose'
          ch=ch.gsub(/[V]/,'')
        end
        if ch =~/q/ then select_arr << '--quiet'
          ch=ch.gsub(/[q]/,'')
        end
      end
      select_arr=select_arr.flatten.compact.uniq.sort
    end
    def opt_act
      select_arr=@select_arr
      @@act=if @@act
        @act=@@act
      else
        act={}
        act[:no_stop]=if select_arr.inspect \
        =~/"--no-stop"|"--errors-as-warnings"/
          { bool: true, set: :on }
        else
          { bool: false, set: :na }
        end
        act[:license]=(select_arr.inspect \
        =~/"--license/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:site_init]=(select_arr.inspect \
        =~/"--init"|"--initialize"|"--init-site"|"--conf"|"--config"|"--configure"/) \
        ? { bool: true, set: :on  }
        : { bool: false, set: :na }
        act[:rc]=if select_arr.inspect \
        =~/"--rc=/
          x=Dir.pwd + '/' + select_arr.join.gsub(/--rc=/,'')
          { bool: true, set: :on, inst: x }
        else
          { bool: false, set: :na, inst: '' }
        end
        act[:processing_path]=if select_arr.inspect \
        =~/"--processing-path=/
          base_pth=select_arr.join(';').gsub(/^.*--processing-path=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
          { bool: true, set: :on, inst: base_pth }
        elsif select_arr.inspect \
        =~/"--processing-path/
          { bool: true, set: :on, inst: @base_path }
        else
          { bool: false, set: :na, inst: nil }
        end
        act[:dump]=if select_arr.inspect \
        =~/"--dump=/
          base_pth=select_arr.join(';').
            gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
          { bool: true, set: :on, inst: base_pth }
        elsif select_arr.inspect =~/"--dump/
          { bool: true, set: :on, inst: @base_path }
        else
          { bool: false, set: :na, inst: nil }
        end
        act[:redirect]=if select_arr.inspect \
        =~/"--redirect=/
          base_pth=select_arr.join(';').
            gsub(/^.*--redirect=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
          { bool: true, set: :on, inst: base_pth }
        elsif select_arr.inspect \
        =~/"--redirect/
          { bool: true, set: :on, inst: @base_path }
        else
          { bool: false, set: :na, inst: nil }
        end
        act[:switch]=if select_arr.inspect \
        =~/"--switch-off=/
          off_list=select_arr.join(';').
            gsub(/^.*--switch-off=['"]?(.+?)(?:['"];.+)?$/,'\1')
          off_list=off_list.scan(/[^,;\s]+/)
          { bool: false, set: :off, off: off_list}
        else { bool: true, set: :na, off: [] }
        end
        act[:default_language]=if select_arr.inspect \
        =~/"--(?:default-)?language[-=](\S{2})"/
          { set: :on, code: $1 }
        elsif lng_base
          { set: :on, code: lng_base }
        else { set: :na, code: 'en' }
        end
        act[:i18n]=if select_arr.inspect \
        =~/"(?:--monolingual|--i18n-mono(?:lingual)?)"/ #if monolingual possible outputs output_by :filename & :filetype only, without language code in default language name; give warning of conflict settings if monolingual & :language selected
          @lingual=:mono
          { set: :mono }
        elsif select_arr.inspect \
        =~/"(?:--multilingual|--i18n-multi(?:lingual)?)"/
          @lingual=:multi
          { set: :multi }
        else { set: :na }
        end
        act[:output_by]=if select_arr.inspect \
        =~/"--(?:output-)?by-language"/
          @dir_structure_by=:language
          { set: :language }
        elsif select_arr.inspect \
        =~/"--(?:output-)?by-filename"/
          @dir_structure_by=:filename
          { set: :filename }
        elsif select_arr.inspect \
        =~/"--(?:output-)?by-filetype"/
          @dir_structure_by=:filetype
          { set: :filetype }
        else { set: :na }
        end
        act[:ocn]=if select_arr.inspect \
        =~/"--ocn"|"--inc-ocn"|"--numbering"|"--inc-numbering"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--no-ocn"|"--exc-ocn"|"--no-numbering"|"--exc-numbering"/ \
        || act[:switch][:off].inspect =~/"ocn"|"--numbering"/
          { bool: false, set: :off }
        else { bool: true, set: :na }
        end
        act[:toc]=if select_arr.inspect \
        =~/"--inc-toc"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--(?:exc|no)-toc"/ \
        || act[:switch][:off].inspect =~/"toc"/
          { bool: false, set: :off }
        else { bool: true, set: :na }
        end
        act[:minitoc]=if select_arr.inspect \
        =~/"--minitoc"|"--inc-minitoc"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--(?:exc|no)-minitoc"/ \
        || act[:switch][:off].inspect =~/"minitoc"/
          { bool: false, set: :off }
        else { bool: false, set: :na }
        end
        act[:links_to_manifest]=if select_arr.inspect \
        =~/"--inc-links-to-manifest"|"--inc-manifest-links"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--(?:exc|no)-manifest"/ \
        || act[:switch][:off].inspect =~/"manifest"/ #place lower
          { bool: false, set: :off }
        elsif select_arr.inspect \
        =~/"--(?:exc|no)-links-to-manifest"|"--(?:exc|no)-manifest-links"/ \
        || act[:switch][:off].inspect \
        =~/"links_to_manifest"|"manifest_links"|"--(?:exc|no)-manifest"/ \
        || select_arr.inspect \
        =~/"--(?:redirect|dump)/
          { bool: false, set: :off }
        else { bool: true, set: :na }
        end
        act[:manifest_minitoc]=if select_arr.inspect \
        =~/"--inc-manifest-minitoc"|"--inc-minitoc"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--(?:exc|no)-manifest-minitoc"|"--(?:exc|no)-minitoc"/ \
        || act[:switch][:off].inspect =~/"manifest_minitoc"|"minitoc"/
          { bool: false, set: :off }
        else { bool: false, set: :na }
        end
        act[:metadata]=if select_arr.inspect \
        =~/"--metadata"|"--inc-metadata"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--(?:exc|no)-metadata"/ \
        || act[:switch][:off].inspect =~/"metadata"/
          { bool: false, set: :off }
        else { bool: true, set: :na }
        end
        act[:html_minitoc]=if select_arr.inspect \
        =~/"--inc-html-minitoc"|"--inc-minitoc"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--(?:exc|no)-html-minitoc"|"--(?:exc|no)-minitoc"/ \
        || act[:switch][:off].inspect =~/"html_minitoc"|"minitoc"/
          { bool: false, set: :off }
        else { bool: false, set: :na }
        end
        act[:html_navigation]=if select_arr.inspect \
        =~/"--inc-html-navigation"|"--inc-navigation"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--(?:exc|no)-html-navigation"|"--(?:exc|no)-navigation"/ \
        || act[:switch][:off].inspect =~/"html_navigation"|"nav"/
          { bool: false, set: :off }
        else { bool: true, set: :na }
        end
        act[:html_navigation_bar]=if select_arr.inspect \
        =~/"--inc-html-navigation-bar"|"--inc-navigation-bar"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--(?:exc|no)-html-navigation-bar"|"--(?:exc|no)-navigation-bar"/ \
        || act[:switch][:off].inspect =~/"html_navigation_bar"|"navbar"/
          { bool: false, set: :off }
        else { bool: false, set: :na }
        end
        act[:segsubtoc]=if select_arr.inspect \
        =~/"--inc-segsubtoc"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--(?:exc|no)-segsubtoc"/ \
        || act[:switch][:off].inspect =~/"segsubtoc"/
          { bool: false, set: :off }
        else { bool: true, set: :na }
        end
        act[:search_form]=if select_arr.inspect \
        =~/"--inc-search-form"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--(?:exc|no)-search-form"/ \
        || act[:switch][:off].inspect =~/"search_form"|"search"/
          { bool: false, set: :off }
        else { bool: true, set: :na }
        end
        act[:html_search_form]=if select_arr.inspect \
        =~/"--inc-html-search-form"|"--inc-search-form"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--(?:exc|no)-html-search-form"|"--(?:exc|no)-search-form"/ \
        || act[:switch][:off].inspect \
        =~/"html_search_form"|"search_form"|"search"/
          { bool: false, set: :off }
        else { bool: true, set: :na }
        end
        act[:html_right_pane]=if select_arr.inspect \
        =~/"--inc-html-right-pane"|"--inc-right-pane"|"--inc-html-right-column"|"--inc-right-column"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--(?:exc|no)-html-right-pane"|"--(?:exc|no)-right-pane"|"--(?:exc|no)-html-right-column"|"--(?:exc|no)-right-column"/ \
        || act[:switch][:off].inspect =~/"html_right_pane"|"html_right_column"|"promo"/
          { bool: false, set: :off }
        else { bool: true, set: :na }
        end
        act[:html_top_band]=if select_arr.inspect \
        =~/"--inc-html-top-band"|"--inc-top-band"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--(?:exc|no)-html-top-band"|"--(?:exc|no)-top-band"/ \
        || act[:switch][:off].inspect =~/"html-top-band"|"top-band"/
          { bool: false, set: :off }
        else { bool: true, set: :na }
        end
        act[:html]=if select_arr.inspect \
        =~/"--html-strict"/ \
        or ((select_arr.inspect \
        =~/"--html"/) \
        && select_arr.inspect \
        =~/"--strict"/)
          act[:html_strict]={ bool: true, set: :on }
          act[:html_scroll]={ bool: true, set: :on }
          act[:html_seg]={ bool: true, set: :on }
          { bool: true, set: :on }
        elsif (select_arr.inspect \
        =~/"--html"/)
          act[:html_strict]={ bool: false, set: :off }
          act[:html_scroll]={ bool: true, set: :on }
          act[:html_seg]={ bool: true, set: :on }
          { bool: true, set: :on }
        else
          act[:html_strict]=(select_arr.inspect \
          =~/"--strict"/) \
          ? { bool: true, set: :on }
          : { bool: false, set: :na }
          act[:html_scroll]=(select_arr.inspect \
          =~/"--html-scroll"/) \
          ? { bool: true, set: :on }
          : { bool: false, set: :na }
          act[:html_seg]=(select_arr.inspect \
          =~/"--html-seg"/) \
          ? { bool: true, set: :on }
          : { bool: false, set: :na }
          { bool: false, set: :na }
        end
        act[:concordance]=(select_arr.inspect \
        =~/"--concordance"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:images]=(select_arr.inspect \
        =~/"--images"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:json]=(select_arr.inspect \
        =~/"--json"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        if select_arr.inspect \
        =~/"--pdf"/
          if select_arr.inspect \
          =~/"--portrait"/
            act[:pdf]=  { bool: false, set: :na }
            act[:pdf_l]={ bool: false, set: :na }
            act[:pdf_p]={ bool: true, set: :on }
          elsif select_arr.inspect \
          =~/"--landscape"/
            act[:pdf]=  { bool: false, set: :na }
            act[:pdf_l]={ bool: true, set: :on }
            act[:pdf_p]={ bool: false, set: :na }
          else
            act[:pdf]=  { bool: true, set: :on }
            act[:pdf_l]={ bool: true, set: :on }
            act[:pdf_p]={ bool: true, set: :on }
          end
        else
          act[:pdf]=       { bool: false, set: :na }
          act[:pdf_p]=     { bool: false, set: :na }
          act[:pdf_l]=     { bool: false, set: :na }
          act[:pdf_a4]=    { bool: false, set: :na }
          act[:pdf_a5]=    { bool: false, set: :na }
          act[:pdf_b5]=    { bool: false, set: :na }
          act[:pdf_letter]={ bool: false, set: :na }
          act[:pdf_legal]= { bool: false, set: :na }
        end
        if act[:pdf][:set]==:on \
        or act[:pdf_p][:set]==:on \
        or act[:pdf_l][:set]==:on
          act[:pdf_a4]=if select_arr.inspect \
          =~/"--a4"|--papersize-a4"/ \
          or select_arr.inspect \
          =~/"--papersize=\S*a4\b\S*"/ #--papersize=a4,a5
            { bool: true, set: :on }
          else
            { bool: false, set: :na }
          end
          act[:pdf_a5]=if select_arr.inspect \
          =~/"--a5"|"--papersize-a5"/ \
          or select_arr.inspect \
          =~/"--papersize=\S*a5\b\S*"/ #--papersize=a4,a5
            { bool: true, set: :on }
          else
            { bool: false, set: :na }
          end
          act[:pdf_b5]=if select_arr.inspect \
          =~/"--b5"|"--papersize-b5"/ \
          or select_arr.inspect \
          =~/"--papersize=\S*b5\b\S*"/
            { bool: true, set: :on }
          else
            { bool: false, set: :na }
          end
          act[:pdf_letter]=if select_arr.inspect \
          =~/"--letter"|"--papersize-letter"/ \
          or select_arr.inspect \
          =~/"--papersize=\S*letter\b\S*"/
            { bool: true, set: :on }
          else
            { bool: false, set: :na }
          end
          act[:pdf_legal]=if select_arr.inspect \
          =~/"--legal"|"--papersize-legal"/ \
          or select_arr.inspect \
          =~/"--papersize=\S*legal\b\S*"/
            { bool: true, set: :on }
          else
            { bool: false, set: :na }
          end
        end
        act[:epub]=(select_arr.inspect \
        =~/"--epub"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:odt]=if select_arr.inspect \
        =~/"--odt"|"--odf"|"--odt-(?:ocn|numbering)"|"--odf-(?:ocn|numbering)"/
          act[:odt_ocn]=if (select_arr.inspect \
          =~/"--odt-(?:ocn|numbering)"|"--odf-(?:ocn|numbering)"/ \
          or select_arr.inspect \
          =~/"--ocn"|"--inc-ocn"|"--numbering"|"--inc-numbering"/)
            { bool: true, set: :on }
          elsif select_arr.inspect \
          =~/"--no-ocn"|"--exc-ocn"|"--no-numbering"|"--exc-numbering"/
            { bool: false, set: :off }
          else
            { bool: false, set: :na }
          end
          { bool: true, set: :on }
        else
          { bool: false, set: :na }
        end
        act[:xml_sax]=(select_arr.inspect \
        =~/"--xml-sax"|"--sax"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:xml_dom]=(select_arr.inspect \
        =~/"--xml-dom"|"--dom"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:xml_docbook_book]=(select_arr.inspect \
        =~/"--docbook"|"--docbook-book"|"--xml-docbook"|"--xml-docbook_book"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:xml_fictionbook]=(select_arr.inspect \
        =~/"--fictionbook"|"--xml-fictionbook"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:xml_scaffold_structure_sisu]=select_arr.inspect \
        =~/"--xml-scaffold"|"--xml-scaffold-sisu"/ \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:xml_scaffold_structure_collapse]=select_arr.inspect \
        =~/"--xml-scaffold-collapse"/ \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:xhtml]=(select_arr.inspect \
        =~/"--xhtml"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:txt]=if select_arr.inspect \
        =~/"--txt"|"--text"|"--plaintext"|"--txt-(?:ocn|numbering)"|"--text-(?:ocn|numbering)"|"--plaintext-(?:ocn|numbering)"/
          act[:txt_ocn]=if (select_arr.inspect \
          =~/"--txt-(?:ocn|numbering)"|"--text-(?:ocn|numbering)"|"--plaintext-(?:ocn|numbering)"/ \
          or select_arr.inspect \
          =~/"--ocn"|"--inc-ocn"|"--numbering"|"--inc-numbering"/)
            { bool: true, set: :on }
          elsif select_arr.inspect \
          =~/"--no-ocn"|"--exc-ocn"|"--no-numbering"|"--exc-numbering"/
            { bool: false, set: :off }
          else
            { bool: false, set: :na }
          end
          { bool: true, set: :on }
        else
          { bool: false, set: :na }
        end
        act[:txt_textile]=(select_arr.inspect \
        =~/"--textile"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:txt_asciidoc]=(select_arr.inspect \
        =~/"--asciidoc"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:txt_markdown]=(select_arr.inspect \
        =~/"--markdown"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:txt_rst]=(select_arr.inspect \
        =~/"--rst"|"--rest"|"--restructuredtext"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:txt_orgmode]=(select_arr.inspect \
        =~/"--org"|"--orgmode"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:manpage]=(select_arr.inspect \
        =~/"--manpage"|"--man"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:texinfo]=(select_arr.inspect \
        =~/"--texinfo"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:psql]=if select_arr.inspect \
        =~/"--pg-\S+"/ \
        or ((select_arr.inspect =~/"--pg"/) \
        && (select_arr.inspect \
        =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/))
          act[:psql_createdb]=if select_arr.inspect \
          =~/"--pg-createdb"|"--createdb"/
            { bool: true, set: :on }
          else
            { bool: false, set: :na }
          end
          if select_arr.inspect \
          =~/"--pg-recreate(?:all)?"|"--recreate(?:all)?"/
            act[:psql_drop]={ bool: true, set: :on }
            act[:psql_create]={ bool: true, set: :on }
          else
            act[:psql_drop]=if select_arr.inspect \
            =~/"--pg-dropall"|"--dropall"/
              { bool: true, set: :on }
            else
              { bool: false, set: :na }
            end
            act[:psql_create]=if select_arr.inspect \
            =~/"--pg-create(?:all)?"|"--create(?:all)?"/
              { bool: true, set: :on }
            else
              { bool: false, set: :na }
            end
          end
          act[:psql_import]=if select_arr.inspect \
          =~/"--pg-import"|"--import"/
            { bool: true, set: :on }
          else
            { bool: false, set: :na }
          end
          act[:psql_update]=if select_arr.inspect \
          =~/"--pg-update"|"--update"/
            act[:psql_remove]={ bool: true, set: :on }
            { bool: true, set: :on }
          else
            act[:psql_remove]=if select_arr.inspect \
            =~/"--pg-remove"|"--remove"/
              { bool: true, set: :on }
            else
              { bool: false, set: :na }
            end
            { bool: false, set: :na }
          end
          { bool: true, set: :on }
        else
          act[:psql_createdb]=
            { bool: false, set: :na }
          act[:psql_drop]=
            { bool: false, set: :na }
          act[:psql_create]=
            { bool: false, set: :na }
          act[:psql_import]=
            { bool: false, set: :na }
          act[:psql_update]=
            { bool: false, set: :na }
          act[:psql_remove]=
            { bool: false, set: :na }
          { bool: false, set: :na }
        end
        act[:sqlite]=if select_arr.inspect \
        =~/"--sqlite-\S+"/ \
        or (select_arr.inspect \
        =~/"--sqlite"/ \
        && select_arr.inspect \
        =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/)
          act[:sqlite_createdb]=if select_arr.inspect \
          =~/"--sqlite-createdb"|"--createdb"/
            { bool: true, set: :on }
          else
            { bool: false, set: :na }
          end
          if select_arr.inspect \
          =~/"--sqlite-recreate(?:all)?"|"--recreate(?:all)?"/
            act[:sqlite_drop]={ bool: true, set: :on }
            act[:sqlite_create]={ bool: true, set: :on }
          else
            act[:sqlite_create]=if select_arr.inspect \
            =~/"--sqlite-create(?:all)?"|"--create(?:all)?"/
              { bool: true, set: :on }
            else
              { bool: false, set: :na }
            end
            act[:sqlite_drop]=if select_arr.inspect \
            =~/"--sqlite-dropall"|"--dropall"/
              { bool: true, set: :on }
            else
              { bool: false, set: :na }
            end
          end
          act[:sqlite_import]=if select_arr.inspect \
          =~/"--sqlite-import"|"--import"/
            { bool: true, set: :on }
          else
            { bool: false, set: :na }
          end
          act[:sqlite_update]=if select_arr.inspect \
          =~/"--sqlite-update"|"--update"/
            act[:sqlite_remove]={ bool: true, set: :on }
            { bool: true, set: :on }
          else
            act[:sqlite_remove]=if select_arr.inspect \
            =~/"--sqlite-remove"|"--sqlite-remove"/
              { bool: true, set: :on }
            else
              { bool: false, set: :na }
            end
            { bool: false, set: :na }
          end
          { bool: true, set: :on }
        else
          act[:sqlite_createdb]=
            { bool: false, set: :na }
          act[:sqlite_drop]=
            { bool: false, set: :na }
          act[:sqlite_create]=
            { bool: false, set: :na }
          act[:sqlite_import]=
            { bool: false, set: :na }
          act[:sqlite_update]=
            { bool: false, set: :na }
          act[:sqlite_remove]=
            { bool: false, set: :na }
          { bool: false, set: :na }
        end
        act[:sqlite_discrete]=select_arr.inspect \
        =~/"--sql"|"--sqlite"/ \
        && (select_arr.inspect \
        !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:harvest]=(select_arr.inspect \
        =~/"--harvest"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:po4a_sstm]=(select_arr.inspect \
        =~/"--po4a-ss[tm]"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:po4a_sst_ao_sst]=(select_arr.inspect \
        =~/"--po4a-ao(?:-ss[tm])?"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:po4a_shelf]=(select_arr.inspect \
        =~/"--po4a-shelf"|"--pot?-shelf"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        if act[:po4a_shelf][:set]==:on \
        or act[:po4a_sst_ao_sst][:set]==:on \
        or act[:po4a_sstm][:set]==:on
          act[:po4a_lang]=if select_arr.inspect \
          =~/"--(?:trans|init)-([a-z]{2}):((?:(?:[a-z]{2}\b),?)+)/
            lng_src,lng_trn=$1,$2.split(',')
            { bool: true, set: :on, src: lng_src, trn: lng_trn }
          elsif select_arr.inspect \
          =~/"--trans"/
            { bool: true, set: :on }
            { bool: true, set: :on, src: 'en', trn: [] }
          else
            { bool: false, set: :na }
          end
          act[:po4a_lang_trans]=if select_arr.inspect \
          =~/"--trans-([a-z]{2}):((?:(?:[a-z]{2}\b),?)+)/
            lng_src,lng_trn=$1,$2.split(',')
            { bool: true, set: :on, src: lng_src, trn: lng_trn }
          elsif select_arr.inspect \
          =~/"--trans"/
            { bool: true, set: :on }
            { bool: true, set: :on, src: 'en', trn: [] }
          else
            { bool: false, set: :na }
          end
          act[:po4a_lang_init]=if select_arr.inspect \
          =~/"--init-([a-z]{2}):((?:(?:[a-z]{2}\b),?)+)/
            lng_src,lng_trn=$1,$2.split(',')
            { bool: true, set: :on, src: lng_src, trn: lng_trn }
          else
            { bool: false, set: :na }
          end
        else
          act[:po4a_lang_trans]= \
          { bool: false, set: :na }
          act[:po4a_lang_init]= \
          { bool: false, set: :na }
        end
        act[:git]=(select_arr.inspect \
        =~/"--git"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:hash_digests]=(select_arr.inspect \
        =~/"--digests?"|"--hash-digests"/) \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:pdf_font_size]=if select_arr.inspect \
        =~/"--(?:pdf-)?font-?size[=-](\d{1,2})(?:pt)?"/
          $1
        else :na
        end
        act[:pdf_hyperlink_colors]=if select_arr.inspect \
        =~/"--pdf-hyperlinks-(?:mono(?:chrome)?|no-color)"/
          :mono
        elsif select_arr.inspect \
        =~/"--pdf-hyperlinks-color"/
          :color
        else :na
        end
        act[:hash_digest_algo]=if select_arr.inspect \
        =~/"--hash-(?:sha)?512"/
          :sha512
        elsif select_arr.inspect \
        =~/"--hash-(?:sha)?256"/
          :sha256
        elsif select_arr.inspect \
        =~/"--hash-md5"/
          :md5
        else :na
        end
        act[:sample_search_form]=if select_arr.inspect \
        =~/"--sample-search-form"/
          if select_arr.inspect \
          =~/"--db[-=]pg"/
            { bool: true, set: :on, db: :pg }
          elsif select_arr.inspect \
          =~/"--db[-=]sqlite"/
            { bool: true, set: :on, db: :sqlite }
          else
            { bool: true, set: :on, db: :na }
          end
        else
          { bool: false, set: :na, db: :na }
        end
        act[:webrick]=select_arr.inspect \
        =~/"--webrick"/ \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:share_source]=select_arr.inspect \
        =~/"--source"/ \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:sisupod]=select_arr.inspect \
        =~/"--sisupod"/ \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:scp]=select_arr.inspect \
        =~/"--scp"/ \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:rsync]=select_arr.inspect \
        =~/"--rsync"|"--remote"/ \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:zap]=select_arr.inspect \
        =~/"--zap"|"--delete"/ \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:urls_all]=select_arr.inspect \
        =~/"--urls-all"/ \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:urls_selected]=if select_arr.inspect \
        =~/"--urls"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--harvest/
          { bool: false, set: :off }
        elsif select_arr.inspect \
        =~/"--verbose"|"--maintenance"/
          { bool: true, set: :on }
        else
          { bool: false, set: :na }
        end
        act[:sitemap]=select_arr.inspect \
        =~/"--sitemap"/ \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:qrcode]=select_arr.inspect \
        =~/"--qrcode"/ \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:help]=select_arr.inspect \
        =~/"--help/ \
        ? { bool: true, set: :on }
        : { bool: false, set: :na }
        act[:ao]=if select_arr.inspect \
        =~/"--ao"|"--dal"/
          { bool: true, set: :on }
        elsif (act[:txt][:set]==:on \
        || act[:txt_textile][:set]==:on \
        || act[:txt_asciidoc][:set]==:on \
        || act[:txt_markdown][:set]==:on \
        || act[:txt_rst][:set]==:on \
        || act[:txt_orgmode][:set]==:on \
        || act[:xhtml][:set]==:on \
        || act[:epub][:set]==:on \
        || act[:html][:set]==:on \
        || act[:html_seg][:set]==:on \
        || act[:html_scroll][:set]==:on \
        || act[:json][:set]==:on \
        || act[:texinfo][:set]==:on \
        || act[:manpage][:set]==:on \
        || act[:hash_digests][:set]==:on \
        || act[:odt][:set]==:on \
        || act[:pdf][:set]==:on \
        || act[:pdf_p][:set]==:on \
        || act[:pdf_l][:set]==:on \
        || act[:qrcode][:set]==:on \
        || act[:sisupod][:set]==:on \
        || act[:share_source][:set]==:on \
        || act[:po4a_sstm][:set]==:on \
        || act[:concordance][:set]==:on \
        || act[:sqlite_discrete][:set]==:on \
        || act[:sqlite_import][:set]==:on \
        || act[:sqlite_update][:set]==:on \
        || act[:sqlite_remove][:set]==:on \
        || act[:psql_import][:set]==:on \
        || act[:psql_update][:set]==:on \
        || act[:psql_remove][:set]==:on \
        || act[:xml_dom][:set]==:on \
        || act[:xml_sax][:set]==:on \
        || act[:xml_docbook_book][:set]==:on \
        || act[:xml_fictionbook][:set]==:on \
        || act[:xml_scaffold_structure_sisu][:set]==:on \
        || act[:xml_scaffold_structure_collapse][:set]==:on )
          { bool: true, set: :on }
        else
          { bool: false, set: :na }
        end
        act[:manifest]=if select_arr.inspect \
        =~/"--inc-manifest"/
          { bool: true, set: :on }
        elsif select_arr.inspect \
        =~/"--(?:exc|no)-manifest"/ \
        || act[:switch][:off].inspect =~/"manifest"/
          { bool: false, set: :off }
        elsif select_arr.inspect \
        =~/"--manifest"/
          { bool: true, set: :on }
        elsif (act[:txt][:set]==:on \
        || act[:txt_textile][:set]==:on \
        || act[:txt_asciidoc][:set]==:on \
        || act[:txt_markdown][:set]==:on \
        || act[:txt_rst][:set]==:on \
        || act[:txt_orgmode][:set]==:on \
        || act[:xhtml][:set]==:on \
        || act[:epub][:set]==:on \
        || act[:html][:set]==:on \
        || act[:html_seg][:set]==:on \
        || act[:html_scroll][:set]==:on \
        || act[:json][:set]==:on \
        || act[:texinfo][:set]==:on \
        || act[:manpage][:set]==:on \
        || act[:hash_digests][:set]==:on \
        || act[:odt][:set]==:on \
        || act[:pdf][:set]==:on \
        || act[:pdf_p][:set]==:on \
        || act[:pdf_l][:set]==:on \
        || act[:qrcode][:set]==:on \
        || act[:sisupod][:set]==:on \
        || act[:share_source][:set]==:on \
        || act[:po4a_sstm][:set]==:on \
        || act[:concordance][:set]==:on \
        || act[:xml_dom][:set]==:on \
        || act[:xml_sax][:set]==:on \
        || act[:xml_docbook_book][:set]==:on \
        || act[:xml_fictionbook][:set]==:on \
        || act[:xml_scaffold_structure_sisu][:set]==:on \
        || act[:xml_scaffold_structure_collapse][:set]==:on )
          { bool: true, set: :on }
        else { bool: true, set: :na }
        end
        act[:console_messages] = ''
        act[:verbose]=if select_arr.inspect \
        =~/"--verbose"/
          act[:console_messages] << ' --verbose '
          { bool: true, set: :on }
        else
          { bool: false, set: :na }
        end
        act[:verbose_plus]=if select_arr.inspect \
        =~/"--very-verbose"|"--verbose-very"/
          act[:console_messages] << ' --very-verbose '
          { bool: true, set: :on }
        else
          { bool: false, set: :na }
        end
        act[:version_info]=if select_arr.inspect \
        =~/"--version"|"--verbose"|"--maintenance"/
          act[:console_messages] << ' --maintenance '
          { bool: true, set: :on }
        else
          { bool: false, set: :na }
        end
        act[:quiet]=if (select_arr.inspect =~/"--quiet"/)
          act[:console_messages] << ' --quiet '
          { bool: true, set: :on }
        else
          { bool: false, set: :na }
        end
        act[:color_state]=if select_arr.inspect =~/"--color-on"|"--color"/
          act[:console_messages] << ' --color-on '
          { bool: true, set: :on }
        elsif (select_arr.inspect =~/"--color-off"/)
          act[:console_messages] << ' --color-off '
          { bool: false, set: :off }
        else { bool: true, set: :na } #fix default color
        end
#       act[:color_toggle]=if select_arr.inspect =~/"--color-toggle"/
#         true
#       else false
#       end
        act[:maintenance]=if (select_arr.inspect =~/"--maintenance|--keep-processing-files"/)
          act[:console_messages] << ' --maintenance '
          { bool: true, set: :on }
        else
          { bool: false, set: :na }
        end
        act[:profile]=if (select_arr.inspect =~/"--profile"/)
          act[:console_messages] << ' --color-off '
          { bool: true, set: :on }
        else
          { bool: false, set: :na }
        end
        @act=act
      end
    end
    def opt_ch
      @opt_ch
    end
    def selections
      def arr
        @select_arr.sort
      end
      def str
        @select_str ||= arr.join(' ')
      end
      self
    end
    def act
      @@act
    end
    def files_mod
      files_mod=files
      @files_mod=files_mod
    end
    def files
      @files
    end
    def f_pth
      @f_pth
    end
    def pth
      @pth
    end
    def sub_location
      pth.gsub(/#{base_path}/,'')
    end
    def lng
      @lng
    end
    def lng_base
      @lng_base
    end
    def fno
      @fno=(fns.nil? || fns.empty?) \
      ? '' \
      : (fns[/(.+?(?:sst|ssm))(?:\.sst)?/,1])
    end
    def fng
      @fng=(fno.nil? || fno.empty?) \
      ? '' \
      : (fno.gsub(/(?:~(?:#{Px[:lng_lst_rgx]}))?(\.ss[tm])$/,'\1'))
    end
    def fns
      @fns
    end
    def fnl
      @fns.gsub(/(\S+?)((?:\.ssm)?\.sst)/,"\\1.#{lng}\\2")
    end
    def what
      @what
    end
    def fnb
      (fns.nil? || fns.empty?) \
      ? '' \
      : (fns[/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/,1])
    end
    def fnc
      @fnc=(@fns =~/\.(?:ssm\.sst|ssm)$/) \
      ? fnb + '.ssm.sst'
      : @fns
    end
    def fncb
      @fncb=(@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/) \
      ? fnb + '.ssm.sst'
      : @fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1')
    end
  end
end
__END__
note usually named @opt is carried in dp document parameters (usually as @md.opt), @opt is a
subset of @md where @md is passed, contents of @opt are available as @md.opt
passing @opt as well is duplication check for fns & fnb
#+END_SRC

** hub_actions.rb

#+BEGIN_SRC ruby  :tangle "../lib/sisu/hub_actions.rb"
<<sisu_document_header>>
module SiSU_Hub_Actions
  class HubActions
    require_relative 'utils_composite'                    # utils_composite.rb
    include SiSU_Composite_Doc_Utils                      # composite doc, .ssm, extract all related insert files, array of filenames test
    def initialize(opt)
      @opt=opt
    end
    def report
      def version_info?
        if @opt.act[:version_info][:set]==:on
          SiSU_Env::InfoAbout.new(@opt).sisu_version
        end
      end
      def version_number_git?
        if @opt.act[:version_info][:set]==:on \
        || @opt.act[:verbose][:set]==:on \
        || @opt.act[:verbose_plus][:set]==:on \
        || @opt.act[:maintenance][:set]==:on
          SiSU_Screen::Ansi.new(
            @opt.act[:color_state][:set],
            ' ' + SiSU_is.git_version_info?
          ).grey
        end
      end
      def version_dir?
        if @opt.act[:version_info][:set]==:on \
        || @opt.act[:verbose][:set]==:on \
        || @opt.act[:verbose_plus][:set]==:on \
        || @opt.act[:maintenance][:set]==:on
          SiSU_Screen::Ansi.new(
            @opt.act[:color_state][:set],
            ' ' + File.dirname(__FILE__)
          ).grey
        end
      end
      def version_info_extra?
        if @opt.act[:version_info][:set]==:on \
        || @opt.act[:verbose][:set]==:on \
        || @opt.act[:verbose_plus][:set]==:on \
        || @opt.act[:maintenance][:set]==:on
          if SiSU_is.git_version_info?
            SiSU_Screen::Ansi.new(
              @opt.act[:color_state][:set],
              ' ' + File.dirname(__FILE__) + \
              '  vcr: ' + SiSU_is.git_version_info?
            ).grey
          else
            SiSU_Screen::Ansi.new(
              @opt.act[:color_state][:set],
              ' ' + File.dirname(__FILE__)
            ).grey
          end
        end
      end
      self
    end
    def prepare
      def site?
        if @opt.act[:site_init][:set]==:on               #% --init-site, -C initialize/configure
          require_relative 'conf'                        #% --init-site, -C initialize/configure
          SiSU_Initialize::Source.new(@opt).read
          if @opt.act[:rsync][:set]==:on
            if @opt.selections.str =~/--init(?:ialize)?=site/ \
            and @opt.selections.str =~/RZ/
              SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_rsync_match
            else SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_rsync
            end
          elsif @opt.act[:scp][:set]==:on
            if @opt.selections.str =~/--init(?:ialize)?=site/ \
            and @opt.selections.str =~/CCr/
              SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_all
            else SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site
            end
          end
        end
      end
      def remote_site?
        if @opt.act[:site_init][:set]==:on
          if @opt.act[:site_init][:set]==:on               #% --init-site, -C initialize/configure
            #require_relative 'conf'                        #% --init-site, -C initialize/configure
            #SiSU_Initialize::Source.new(@opt).read
            #if @opt.act[:rsync][:set]==:on
            #  if @opt.selections.str =~/--init(?:ialize)?=site/ \
            #  and @opt.selection =~/RZ/
            #    SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_rsync_match
            #  else SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_rsync
            #  end
            #elsif @opt.act[:scp][:set]==:on
            #  if @opt.selections.str =~/--init(?:ialize)?=site/ \
            #  and @opt.selection =~/CCr/
            #    SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site_all
            #  else SiSU_Hub_Actions::Operations.new(@opt).remote_put_base_site
            #  end
            #end
          end
        end
      end
      def sql?
        if @opt.act[:psql_createdb][:set]==:on \
        or @opt.act[:psql_create][:set]==:on \
        or @opt.act[:psql_drop][:set]==:on
          done=:ok
          if @opt.act[:psql][:set]==:on
            require_relative 'dbi'
            SiSU_DBI::SQL.new(@opt).connect
          end
        end
        if @opt.act[:sqlite_createdb][:set]==:on \
        or @opt.act[:sqlite_create][:set]==:on \
        or @opt.act[:sqlite_drop][:set]==:on
          done=:ok
          if @opt.act[:sqlite][:set]==:on
            require_relative 'dbi'
            SiSU_DBI::SQL.new(@opt).connect
          end
        end
      end
      def search_form?
        if @opt.act[:sample_search_form][:set]==:on      #% --sample-search-form, -F cgi sample search form
          SiSU_Hub_Actions::Operations.new(@opt).cgi
        end
      end
      def webrick?
        if @opt.act[:webrick][:set]==:on                 #% --webrick, -W webrick
          SiSU_Hub_Actions::Operations.new(@opt).webrick
        end
      end
      self
    end
    def outputs
      def each_file
        def abstract_objects?
          if @opt.act[:ao][:set]==:on                    #% --ao --dal, -m
            if @opt.f_pths.length > 0
              unless @opt.act[:po4a_shelf][:set]==:on    # --po4a-shelf
                if @opt.fno =~ /\.ssm$/
                  require_relative 'ao_composite'        # ao_composite.rb #pre-processing
                  SiSU_Assemble::Composite.new(@opt).read
                end
                require_relative 'ao'                    # ao.rb
                SiSU_AO::Source.new(@opt).read
              end
            else
              msg='document abstraction request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def qrcode?
          if @opt.act[:qrcode][:set]==:on                #% --qrcode, -Q
            if @opt.f_pths.length > 0
              require_relative 'qrcode'                  # qrcode.rb
              SiSU_QRcode::Source.new(@opt).read
            else
              msg='qrcode request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def hash_digests?
          if @opt.act[:hash_digests][:set]==:on          #% --hash-digests, -N digest tree
            if @opt.f_pths.length > 0
              require_relative 'digests'                 # digests.rb
              SiSU_DigestView::Source.new(@opt).read
            else
              msg='hash digest request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def text?
          if @opt.act[:txt][:set]==:on                   #% --txt, -t -a
            if @opt.f_pths.length > 0
              require_relative 'txt_plain'               #  txt_plain.rb
              SiSU_Txt_Plain::Source.new(@opt).read
            else
              msg='text request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:txt_textile][:set]==:on           #% --textile
            if @opt.f_pths.length > 0
              require_relative 'txt_textile'             #txt_textile.rb
              SiSU_Txt_Textile::Source.new(@opt).read
            else
              msg='textile request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:txt_asciidoc][:set]==:on          #% --asciidoc
            if @opt.f_pths.length > 0
              require_relative 'txt_asciidoc'            # txt_asciidoc.rb
              SiSU_Txt_AsciiDoc::Source.new(@opt).read
            else
              msg='asciidoc request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:txt_markdown][:set]==:on          #% --markdown
            if @opt.f_pths.length > 0
              require_relative 'txt_markdown'            # txt_markdown.rb
              SiSU_Txt_Markdown::Source.new(@opt).read
            else
              msg='markdown request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:txt_rst][:set]==:on               #% --rst, --rest
            if @opt.f_pths.length > 0
              require_relative 'txt_rst'                 # txt_rst.rb
              SiSU_Txt_rST::Source.new(@opt).read
            else
              msg='rst request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:txt_orgmode][:set]==:on          #% --orgmode
            if @opt.f_pths.length > 0
              require_relative 'txt_orgmode'            # txt_orgmode.rb
              SiSU_Txt_OrgMode::Source.new(@opt).read
            else
              msg='orgmode request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def html?
          if @opt.act[:html][:set]==:on                  #% --html, -h
            if @opt.f_pths.length > 0
              require_relative 'html'                    # html.rb
              SiSU_HTML::Source.new(@opt).read
            else
              msg='html request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          else
            if @opt.act[:html_seg][:set]==:on            #% --html-seg
              if @opt.f_pths.length > 0
                require_relative 'html'                  # html.rb
                SiSU_HTML::Source.new(@opt).read
              else
                msg='html seg request requires sisu markup files'
                if (@opt.act[:verbose_plus][:set]==:on \
                || @opt.act[:maintenance][:set]==:on)
                  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                    mark(msg)
                else puts msg
                end
              end
            end
            if @opt.act[:html_scroll][:set]==:on         #% --html-scroll
              if @opt.f_pths.length > 0
                require_relative 'html'                  # html.rb
                SiSU_HTML::Source.new(@opt).read
              else
                msg='html scroll request requires sisu markup files'
                if (@opt.act[:verbose_plus][:set]==:on \
                || @opt.act[:maintenance][:set]==:on)
                  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                    mark(msg)
                else puts msg
                end
              end
            end
          end
          if @opt.act[:concordance][:set]==:on           #% --concordance, -w
            if @opt.f_pths.length > 0
              require_relative 'html_concordance'        # html_concordance.rb
              SiSU_Concordance::Source.new(@opt).read
            else
              msg='concordance request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def json?
          if @opt.act[:json][:set]==:on                 #% --js, -J
            if @opt.f_pths.length > 0
              require_relative 'json'                   # json.rb
              SiSU_JSON::Source.new(@opt).read
            else
              msg='json request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def xhtml?
          if @opt.act[:xhtml][:set]==:on                 #% --xhtml, -b
            if @opt.f_pths.length > 0
              require_relative 'xhtml'                   # xhtml.rb
              SiSU_XHTML::Source.new(@opt).read
            else
              msg='xhtml request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:epub][:set]==:on                  #% --epub, -e
            if @opt.f_pths.length > 0
              require_relative 'xhtml_epub2'             # xhtml_epub2.rb
              SiSU_XHTML_EPUB2::Source.new(@opt).read
            else
              msg='epub request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def xml?
          if @opt.act[:odt][:set]==:on                   #% --odt, -o
            if @opt.f_pths.length > 0
              require_relative 'xml_odf_odt'             # xml_odf_odt.rb
              SiSU_XML_ODF_ODT::Source.new(@opt).read
            else
              msg='odt request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:xml_scaffold_structure_sisu][:set]==:on #% --xml-scaffold --xml-scaffold-sisu
            if @opt.f_pths.length > 0
              require_relative 'xml_scaffold_structure_sisu'   #  xml_scaffold_structure_sisu.rb
              SiSU_XML_Scaffold_Structure_Sisu::Source.new(@opt).read
            else
              msg='xml scaffold request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:xml_scaffold_structure_collapse][:set]==:on #% --xml-scaffold-collapse
            if @opt.f_pths.length > 0
              require_relative 'xml_scaffold_structure_collapsed'  # xml_scaffold_structure_collapsed.rb
              SiSU_XML_Scaffold_Structure_Collapse::Source.new(@opt).read
            else
              msg='xml scaffold request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:xml_docbook_book][:set]==:on      #% --xml-docbook
            if @opt.f_pths.length > 0
              require_relative 'xml_docbook5'            # xml_docbook5.rb
              SiSU_XML_Docbook_Book::Source.new(@opt).read
            else
              msg='docbook request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:xml_fictionbook][:set]==:on       #% --xml-fictionbook
            if @opt.f_pths.length > 0
              require_relative 'xml_fictionbook2'        # xml_fictionbook2.rb
              SiSU_XML_Fictionbook::Source.new(@opt).read
            else
              msg='fictionbook request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:xml_sax][:set]==:on               #% --xml-sax, -x
            if @opt.f_pths.length > 0
              require_relative 'xml_sax'                 # xml_sax.rb
              SiSU_XML_SAX::Source.new(@opt).read
            else
              msg='xml sax request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:xml_dom][:set]==:on               #% --xml-dom, -X
            if @opt.f_pths.length > 0
              require_relative 'xml_dom'                 # xml_dom.rb
              SiSU_XML_DOM::Source.new(@opt).read
            else
              msg='xml dom request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def pdf?
          if @opt.act[:pdf][:set]==:on \
          or @opt.act[:pdf_p][:set]==:on \
          or @opt.act[:pdf_l][:set]==:on                 #% --pdf-l --pdf, -p
            if @opt.f_pths.length > 0
              require_relative 'texpdf'                  # texpdf.rb
              SiSU_TeX::Source.new(@opt).read
            else
              msg='pdf request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def man_or_info?
          if @opt.act[:manpage][:set]==:on               #% --manpage, -i
            if @opt.f_pths.length > 0
              require_relative 'manpage'                 # manpage.rb
              SiSU_Manpage::Source.new(@opt).read
            else
              msg='manpage request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:texinfo][:set]==:on               #% --texinfo, -I
            if @opt.f_pths.length > 0
              require_relative 'texinfo'                 # texinfo.rb
              SiSU_TexInfo::Source.new(@opt).read
            else
              msg='texinfo request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def sqlite_discrete?
          if @opt.act[:sqlite_discrete][:set]==:on       #% --sqlite, -d
            if @opt.f_pths.length > 0
              require_relative 'dbi_discrete'            # dbi_discrete.rb
              SiSU_DBI_Discrete::SQL.new(@opt).build
            else
              msg='sqlite (discrete) request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def po4a_make?
          if @opt.act[:po4a_sst_ao_sst][:set]==:on               #% --po4a-ao
            if @opt.f_pths.length > 0
              require_relative 'src_po4a_sst_ao_sst'
              SiSU_SStm_AO_SStm::Source.new(@opt).read_process_src_files # src_po4a_sst_ao_sst.rb
            else
              msg='sst request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def elasticsearch?
          if @opt.act[:elasticsearch][:set]==:on         #% --elastic, -x
            if @opt.f_pths.length > 0
              require_relative 'json_elastic'            # json_elastic.rb
              SiSU_Elastic::Source.new(@opt).read
            else
              msg='easticsearch request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def manifest?
          if @opt.act[:manifest][:set]==:on              #% --manifest, -y
            if @opt.f_pths.length > 0
              begin
                require_relative 'html_manifest'           # html_manifest.rb
                ((@opt.act[:sisupod][:set]==:on \
                || @opt.act[:share_source][:set]==:on \
                || @opt.act[:po4a_sstm][:set]==:on) \
                && @opt.f_pths.length < 2 ) \
                ? nil
                : SiSU_Manifest::Source.new(@opt).read
              rescue
              end
            else
              msg='manifest request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def harvest?
          if @opt.act[:harvest][:set]==:on               #% --harvest
            if @opt.f_pths.length > 0
              require_relative 'html_harvest'            # html_harvest.rb
              SiSU_Harvest::Source.new(@opt).read
            else
              msg='harvest request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:yellow).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        self
      end
      def loop_files
        def share_source?
          if @opt.act[:sisupod][:set]==:on \
          or @opt.act[:share_source][:set]==:on \
          or @opt.act[:po4a_sstm][:set]==:on \
          or @opt.act[:git][:set]==:on
            begin
              if @opt.f_pths.length > 0
                require_relative 'src_shared'
                SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
                loop_files_on_given_option do
                  SiSU_Source::SiSUpodSource.new(@opt).read
                end
              else
                msg='share markup source request requires sisu markup files'
                if (@opt.act[:verbose_plus][:set]==:on \
                || @opt.act[:maintenance][:set]==:on)
                  SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
                    mark(msg)
                else puts msg
                end
              end
              if @opt.act[:sisupod][:set]==:on           #% --sisupod, -S
                if @opt.f_pths.length > 0
                  require_relative 'src_sisupod_make'    # src_sisupod_make.rb
                  begin
                    SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
                    loop_files_on_given_option_bundle do
                      SiSU_Doc::Source.new(@opt).sisupod_tar_xz
                    end
                  ensure
                  end
                else
                  msg='sisupod (share markup source) request requires sisu markup files'
                  if (@opt.act[:verbose_plus][:set]==:on \
                  || @opt.act[:maintenance][:set]==:on)
                    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
                      mark(msg)
                  else puts msg
                  end
                end
              end
              if @opt.act[:git][:set]==:on               #% --git, -g
                if @opt.f_pths.length > 0
                  require_relative 'git'                 # git.rb
                  begin
                    SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
                    loop_files_on_given_option do
                      SiSU_Git::Source.new(@opt).read
                    end
                  ensure
                    SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
                    loop_files_on_given_option_bundle do
                      SiSU_Git::Source.new(@opt).git_commit
                    end
                  end
                else
                  msg='git request requires sisu markup files'
                  if (@opt.act[:verbose_plus][:set]==:on \
                  || @opt.act[:maintenance][:set]==:on)
                    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
                      mark(msg)
                  else puts msg
                  end
                end
              end
              if (@opt.act[:sisupod][:set]==:on \
              || @opt.act[:share_source][:set]==:on \
              || @opt.act[:po4a_sstm][:set]==:on) \
              and @opt.act[:manifest][:set]==:on         #% --manifest, -y
                if @opt.f_pths.length > 0
                  require_relative 'html_manifest'            # html_manifest.rb
                  begin
                  ensure
                    SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
                    loop_files_on_given_option_bundle do
                      SiSU_Manifest::Source.new(@opt).read
                    end
                  end
                else
                  msg='manifest request requires sisu markup files'
                  if (@opt.act[:verbose_plus][:set]==:on \
                  || @opt.act[:maintenance][:set]==:on)
                    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
                      mark(msg)
                  else puts msg
                  end
                end
              end
            ensure
              if @opt.f_pths.length > 0
                env=SiSU_Env::InfoEnv.new(@opt.fns)
                path_pod=env.processing_path.processing_sisupod(@opt).paths
                unless @opt.act[:maintenance][:set]==:on
                  FileUtils::rm_rf("#{path_pod[:sisupod]}/*") \
                    if FileTest.directory?(path_pod[:sisupod])
                end
              else
                #SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
                #  mark('*** request requires sisu markup files')
              end
            end
          end
          if @opt.act[:share_source][:set]==:on
            if @opt.f_pths.length > 0
              require_relative 'src_sisupod_sstm'           # src_sisupod_sstm.rb
              begin
              ensure
                SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
                loop_files_on_given_option_bundle do
                  SiSU_Markup::Source_Sisupod.new(@opt).read
                end
              end
            else
              msg='share markup source request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:po4a_sstm][:set]==:on                    #% --po4a-sst
            if @opt.f_pths.length > 0
              require_relative 'src_po4a_sstm'
              begin
                SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
                loop_files_on_given_option do
                  SiSU_Markup::Source_Po4a.new(@opt).read       # src_po4a_sstm.rb
                end
              ensure
              end
            else
              msg='sst request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:po4a_sst_ao_sst][:set]==:on               #% --po4a-ao
            if @opt.f_pths.length > 0
              require_relative 'src_po4a_sst_ao_sst'
              begin
                SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
                loop_files_on_given_option do
                  SiSU_SStm_AO_SStm::Source.new(@opt).read_setup # src_po4a_sst_ao_sst.rb
                end
              ensure
              end
            else
              msg='sst request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:po4a_shelf][:set]==:on            #% --po4a-shelf
            if @opt.f_pths.length > 0
              require_relative 'src_po4a_shelf'
              begin
                SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
                loop_files_on_given_option do
                  SiSU_Po4a::Source.new(@opt).read       # src_po4a_shelf.rb
                end
              ensure
              end
            else
              msg='src_po4a_shelf request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:images][:set]==:on                #% --images, -j
            if @opt.f_pths.length > 0
              require_relative 'shared_images'
              SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
              loop_files_on_given_option do
                SiSU_Images::Source.new(@opt).read       # shared_images.rb
              end
            else
              msg='place images request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def run_termsheet? #broken, revisit later
          if @opt.selections.str =~/--termsheet/         #% -T termsheet/standard form #fix later
            if @opt.f_pths.length > 0
              @opt.files.each do |fns|
                if FileTest.file?(fns)
                  @opt.fns=fns
                  case @opt.fns
                  when /\.(termsheet.rb)$/
                    SiSU_Hub_Actions::Operations.new(@opt).termsheet
                  else                                   #print "not processed --> ", fns, "\n"
                  end
                else SiSU_Hub_Actions::Operations.new(@opt).not_found
                end
              end
            else
              msg='process termsheet request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def sql?
          if @opt.act[:psql][:set]==:on                  #% --pg, -D
            if @opt.f_pths.length > 0
              require_relative 'dbi'
              SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
              loop_files_on_given_option do
                SiSU_DBI::SQL.new(@opt).connect          # dbi.rb
              end
            else
              msg='pgsql request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
                  mark(msg)
              else puts msg
              end
            end
          end
          if @opt.act[:sqlite][:set]==:on                #% --sqlite, -d
            if @opt.f_pths.length > 0
              require_relative 'dbi'
              SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
              loop_files_on_given_option do
                SiSU_DBI::SQL.new(@opt).connect          # dbi.rb
              end
            else
              msg='sqlite request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        def manifest?
          if @opt.act[:manifest][:set]==:on              #% --manifest, -y
            if @opt.f_pths.length > 1
              require_relative 'html_manifest'
              SiSU_Hub_Loops::OptionLoopFiles.new(@opt).manifest_on_files_translated do
                SiSU_Manifest::Source.new(@opt).read     # html_manifest.rb
              end
            end
          end
        end
        def sitemaps?
          if @opt.act[:sitemap][:set]==:on               #% --sitemap, -Y
            if @opt.f_pths.length > 0
              require_relative 'sitemaps'
              SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
              loop_files_on_given_option do
                SiSU_Sitemaps::Source.new(@opt).read     # sitemaps.rb
              end
            end
          end
        end
        def remote_placement?
          if @opt.act[:harvest][:set] !=:on
            if @opt.act[:scp][:set]==:on                 #% -r copy to remote server
              if @opt.f_pths.length > 0
                require_relative 'remote'                # remote.rb
                SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
                loop_files_on_given_option do
                  SiSU_Remote::Put.new(@opt).scp
                end
              end
            end
            if @opt.act[:rsync][:set]==:on               #% -R copy to remote server
              if @opt.f_pths.length > 0
                require_relative 'remote'                # remote.rb
                SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
                loop_files_on_given_option do
                  SiSU_Remote::Put.new(@opt).rsync
                end
              end
            end
          else
          end
        end
        def urls?
          if @opt.act[:urls_selected][:set]==:on         #% --urls
            if @opt.f_pths.length > 0
              require_relative 'urls'
              SiSU_Hub_Loops::OptionLoopFiles.new(@opt).
              loop_files_on_given_option do
                SiSU_Urls::Source.new(@opt).read         #% urls.rb
              end
            else
              msg='urls request requires sisu markup files'
              if (@opt.act[:verbose_plus][:set]==:on \
              || @opt.act[:maintenance][:set]==:on)
                SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:cyan).
                  mark(msg)
              else puts msg
              end
            end
          end
        end
        self
      end
      def init?
        SiSU_Env::InfoProcessingFlag.new
        if @opt.act[:ao][:set]==:on \
        or @opt.act[:maintenance][:set]==:on             #% --maintenance, -M
          env=SiSU_Env::InfoEnv.new(@opt.fns)
          path={}
          path[:css]=env.path.output + '/_sisu/css'
          path[:xml]=env.path.output + '/_sisu/xml'
          path[:xsd]=path[:xml] + '/xsd'
          path[:xsd]=path[:xml] + '/rnc'
          path[:xsd]=path[:xml] + '/rng'
          re_p3=/(sisupod(?:\.txz)?|\S+?\.ss[mt]\.txz|[^\/]+?\.ssp)$/
          unless @opt.files.join(',') =~ re_p3 #do not mix pods with source markup files in command line
            if @opt.act[:maintenance][:set] ==:on
              $VERBOSE=false                             #debug $VERBOSE=true
            end
          end
          re_p2=/(sisupod(?:\.zip)?|\S+?\.ss[mt]\.zip)$/
          unless @opt.files.join(',') =~ re_p2 #do not mix pods with source markup files in command line
            if @opt.act[:maintenance][:set] ==:on
              $VERBOSE=false                             #debug $VERBOSE=true
            end
          end
        end
        if @opt.act[:ao][:set]==:on
          @retry_count= -1
          begin
            @get_s,@get_p,@get_pl=[],[],[]
            re_s=/(\S+?\.-sst)$/
            re_p3=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\.ssp))/
            re_pl3=/^(\/\S+?\.ss[mt]\.txz)/
            @opt.files.each do |fns|
              if fns =~re_s
                @get_s << @opt.f_pths[0][:url]
              end
              if fns =~re_p3
                @get_p << re_p3.match(fns)[1] if re_p3
              end
              if fns =~re_pl3
                @get_pl << re_pl3.match(fns)[1] if re_p3
              end
            end
            if @get_s.length > 0                         #% remote markup file .sst
              require_relative 'remote'                  # remote.rb
              SiSU_Remote::Get.new(@opt,@get_s).fns
              SiSU_Hub_Actions::Operations.new.counter
            end
            if @get_p.length > 0                         #% remote sisupod
              require_relative 'remote'                  # remote.rb
              SiSU_Remote::Get.new(@opt,@get_p).sisupod
            end
          rescue
            SiSU_Errors::Rescued.new($!,$@,@opt,@fns).location do
              __LINE__.to_s + ':' + __FILE__
            end
            @retry_count +=1
            retry unless @retry_count > 1
          ensure
          end
        end
      end
      self
    end
  end
  class Operations
    @@n_do=0
    def initialize(opt='')
      @opt=opt
      @cX=SiSU_Screen::Ansi.new(@opt).cX
    end
    def counter
      @@n_do=0
    end
    def remote_put_base_site_rsync                       # -CR
      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \
        if @opt.act[:maintenance][:set] ==:on
      require_relative 'remote'                          # remote.rb
      SiSU_Remote::Put.new(@opt).rsync_base
    end
    def remote_put_base_site_rsync_match                 # -CCRZ
      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \
        if @opt.act[:maintenance][:set] ==:on
      require_relative 'remote'                          # remote.rb
      SiSU_Remote::Put.new(@opt).rsync_base_sync
    end
    def remote_put_base_site                             # -Cr
      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \
        if @opt.act[:maintenance][:set] ==:on
      require_relative 'remote'                          # remote.rb
      SiSU_Remote::Put.new(@opt).scp_base
    end
    def remote_put_base_site_all                         # -CCr
      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).mark(:cyan) \
        if @opt.act[:maintenance][:set] ==:on
      require_relative 'remote'                          # remote.rb
      SiSU_Remote::Put.new(@opt).scp_base_all
    end
    def cgi                                              # -F
      require_relative 'cgi'                             # cgi.rb
      SiSU_CGI::SearchSQL.new(@opt).read
    end
    def termsheet                                        # -t
      system("sisu_termsheet #{@opt.selections.str} #{@opt.fns}\n")
      @@n_do=@@n_do+1
      SiSU_Screen::Ansi.new(
        @opt.selections.str,@@n_do,
        'Termsheet(s) processed'
      ).term_sheet_title unless @opt.act[:quiet][:set] ==:on
    end
    def webrick                                          # -W
      prt=SiSU_Env::InfoEnv.new(@fns).port.webrick_port
      puts %{#{@cX.blue}[#{@cX.off}#{@cX.green}Start Webrick web server on port: #{prt}#{@cX.off}#{@cX.blue}] #{@cX.off*2} }
      require_relative 'webrick'
      SiSU_Webserv::WebrickStart.new
    end
    def not_found
      puts "\n#{@cX.fuchsia}FILE NOT FOUND:#{@cX.off} [ #{@opt.fns} ] - requested #{@opt.selections.str} processing skipped\n"
    end
    def convert_name_message(fns,type,i,o,rune)
      %{\nIn filename: "#{@cX.fuchsia}#{fns}#{@cX.off}" [ #{type} ] #{@cX.fuchsia}is apre 0.36 markup filename.#{@cX.off} #{@cX.brown}Please rename your file.#{@cX.off}\n\tAs of sisu-0.37, SiSU markup files with #{@cX.brown}the extensions #{i} should be re-named #{o}#{@cX.off}\n\tif you have the program called 'rename' installed, the following rune should do the trick:\n\t\t#{rune}\n\talternatively try:\n\t\tsisu --convert --36to37 #{fns}\n\trequested #{@opt.selections.str} processing skipped\n}
    end
    def not_recognised
      case @opt.fns
      when /(\.s[123])$/
        type=@opt.fns.gsub(/\S+?(#{$1})/,'\1')
        rune=%q{rename 's/\.s[123]$/\.sst/' *.s{1,2,3}}
        puts convert_name_message(@opt.fns,type,'.s1 .s2 and .s3','.sst',rune)
      when /(\.r[123])$/
        type=@opt.fns.gsub(/\S+?(#{$1})/,'\1')
        rune=%q{rename 's/\.r[123]$/\.ssm/' *.r{1,2,3}}
        puts convert_name_message(@opt.fns,type,'.r1 .r2 and .r3','.sst',rune)
        puts %{\n\tNote also that you will need to change the names of the files called/required\n\twithin the document text to build the composite document\n\t\t.s1 .s2 .s3 should be .sst \n\t\t.si should be .ssi\n\trequested #{@opt.selections.str} processing skipped\n}
      when /(\.ssi)$/
        puts "\n#{@cX.fuchsia}component filetype:#{@cX.off} [ #{@opt.fns} ] - is not a processed filetype, (it may be used as a component of a .ssm markup file)\n\trequested #{@opt.selections.str} processing skipped\n"
      else
        puts "\n#{@cX.fuchsia}FILETYPE NOT RECOGNISED:#{@cX.off} [ #{@opt.fns} ] - is not a recognized filetype,\n\trequested #{@opt.selections.str} processing skipped\n"
      end
    end
  end
end
__END__
#+END_SRC

** hub_loop_markup_files.rb

#+BEGIN_SRC ruby  :tangle "../lib/sisu/hub_loop_markup_files.rb"
<<sisu_document_header>>
module SiSU_Hub_Loops
  require_relative 'constants'                         # constants.rb
  require_relative 'se'                                # se.rb
    include SiSU_Env
    include SiSU_Screen
  require_relative 'hub_actions'                       # hub_actions.rb
  require_relative 'hub_options'                       # hub_options.rb
  require_relative 'dp'                                # dp.rb
    include SiSU_Param
  require_relative 'utils'                             # utils.rb
  begin
    require 'uri'
  rescue LoadError
    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
      error('uri NOT FOUND (LoadError)')
  end
  class OptionLoopFiles
    attr_reader :opt
    def initialize(opt)
      @opt=opt
      @r=Px[:lng_lst_rgx]
    end
    def loop_files_on_given_option
      @opt.files.each_with_index do |fno,i|
        @opt.fno,@opt.fns=fno,fno
        @opt.f_pth=@opt.f_pths[i]
        if fno !~/\.-sst$/
          @opt.pth=@opt.paths[i]
          @opt.lng=@opt.lngs[i]
        end
        @@pwd=@opt.pth
        @opt.pth=@opt.f_pths[i][:pth]
        @opt.lng=@opt.f_pths[i][:lng]
        Dir.chdir(@opt.f_pth[:pth]) #watch
        SiSU_Env::FilenameLanguageCodeInsert.new(@opt,@opt.lng).language_code_insert # ... track
        @env=SiSU_Env::InfoEnv.new(fno)
        yield
      end
    end
    def loop_files_on_given_option_bundle
      @files_bundle={}
      @opt.files.each_with_index do |fno,i|
        fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'')
        unless @files_bundle[fn_base_bundle]
          @files_bundle[fn_base_bundle]={ status: :todo }
        end
      end
      @opt.files.each_with_index do |fno,i|
        fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'')
        unless @files_bundle[fn_base_bundle][:status] == :done
          @files_bundle[fn_base_bundle][:status] = :done
          @opt.fns=fno
          @opt.fno=fno
          @opt.f_pth=@opt.f_pths[i]
          if fno !~/\.-sst$/
            @opt.pth=@opt.paths[i]
            @opt.lng=@opt.lngs[i]
          end
          @@pwd=@opt.pth
          @opt.pth=@opt.f_pths[i][:pth]
          @opt.lng=@opt.f_pths[i][:lng]
          Dir.chdir(@opt.f_pth[:pth]) #watch
          @env=SiSU_Env::InfoEnv.new(fno)
          yield
        else next
        end
      end
    end
    def manifest_on_files_translated
      number_of_files={}
      @opt.files.each_with_index do |fns,i|
        fn=fns.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'')
        (number_of_files[fn].is_a?(Array)) \
        ? (number_of_files[fn] << i)
        : (number_of_files.store(fn,[i]))
      end
      files_translated_idx=[]
      number_of_files.each do |x|
        if x[1].length > 1
          files_translated_idx << x[1]
        end
      end
      #files_translated_idx=number_of_files.select do |x|
      #  x[1] if x[1].length > 1
      #end
      if files_translated_idx.flatten.length > 1
        SiSU_Screen::Ansi.new(
          @opt.act[:color_state][:set],
          'Manifest re-run on (currently generated) translated files',
          ''
        ).grey_title_hi unless @opt.act[:quiet][:set] ==:on
        files_translated_idx.flatten.each do |i|
          @opt.fns=@opt.files[i]
          @opt.f_pth=@opt.f_pths[i]
          if @opt.fns =~/\.-sst$/
            @opt.pth=Dir.pwd
            @opt.lng='en'
          elsif @opt.fno =~/\.txz$/
            @opt.pth=@opt.f_pths[i][:pth]
            @opt.lng=@opt.f_pths[i][:lng]
          else
            @opt.pth=@opt.f_pths[i][:pth]
            @opt.lng=@opt.f_pths[i][:lng]
          end
          @@pwd=@opt.pth
          Dir.chdir(@opt.pth) #watch
          @env=SiSU_Env::InfoEnv.new(@opt.fns)
          yield
        end
      end
    end
  end
end
__END__
#+END_SRC

* document header

#+NAME: sisu_document_header
#+BEGIN_SRC text
#encoding: utf-8
=begin
- Name: SiSU

  - Description: documents, structuring, processing, publishing, search
    hub

  - Author: Ralph Amissah
    <ralph.amissah@gmail.com>

  - Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
    2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2019,
    2020, 2021, Ralph Amissah,
    All Rights Reserved.

  - License: GPL 3 or later:

    SiSU, a framework for document structuring, publishing and search

    Copyright (C) Ralph Amissah

    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the Free
    Software Foundation, either version 3 of the License, or (at your option)
    any later version.

    This program is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
    more details.

    You should have received a copy of the GNU General Public License along with
    this program. If not, see <http://www.gnu.org/licenses/>.

    If you have Internet connection, the latest version of the GPL should be
    available at these locations:
    <http://www.fsf.org/licensing/licenses/gpl.html>
    <http://www.gnu.org/licenses/gpl.html>

    <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>

  - SiSU uses:
    - Standard SiSU markup syntax,
    - Standard SiSU meta-markup syntax, and the
    - Standard SiSU object citation numbering and system

  - Homepages:
    <http://www.sisudoc.org>

  - Git
    <https://git.sisudoc.org/projects/>
    <https://git.sisudoc.org/projects/?p=software/sisu.git;a=summary>
    <https://git.sisudoc.org/projects/?p=markup/sisu-markup-samples.git;a=summary>
=end
#+END_SRC