metanorma-cc 2.4.9 → 2.4.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe2592cfe0e3860ffde6f968c978635556778446af2776bd407bec55ab7319cf
4
- data.tar.gz: db15c336f162a1058907bb1fac7b8f28dc21f7c1cb1ccb9ae1c4bf99a1aa86d8
3
+ metadata.gz: c8f2b7e7fd63c5ab5ce4e695ade07ee618dbf8ee817022f1e3133a4411f723c3
4
+ data.tar.gz: 67255d49fe2837da5e1ca60b6d0c49de67dd5ed02edb749010e01695c16eab5f
5
5
  SHA512:
6
- metadata.gz: 3a6295e71347c35251e24b8d8513f91b7a03259156db59e2f3a8e2def335490a50a925b8992b283e87a659a40afe7e9c3df0e0bffe79df67c585a26bc8245a30
7
- data.tar.gz: 65c3ada103eb1ee274fbf64d8c737c6d51d54d55b42d1bdb98732ce20fce54194c12fc79249567e3ad11593bc7420213565b54b2cfa94fc71c454f25d494cb5a
6
+ metadata.gz: 0e723d5fae4498fc8ec14a61a8ddf473e9b038fb2ef5ffb98a54ad7072dd2f9179f7e6b68a647fd84f562aab6d589674c8791b304cb8ba8397785cb4445522b2
7
+ data.tar.gz: 99dd56b978048a49b52a8bd1b7cbda1fb9efab0d80606e06605fcf0a09b51e60e472c7f2e39fbbdad4c0e9afe86cfcb34fa18553a4d238ad3af8b5d88077388f
@@ -238,12 +238,12 @@
238
238
 
239
239
  <xsl:for-each select="xalan:nodeset($updated_xml)/*">
240
240
 
241
- <xsl:variable name="updated_xml_with_pages_preface">
242
- <xsl:call-template name="processPrefaceSectionsDefault_items"/>
241
+ <xsl:variable name="updated_xml_with_pages">
242
+ <xsl:call-template name="processPrefaceAndMainSectionsDefault_items"/>
243
243
  </xsl:variable>
244
244
 
245
- <xsl:for-each select="xalan:nodeset($updated_xml_with_pages_preface)"> <!-- set context to preface -->
246
- <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
245
+ <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface/sections -->
246
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][parent::*[local-name() = 'preface']][normalize-space() != '' or .//image or .//svg]">
247
247
 
248
248
  <!-- Copyright, Content, Foreword, etc. pages -->
249
249
  <fo:page-sequence master-reference="preface" format="i">
@@ -305,14 +305,8 @@
305
305
  </fo:flow>
306
306
  </fo:page-sequence>
307
307
  </xsl:for-each>
308
- </xsl:for-each>
309
-
310
- <xsl:variable name="updated_xml_with_pages_main">
311
- <xsl:call-template name="processMainSectionsDefault_items"/>
312
- </xsl:variable>
313
308
 
314
- <xsl:for-each select="xalan:nodeset($updated_xml_with_pages_main)"> <!-- set context to preface -->
315
- <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
309
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][not(parent::*[local-name() = 'preface'])][normalize-space() != '' or .//image or .//svg]">
316
310
 
317
311
  <!-- Document Pages -->
318
312
  <fo:page-sequence master-reference="document" format="1" force-page-count="no-force">
@@ -684,6 +678,8 @@
684
678
  <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
685
679
  <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
686
680
 
681
+ <xsl:variable name="document_scheme" select="normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'document-scheme']/*[local-name() = 'value'])"/>
682
+
687
683
  <!-- external parameters -->
688
684
 
689
685
  <xsl:param name="svg_images"/> <!-- svg images array -->
@@ -2321,56 +2317,9 @@
2321
2317
  </xsl:for-each>
2322
2318
  </xsl:template>
2323
2319
 
2324
- <xsl:template name="processPrefaceSectionsDefault_items">
2325
-
2326
- <xsl:variable name="updated_xml_step_move_pagebreak">
2327
-
2328
- <xsl:element name="{$root_element}" namespace="{$namespace_full}">
2329
-
2330
- <xsl:call-template name="copyCommonElements"/>
2331
-
2332
- <xsl:element name="preface" namespace="{$namespace_full}"> <!-- save context element -->
2333
- <xsl:element name="page_sequence" namespace="{$namespace_full}">
2334
- <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2335
- <xsl:sort select="@displayorder" data-type="number"/>
2336
- <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
2337
- </xsl:for-each>
2338
- </xsl:element>
2339
- </xsl:element>
2340
- </xsl:element>
2341
- </xsl:variable>
2342
-
2343
- <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_preface_', java:getTime(java:java.util.Date.new()), '.xml')"/>
2344
- <!-- <xsl:message>updated_xml_step_move_pagebreak_filename=<xsl:value-of select="$updated_xml_step_move_pagebreak_filename"/></xsl:message>
2345
- <xsl:message>start write updated_xml_step_move_pagebreak_filename</xsl:message> -->
2346
- <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
2347
- <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
2348
- </redirect:write>
2349
- <!-- <xsl:message>end write updated_xml_step_move_pagebreak_filename</xsl:message> -->
2350
-
2351
- <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2352
-
2353
- <!-- TODO: instead of
2354
- <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
2355
- in each template, add removing empty page_sequence here
2356
- -->
2357
-
2358
- <xsl:if test="$debug = 'true'">
2359
- <redirect:write file="page_sequence_preface.xml">
2360
- <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2361
- </redirect:write>
2362
- </xsl:if>
2363
-
2364
- <!-- <xsl:message>start delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
2365
- <xsl:call-template name="deleteFile">
2366
- <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
2367
- </xsl:call-template>
2368
- <!-- <xsl:message>end delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
2369
- </xsl:template> <!-- END: processPrefaceSectionsDefault_items -->
2370
-
2371
2320
  <xsl:template name="copyCommonElements">
2372
2321
  <!-- copy bibdata, localized-strings, metanorma-extension and boilerplate -->
2373
- <xsl:copy-of select="/*/*[local-name() != 'preface' and local-name() != 'sections' and local-name() != 'annex' and local-name() != 'bibliography']"/>
2322
+ <xsl:copy-of select="/*/*[local-name() != 'preface' and local-name() != 'sections' and local-name() != 'annex' and local-name() != 'bibliography' and local-name() != 'indexsect']"/>
2374
2323
  </xsl:template>
2375
2324
 
2376
2325
  <xsl:template name="processMainSectionsDefault">
@@ -2391,8 +2340,16 @@
2391
2340
  </xsl:for-each>
2392
2341
  </xsl:template><!-- END: processMainSectionsDefault -->
2393
2342
 
2394
- <!-- Example:
2343
+ <!-- Example:
2395
2344
  <iso-standard>
2345
+ <preface>
2346
+ <page_sequence>
2347
+ <clause...
2348
+ </page_sequence>
2349
+ <page_sequence>
2350
+ <clause...
2351
+ </page_sequence>
2352
+ </preface>
2396
2353
  <sections>
2397
2354
  <page_sequence>
2398
2355
  <clause...
@@ -2409,60 +2366,200 @@
2409
2366
  </page_sequence>
2410
2367
  </iso-standard>
2411
2368
  -->
2412
- <xsl:template name="processMainSectionsDefault_items">
2369
+ <xsl:template name="processPrefaceAndMainSectionsDefault_items">
2413
2370
 
2414
2371
  <xsl:variable name="updated_xml_step_move_pagebreak">
2415
-
2416
2372
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
2417
-
2418
2373
  <xsl:call-template name="copyCommonElements"/>
2374
+ <xsl:call-template name="insertPrefaceSectionsPageSequences"/>
2375
+ <xsl:call-template name="insertMainSectionsPageSequences"/>
2376
+ </xsl:element>
2377
+ </xsl:variable>
2419
2378
 
2420
- <xsl:element name="sections" namespace="{$namespace_full}"> <!-- save context element -->
2421
- <xsl:element name="page_sequence" namespace="{$namespace_full}">
2422
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2423
- <xsl:sort select="@displayorder" data-type="number"/>
2424
- <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
2379
+ <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
2425
2380
 
2426
- </xsl:for-each>
2427
- </xsl:element>
2381
+ <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
2382
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
2383
+ </redirect:write>
2384
+
2385
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2386
+
2387
+ <xsl:if test="$debug = 'true'">
2388
+ <redirect:write file="page_sequence_preface_and_main.xml">
2389
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
2390
+ </redirect:write>
2391
+ </xsl:if>
2392
+
2393
+ <xsl:call-template name="deleteFile">
2394
+ <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
2395
+ </xsl:call-template>
2396
+ </xsl:template> <!-- END: processPrefaceAndMainSectionsDefault_items -->
2397
+
2398
+ <xsl:template name="insertPrefaceSectionsPageSequences">
2399
+ <xsl:element name="preface" namespace="{$namespace_full}"> <!-- save context element -->
2400
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
2401
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2402
+ <xsl:sort select="@displayorder" data-type="number"/>
2403
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
2404
+ </xsl:for-each>
2405
+ </xsl:element>
2406
+ </xsl:element>
2407
+ </xsl:template> <!-- END: insertPrefaceSectionsPageSequences -->
2408
+
2409
+ <xsl:template name="insertMainSectionsPageSequences">
2410
+ <xsl:element name="sections" namespace="{$namespace_full}"> <!-- save context element -->
2411
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
2412
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2413
+ <xsl:sort select="@displayorder" data-type="number"/>
2414
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
2415
+
2416
+ </xsl:for-each>
2417
+ </xsl:element>
2418
+ </xsl:element>
2419
+
2420
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
2421
+ <xsl:for-each select="/*/*[local-name()='annex']">
2422
+ <xsl:sort select="@displayorder" data-type="number"/>
2423
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
2424
+ </xsl:for-each>
2425
+ </xsl:element>
2426
+
2427
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
2428
+ <xsl:element name="bibliography" namespace="{$namespace_full}"> <!-- save context element -->
2429
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2430
+ <xsl:sort select="@displayorder" data-type="number"/>
2431
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
2432
+ </xsl:for-each>
2433
+ </xsl:element>
2434
+ </xsl:element>
2435
+ </xsl:template> <!-- END: insertMainSectionsPageSequences -->
2436
+
2437
+ <xsl:template name="insertMainSectionsInSeparatePageSequences">
2438
+ <xsl:element name="sections" namespace="{$namespace_full}"> <!-- save context element -->
2439
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2440
+ <xsl:sort select="@displayorder" data-type="number"/>
2441
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
2442
+ <xsl:attribute name="main_page_sequence"/>
2443
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
2428
2444
  </xsl:element>
2445
+ </xsl:for-each>
2446
+ </xsl:element>
2447
+
2448
+ <xsl:call-template name="insertAnnexInSeparatePageSequences"/>
2429
2449
 
2450
+ <xsl:call-template name="insertBibliographyInSeparatePageSequences"/>
2451
+
2452
+ <!-- <xsl:call-template name="insertIndexInSeparatePageSequences"/> -->
2453
+ </xsl:template> <!-- END: insertMainSectionsInSeparatePageSequences -->
2454
+
2455
+ <xsl:template name="insertAnnexInSeparatePageSequences">
2456
+ <xsl:for-each select="/*/*[local-name()='annex']">
2457
+ <xsl:sort select="@displayorder" data-type="number"/>
2458
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
2459
+ <xsl:attribute name="main_page_sequence"/>
2460
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
2461
+ </xsl:element>
2462
+ </xsl:for-each>
2463
+ </xsl:template>
2464
+ <xsl:template name="insertBibliographyInSeparatePageSequences">
2465
+ <xsl:element name="bibliography" namespace="{$namespace_full}"> <!-- save context element -->
2466
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2467
+ <xsl:sort select="@displayorder" data-type="number"/>
2430
2468
  <xsl:element name="page_sequence" namespace="{$namespace_full}">
2431
- <xsl:for-each select="/*/*[local-name()='annex']">
2432
- <xsl:sort select="@displayorder" data-type="number"/>
2433
- <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
2434
- </xsl:for-each>
2469
+ <xsl:attribute name="main_page_sequence"/>
2470
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
2435
2471
  </xsl:element>
2472
+ </xsl:for-each>
2473
+ </xsl:element>
2474
+ </xsl:template>
2475
+ <xsl:template name="insertIndexInSeparatePageSequences">
2476
+ <xsl:for-each select="/*/*[local-name()='indexsect']">
2477
+ <xsl:sort select="@displayorder" data-type="number"/>
2478
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
2479
+ <xsl:attribute name="main_page_sequence"/>
2480
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
2481
+ </xsl:element>
2482
+ </xsl:for-each>
2483
+ </xsl:template>
2436
2484
 
2485
+ <xsl:template name="processAllSectionsDefault_items">
2486
+ <xsl:variable name="updated_xml_step_move_pagebreak">
2487
+ <xsl:element name="{$root_element}" namespace="{$namespace_full}">
2488
+ <xsl:call-template name="copyCommonElements"/>
2437
2489
  <xsl:element name="page_sequence" namespace="{$namespace_full}">
2438
- <xsl:element name="bibliography" namespace="{$namespace_full}"> <!-- save context element -->
2439
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2440
- <xsl:sort select="@displayorder" data-type="number"/>
2441
- <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
2442
- </xsl:for-each>
2443
- </xsl:element>
2490
+ <xsl:call-template name="insertPrefaceSections"/>
2491
+ <xsl:call-template name="insertMainSections"/>
2444
2492
  </xsl:element>
2445
2493
  </xsl:element>
2446
2494
  </xsl:variable>
2447
2495
 
2448
- <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
2449
-
2496
+ <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_preface_and_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
2497
+ <!-- <xsl:message>updated_xml_step_move_pagebreak_filename=<xsl:value-of select="$updated_xml_step_move_pagebreak_filename"/></xsl:message>
2498
+ <xsl:message>start write updated_xml_step_move_pagebreak_filename</xsl:message> -->
2450
2499
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
2451
2500
  <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
2452
2501
  </redirect:write>
2502
+ <!-- <xsl:message>end write updated_xml_step_move_pagebreak_filename</xsl:message> -->
2453
2503
 
2454
2504
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2455
2505
 
2506
+ <!-- TODO: instead of
2507
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
2508
+ in each template, add removing empty page_sequence here
2509
+ -->
2510
+
2456
2511
  <xsl:if test="$debug = 'true'">
2457
- <redirect:write file="page_sequence_main.xml">
2458
- <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
2512
+ <redirect:write file="page_sequence_preface_and_main.xml">
2513
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
2459
2514
  </redirect:write>
2460
2515
  </xsl:if>
2461
2516
 
2517
+ <!-- <xsl:message>start delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
2462
2518
  <xsl:call-template name="deleteFile">
2463
2519
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
2464
2520
  </xsl:call-template>
2465
- </xsl:template> <!-- END: processMainSectionsDefault_items -->
2521
+ <!-- <xsl:message>end delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
2522
+ </xsl:template> <!-- END: processAllSectionsDefault_items -->
2523
+
2524
+ <xsl:template name="insertPrefaceSections">
2525
+ <xsl:element name="preface" namespace="{$namespace_full}"> <!-- save context element -->
2526
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
2527
+ <xsl:sort select="@displayorder" data-type="number"/>
2528
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak">
2529
+ <xsl:with-param name="page_sequence_at_top">true</xsl:with-param>
2530
+ </xsl:apply-templates>
2531
+ </xsl:for-each>
2532
+ </xsl:element>
2533
+ </xsl:template>
2534
+
2535
+ <xsl:template name="insertMainSections">
2536
+ <xsl:element name="sections" namespace="{$namespace_full}"> <!-- save context element -->
2537
+
2538
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2539
+ <xsl:sort select="@displayorder" data-type="number"/>
2540
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak">
2541
+ <xsl:with-param name="page_sequence_at_top">true</xsl:with-param>
2542
+ </xsl:apply-templates>
2543
+
2544
+ </xsl:for-each>
2545
+ </xsl:element>
2546
+
2547
+ <xsl:for-each select="/*/*[local-name()='annex']">
2548
+ <xsl:sort select="@displayorder" data-type="number"/>
2549
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak">
2550
+ <xsl:with-param name="page_sequence_at_top">true</xsl:with-param>
2551
+ </xsl:apply-templates>
2552
+ </xsl:for-each>
2553
+
2554
+ <xsl:element name="bibliography" namespace="{$namespace_full}"> <!-- save context element -->
2555
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2556
+ <xsl:sort select="@displayorder" data-type="number"/>
2557
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak">
2558
+ <xsl:with-param name="page_sequence_at_top">true</xsl:with-param>
2559
+ </xsl:apply-templates>
2560
+ </xsl:for-each>
2561
+ </xsl:element>
2562
+ </xsl:template>
2466
2563
 
2467
2564
  <xsl:template name="deleteFile">
2468
2565
  <xsl:param name="filepath"/>
@@ -2507,9 +2604,16 @@
2507
2604
  <xsl:value-of select="substring-before($text, $tag_open)"/>
2508
2605
  <!-- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text> -->
2509
2606
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
2510
- <fo:inline keep-together.within-line="always">
2511
- <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2512
- </fo:inline>
2607
+ <xsl:choose>
2608
+ <xsl:when test="local-name(..) = 'keep-together_within-line'"> <!-- prevent two nested <fo:inline keep-together.within-line="always"><fo:inline keep-together.within-line="always" -->
2609
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2610
+ </xsl:when>
2611
+ <xsl:otherwise>
2612
+ <fo:inline keep-together.within-line="always" role="SKIP">
2613
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2614
+ </fo:inline>
2615
+ </xsl:otherwise>
2616
+ </xsl:choose>
2513
2617
  <!-- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text> -->
2514
2618
  <xsl:call-template name="replace_fo_inline_tags">
2515
2619
  <xsl:with-param name="tag_open" select="$tag_open"/>
@@ -3676,6 +3780,8 @@
3676
3780
  <xsl:with-param name="default">center</xsl:with-param>
3677
3781
  </xsl:call-template>
3678
3782
 
3783
+ <xsl:copy-of select="@keep-together.within-line"/>
3784
+
3679
3785
  <xsl:call-template name="refine_table-header-cell-style"/>
3680
3786
 
3681
3787
  <!-- experimental feature, see https://github.com/metanorma/metanorma-plateau/issues/30#issuecomment-2145461828 -->
@@ -3734,6 +3840,8 @@
3734
3840
  <xsl:with-param name="default">left</xsl:with-param>
3735
3841
  </xsl:call-template>
3736
3842
 
3843
+ <xsl:copy-of select="@keep-together.within-line"/>
3844
+
3737
3845
  <xsl:call-template name="refine_table-cell-style"/>
3738
3846
 
3739
3847
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
@@ -3764,6 +3872,7 @@
3764
3872
  <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
3765
3873
 
3766
3874
  <fo:block xsl:use-attribute-sets="table-note-style">
3875
+ <xsl:copy-of select="@id"/>
3767
3876
 
3768
3877
  <xsl:call-template name="refine_table-note-style"/>
3769
3878
 
@@ -3857,7 +3966,7 @@
3857
3966
  <xsl:copy-of select="."/>
3858
3967
  </xsl:for-each>
3859
3968
 
3860
- <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
3969
+ <xsl:if test="following-sibling::node()[normalize-space() != ''][1][local-name() = 'fn']">
3861
3970
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3862
3971
  </xsl:if>
3863
3972
 
@@ -3924,7 +4033,7 @@
3924
4033
  <xsl:copy-of select="node()"/>
3925
4034
  </fn>
3926
4035
  </xsl:for-each>
3927
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='boilerplate']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='bibliography']/*">
4036
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='boilerplate']/* | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='bibliography']/*">
3928
4037
  <xsl:sort select="@displayorder" data-type="number"/>
3929
4038
  <!-- commented:
3930
4039
  .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
@@ -3998,6 +4107,11 @@
3998
4107
 
3999
4108
  <xsl:template name="create_fn">
4000
4109
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4110
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
4111
+ <xsl:attribute name="id">
4112
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4113
+ </xsl:attribute>
4114
+ </xsl:if>
4001
4115
 
4002
4116
  <xsl:apply-templates/>
4003
4117
  </fn>
@@ -4141,6 +4255,11 @@
4141
4255
  <xsl:call-template name="refine_fn-reference-style"/>
4142
4256
 
4143
4257
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4258
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
4259
+ <xsl:attribute name="internal-destination">
4260
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4261
+ </xsl:attribute>
4262
+ </xsl:if>
4144
4263
 
4145
4264
  <xsl:value-of select="@reference"/>
4146
4265
 
@@ -5185,7 +5304,7 @@
5185
5304
 
5186
5305
  <xsl:template name="recursiveSmallCaps">
5187
5306
  <xsl:param name="text"/>
5188
- <xsl:param name="ratio"/>
5307
+ <xsl:param name="ratio">0.75</xsl:param>
5189
5308
  <xsl:variable name="char" select="substring($text,1,1)"/>
5190
5309
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
5191
5310
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
@@ -7285,6 +7404,8 @@
7285
7404
  </xsl:choose>
7286
7405
  </xsl:variable>
7287
7406
 
7407
+ <xsl:variable name="isPrecedingTitle" select="normalize-space(ancestor::*[local-name() = 'figure']/preceding-sibling::*[1][local-name() = 'title'] and 1 = 1)"/>
7408
+
7288
7409
  <xsl:choose>
7289
7410
  <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
7290
7411
  <fo:block>
@@ -7431,7 +7552,14 @@
7431
7552
  <xsl:variable name="scale_y">
7432
7553
  <xsl:choose>
7433
7554
  <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
7434
- <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
7555
+ <xsl:variable name="height_effective_px_">
7556
+ <xsl:choose>
7557
+ <!-- title is 'keep-with-next' with following figure -->
7558
+ <xsl:when test="$isPrecedingTitle = 'true'"><xsl:value-of select="$height_effective_px - 80"/></xsl:when>
7559
+ <xsl:otherwise><xsl:value-of select="$height_effective_px"/></xsl:otherwise>
7560
+ </xsl:choose>
7561
+ </xsl:variable>
7562
+ <xsl:value-of select="$height_effective_px_ div ($svg_height * $scale_x)"/>
7435
7563
  </xsl:when>
7436
7564
  <xsl:otherwise>1</xsl:otherwise>
7437
7565
  </xsl:choose>
@@ -7850,7 +7978,7 @@
7850
7978
  </xsl:if>
7851
7979
 
7852
7980
  <xsl:for-each select="$contents_nodes/doc">
7853
- <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
7981
+ <fo:bookmark internal-destination="{contents/item[@display = 'true'][1]/@id}" starting-state="hide">
7854
7982
  <xsl:if test="@bundle = 'true'">
7855
7983
  <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
7856
7984
  </xsl:if>
@@ -8169,8 +8297,11 @@
8169
8297
  </xsl:template>
8170
8298
 
8171
8299
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
8300
+ <xsl:param name="element"/>
8172
8301
  <xsl:copy>
8173
- <xsl:apply-templates mode="contents_item"/>
8302
+ <xsl:apply-templates mode="contents_item">
8303
+ <xsl:with-param name="element" select="$element"/>
8304
+ </xsl:apply-templates>
8174
8305
  </xsl:copy>
8175
8306
  </xsl:template>
8176
8307
 
@@ -8237,7 +8368,10 @@
8237
8368
 
8238
8369
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
8239
8370
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
8240
- <xsl:apply-templates mode="contents_item"/>
8371
+ <xsl:param name="element"/>
8372
+ <xsl:apply-templates mode="contents_item">
8373
+ <xsl:with-param name="element" select="$element"/>
8374
+ </xsl:apply-templates>
8241
8375
  </xsl:template>
8242
8376
 
8243
8377
  <!-- =============== -->
@@ -9063,9 +9197,17 @@
9063
9197
 
9064
9198
  <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
9065
9199
  <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
9066
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
9067
- <xsl:with-param name="fo_element" select="$fo_element"/>
9068
- </xsl:apply-templates>
9200
+ <xsl:variable name="example_body">
9201
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
9202
+ <xsl:with-param name="fo_element" select="$fo_element"/>
9203
+ </xsl:apply-templates>
9204
+ </xsl:variable>
9205
+ <xsl:choose>
9206
+ <xsl:when test="xalan:nodeset($example_body)/*">
9207
+ <xsl:copy-of select="$example_body"/>
9208
+ </xsl:when>
9209
+ <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
9210
+ </xsl:choose>
9069
9211
  </fo:block-container>
9070
9212
  </fo:block-container>
9071
9213
  </xsl:when> <!-- end block -->
@@ -9609,7 +9751,22 @@
9609
9751
 
9610
9752
  <!-- note: @top-level added in mode=" update_xml_step_move_pagebreak" -->
9611
9753
  <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'page_sequence']/*[not(@top-level)]" priority="2">
9612
- <xsl:call-template name="sections_node"/>
9754
+ <xsl:choose>
9755
+ <xsl:when test="local-name() = 'clause' and normalize-space() = '' and count(*) = 0"/>
9756
+ <xsl:otherwise>
9757
+ <xsl:call-template name="sections_node"/>
9758
+ </xsl:otherwise>
9759
+ </xsl:choose>
9760
+ </xsl:template>
9761
+
9762
+ <!-- page_sequence/sections/clause -->
9763
+ <xsl:template match="*[local-name() = 'page_sequence']/*[local-name() = 'sections']/*[not(@top-level)]" priority="2">
9764
+ <xsl:choose>
9765
+ <xsl:when test="local-name() = 'clause' and normalize-space() = '' and count(*) = 0"/>
9766
+ <xsl:otherwise>
9767
+ <xsl:call-template name="sections_node"/>
9768
+ </xsl:otherwise>
9769
+ </xsl:choose>
9613
9770
  </xsl:template>
9614
9771
 
9615
9772
  <xsl:template name="sections_element_style">
@@ -9631,8 +9788,24 @@
9631
9788
  </fo:block>
9632
9789
  </xsl:template>
9633
9790
 
9634
- <xsl:template match="*[local-name() = 'preface']/*[local-name() = 'page_sequence']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9635
- <xsl:call-template name="preface_node"/>
9791
+ <!-- preface/ page_sequence/clause -->
9792
+ <xsl:template match="*[local-name() = 'preface']/*[local-name() = 'page_sequence']/*[not(@top-level)]" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9793
+ <xsl:choose>
9794
+ <xsl:when test="local-name() = 'clause' and normalize-space() = '' and count(*) = 0"/>
9795
+ <xsl:otherwise>
9796
+ <xsl:call-template name="preface_node"/>
9797
+ </xsl:otherwise>
9798
+ </xsl:choose>
9799
+ </xsl:template>
9800
+
9801
+ <!-- page_sequence/preface/clause -->
9802
+ <xsl:template match="*[local-name() = 'page_sequence']/*[local-name() = 'preface']/*[not(@top-level)]" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9803
+ <xsl:choose>
9804
+ <xsl:when test="local-name() = 'clause' and normalize-space() = '' and count(*) = 0"/>
9805
+ <xsl:otherwise>
9806
+ <xsl:call-template name="preface_node"/>
9807
+ </xsl:otherwise>
9808
+ </xsl:choose>
9636
9809
  </xsl:template>
9637
9810
 
9638
9811
  <xsl:template match="*[local-name() = 'clause'][normalize-space() != '' or *[local-name() = 'figure'] or @id]" name="template_clause"> <!-- if clause isn't empty -->
@@ -10942,7 +11115,14 @@
10942
11115
  </redirect:write> -->
10943
11116
  </xsl:if>
10944
11117
 
11118
+ <!-- <xsl:if test="$debug = 'true'"><xsl:message>START copying updated_xml_step3</xsl:message></xsl:if>
11119
+ <xsl:variable name="startTime4" select="java:getTime(java:java.util.Date.new())"/> -->
10945
11120
  <xsl:copy-of select="$updated_xml_step3"/>
11121
+ <!-- <xsl:variable name="endTime4" select="java:getTime(java:java.util.Date.new())"/>
11122
+ <xsl:if test="$debug = 'true'">
11123
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime4 - $startTime4"/> msec.</xsl:message>
11124
+ <xsl:message>END copying updated_xml_step3</xsl:message>
11125
+ </xsl:if> -->
10946
11126
 
10947
11127
  </xsl:template>
10948
11128
 
@@ -11124,14 +11304,17 @@
11124
11304
  <!-- STEP MOVE PAGEBREAK: move <pagebreak/> at top level under 'preface' and 'sections' -->
11125
11305
  <!-- =========================================================================== -->
11126
11306
  <xsl:template match="@*|node()" mode="update_xml_step_move_pagebreak">
11307
+ <xsl:param name="page_sequence_at_top">false</xsl:param>
11127
11308
  <xsl:copy>
11128
- <xsl:apply-templates select="@*|node()" mode="update_xml_step_move_pagebreak"/>
11309
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step_move_pagebreak">
11310
+ <xsl:with-param name="page_sequence_at_top" select="$page_sequence_at_top"/>
11311
+ </xsl:apply-templates>
11129
11312
  </xsl:copy>
11130
11313
  </xsl:template>
11131
11314
 
11132
11315
  <!-- replace 'pagebreak' by closing tags + page_sequence and opening page_sequence + tags -->
11133
11316
  <xsl:template match="*[local-name() = 'pagebreak'][not(following-sibling::*[1][local-name() = 'pagebreak'])]" mode="update_xml_step_move_pagebreak">
11134
-
11317
+ <xsl:param name="page_sequence_at_top"/>
11135
11318
  <!-- <xsl:choose>
11136
11319
  <xsl:when test="ancestor::*[local-name() = 'sections']">
11137
11320
 
@@ -11155,7 +11338,9 @@
11155
11338
  <xsl:variable name="orientation" select="normalize-space(@orientation)"/>
11156
11339
 
11157
11340
  <xsl:variable name="tree_">
11158
- <xsl:call-template name="makeAncestorsElementsTree"/>
11341
+ <xsl:call-template name="makeAncestorsElementsTree">
11342
+ <xsl:with-param name="page_sequence_at_top" select="$page_sequence_at_top"/>
11343
+ </xsl:call-template>
11159
11344
  </xsl:variable>
11160
11345
  <xsl:variable name="tree" select="xalan:nodeset($tree_)"/>
11161
11346
 
@@ -11177,12 +11362,26 @@
11177
11362
  </xsl:template>
11178
11363
 
11179
11364
  <xsl:template name="makeAncestorsElementsTree">
11180
- <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11181
- <element pos="{position()}">
11182
- <xsl:copy-of select="@*[local-name() != 'id']"/>
11183
- <xsl:value-of select="name()"/>
11184
- </element>
11185
- </xsl:for-each>
11365
+ <xsl:param name="page_sequence_at_top"/>
11366
+
11367
+ <xsl:choose>
11368
+ <xsl:when test="$page_sequence_at_top = 'true'">
11369
+ <xsl:for-each select="ancestor::*[ancestor::*[contains(local-name(), '-standard')]]">
11370
+ <element pos="{position()}">
11371
+ <xsl:copy-of select="@*[local-name() != 'id']"/>
11372
+ <xsl:value-of select="name()"/>
11373
+ </element>
11374
+ </xsl:for-each>
11375
+ </xsl:when>
11376
+ <xsl:otherwise>
11377
+ <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
11378
+ <element pos="{position()}">
11379
+ <xsl:copy-of select="@*[local-name() != 'id']"/>
11380
+ <xsl:value-of select="name()"/>
11381
+ </element>
11382
+ </xsl:for-each>
11383
+ </xsl:otherwise>
11384
+ </xsl:choose>
11186
11385
  </xsl:template>
11187
11386
 
11188
11387
  <xsl:template name="insertClosingElements">
@@ -11220,11 +11419,14 @@
11220
11419
 
11221
11420
  <!-- move full page width figures, tables at top level -->
11222
11421
  <xsl:template match="*[local-name() = 'figure' or local-name() = 'table'][normalize-space(@width) != 'text-width']" mode="update_xml_step_move_pagebreak">
11422
+ <xsl:param name="page_sequence_at_top">false</xsl:param>
11223
11423
  <xsl:choose>
11224
11424
  <xsl:when test="$layout_columns != 1">
11225
11425
 
11226
11426
  <xsl:variable name="tree_">
11227
- <xsl:call-template name="makeAncestorsElementsTree"/>
11427
+ <xsl:call-template name="makeAncestorsElementsTree">
11428
+ <xsl:with-param name="page_sequence_at_top" select="$page_sequence_at_top"/>
11429
+ </xsl:call-template>
11228
11430
  </xsl:variable>
11229
11431
  <xsl:variable name="tree" select="xalan:nodeset($tree_)"/>
11230
11432
 
@@ -11268,81 +11470,140 @@
11268
11470
 
11269
11471
  <xsl:variable name="express_reference_separators">_.\</xsl:variable>
11270
11472
  <xsl:variable name="express_reference_characters" select="concat($upper,$lower,'1234567890',$express_reference_separators)"/>
11473
+ <xsl:variable name="regex_express_reference">(^([A-Za-z0-9_.\\]+)$)</xsl:variable>
11271
11474
 
11272
11475
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
11476
+ <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
11477
+ <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
11273
11478
 
11274
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
11479
+ <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
11480
+ <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
11481
+ <!-- add &lt; and &gt; to \S -->
11482
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
11483
+ <xsl:variable name="regex_solidus_units">((\b((<xsl:value-of select="$regex_S"/>{1,3}\/<xsl:value-of select="$regex_S"/>+)|(<xsl:value-of select="$regex_S"/>+\/<xsl:value-of select="$regex_S"/>{1,3}))\b)|(\/<xsl:value-of select="$regex_S"/>{1,3})\b)</xsl:variable>
11275
11484
 
11276
- <!-- enclose standard's number into tag 'keep-together_within-line' -->
11277
- <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
11278
- <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
11279
- <xsl:variable name="text__" select="java:replaceAll(java:java.lang.String.new(.), $regex_standard_reference, concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
11280
- <xsl:variable name="text_">
11281
- <xsl:choose>
11282
- <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when> <!-- no need enclose standard's number into tag 'keep-together_within-line' in table cells -->
11283
- <xsl:otherwise><xsl:value-of select="$text__"/></xsl:otherwise>
11284
- </xsl:choose>
11285
- </xsl:variable>
11286
- <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
11485
+ <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
11486
+ <xsl:variable name="regex_dots_units">((\b((<xsl:value-of select="$non_white_space"/>{1,3}\.<xsl:value-of select="$non_white_space"/>+)|(<xsl:value-of select="$non_white_space"/>+\.<xsl:value-of select="$non_white_space"/>{1,3}))\b)|(\.<xsl:value-of select="$non_white_space"/>{1,3})\b)</xsl:variable>
11487
+
11488
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') or normalize-space() = '' )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
11489
+
11490
+ <xsl:variable name="parent" select="local-name(..)"/>
11491
+
11492
+ <xsl:if test="1 = 2"> <!-- alternative variant -->
11493
+
11494
+ <xsl:variable name="regexs">
11495
+ <!-- enclose standard's number into tag 'keep-together_within-line' -->
11496
+ <xsl:if test="not(ancestor::*[local-name() = 'table'])"><regex><xsl:value-of select="$regex_standard_reference"/></regex></xsl:if>
11497
+ <!-- if EXPRESS reference -->
11498
+
11499
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
11500
+ <regex><xsl:value-of select="$regex_solidus_units"/></regex>
11501
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
11502
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
11503
+ <regex><xsl:value-of select="$regex_dots_units"/></regex>
11504
+ </xsl:if>
11505
+ </xsl:variable>
11506
+
11507
+ <xsl:variable name="regex_replacement"><xsl:text>(</xsl:text>
11508
+ <xsl:for-each select="xalan:nodeset($regexs)/regex">
11509
+ <xsl:value-of select="."/>
11510
+ <xsl:if test="position() != last()">|</xsl:if>
11511
+ </xsl:for-each>
11512
+ <xsl:text>)</xsl:text>
11513
+ </xsl:variable>
11514
+
11515
+ <!-- regex_replacement='<xsl:value-of select="$regex_replacement"/>' -->
11516
+
11517
+ <xsl:variable name="text_replaced" select="java:replaceAll(java:java.lang.String.new(.), $regex_replacement, concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
11518
+
11519
+ <!-- text_replaced='<xsl:value-of select="$text_replaced"/>' -->
11520
+
11521
+ <xsl:call-template name="replace_text_tags">
11287
11522
  <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
11288
11523
  <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
11289
- <xsl:with-param name="text" select="$text_"/>
11290
- </xsl:call-template></text></xsl:variable>
11524
+ <xsl:with-param name="text" select="$text_replaced"/>
11525
+ </xsl:call-template>
11526
+ </xsl:if>
11291
11527
 
11292
- <xsl:variable name="parent" select="local-name(..)"/>
11528
+ <xsl:if test="1 = 1">
11529
+
11530
+ <!-- enclose standard's number into tag 'keep-together_within-line' -->
11531
+ <xsl:variable name="text">
11532
+ <xsl:element name="text" namespace="{$namespace_full}">
11533
+ <xsl:choose>
11534
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when> <!-- no need enclose standard's number into tag 'keep-together_within-line' in table cells -->
11535
+ <xsl:otherwise>
11536
+ <xsl:variable name="text_" select="java:replaceAll(java:java.lang.String.new(.), $regex_standard_reference, concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
11537
+ <!-- <xsl:value-of select="$text__"/> -->
11538
+
11539
+ <xsl:call-template name="replace_text_tags">
11540
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
11541
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
11542
+ <xsl:with-param name="text" select="$text_"/>
11543
+ </xsl:call-template>
11544
+
11545
+ </xsl:otherwise>
11546
+ </xsl:choose>
11547
+ </xsl:element>
11548
+ </xsl:variable>
11293
11549
 
11294
11550
  <xsl:variable name="text2">
11295
- <text><xsl:for-each select="xalan:nodeset($text)/text/node()">
11551
+ <xsl:element name="text" namespace="{$namespace_full}">
11552
+ <xsl:for-each select="xalan:nodeset($text)/*[local-name() = 'text']/node()">
11296
11553
  <xsl:copy-of select="."/>
11297
- </xsl:for-each></text>
11554
+ </xsl:for-each>
11555
+ </xsl:element>
11298
11556
  </xsl:variable>
11299
11557
 
11300
11558
  <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
11301
- <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
11302
- <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
11303
- <!-- add &lt; and &gt; to \S -->
11304
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
11305
- <xsl:variable name="regex_solidus_units">((\b((<xsl:value-of select="$regex_S"/>{1,3}\/<xsl:value-of select="$regex_S"/>+)|(<xsl:value-of select="$regex_S"/>+\/<xsl:value-of select="$regex_S"/>{1,3}))\b)|(\/<xsl:value-of select="$regex_S"/>{1,3})\b)</xsl:variable>
11306
11559
  <xsl:variable name="text3">
11307
- <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
11308
- <xsl:choose>
11309
- <xsl:when test="self::text()">
11310
- <xsl:variable name="text_units_" select="java:replaceAll(java:java.lang.String.new(.),$regex_solidus_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
11311
- <xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
11312
- <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
11313
- <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
11314
- <xsl:with-param name="text" select="$text_units_"/>
11315
- </xsl:call-template></text></xsl:variable>
11316
- <xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
11317
- </xsl:when>
11318
- <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
11319
- </xsl:choose>
11320
- </xsl:for-each></text>
11560
+ <xsl:element name="text" namespace="{$namespace_full}">
11561
+ <xsl:for-each select="xalan:nodeset($text2)/*[local-name() = 'text']/node()">
11562
+ <xsl:choose>
11563
+ <xsl:when test="self::text()">
11564
+ <xsl:variable name="text_units" select="java:replaceAll(java:java.lang.String.new(.),$regex_solidus_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
11565
+ <!-- <xsl:variable name="text_units">
11566
+ <xsl:element name="text" namespace="{$namespace_full}"> -->
11567
+ <xsl:call-template name="replace_text_tags">
11568
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
11569
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
11570
+ <xsl:with-param name="text" select="$text_units"/>
11571
+ </xsl:call-template>
11572
+ <!-- </xsl:element>
11573
+ </xsl:variable>
11574
+ <xsl:copy-of select="xalan:nodeset($text_units)/*[local-name() = 'text']/node()"/> -->
11575
+ </xsl:when>
11576
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
11577
+ </xsl:choose>
11578
+ </xsl:for-each>
11579
+ </xsl:element>
11321
11580
  </xsl:variable>
11322
11581
 
11323
11582
  <xsl:choose>
11324
11583
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
11325
11584
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
11326
- <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
11327
- <xsl:variable name="regex_dots_units">((\b((<xsl:value-of select="$non_white_space"/>{1,3}\.<xsl:value-of select="$non_white_space"/>+)|(<xsl:value-of select="$non_white_space"/>+\.<xsl:value-of select="$non_white_space"/>{1,3}))\b)|(\.<xsl:value-of select="$non_white_space"/>{1,3})\b)</xsl:variable>
11328
- <xsl:for-each select="xalan:nodeset($text3)/text/node()">
11585
+ <xsl:for-each select="xalan:nodeset($text3)/*[local-name() = 'text']/node()">
11329
11586
  <xsl:choose>
11330
11587
  <xsl:when test="self::text()">
11331
- <xsl:variable name="text_dots_" select="java:replaceAll(java:java.lang.String.new(.),$regex_dots_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
11332
- <xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
11333
- <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
11334
- <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
11335
- <xsl:with-param name="text" select="$text_dots_"/>
11336
- </xsl:call-template></text></xsl:variable>
11337
- <xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
11588
+ <xsl:variable name="text_dots" select="java:replaceAll(java:java.lang.String.new(.),$regex_dots_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
11589
+ <!-- <xsl:variable name="text_dots">
11590
+ <xsl:element name="text" namespace="{$namespace_full}"> -->
11591
+ <xsl:call-template name="replace_text_tags">
11592
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
11593
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
11594
+ <xsl:with-param name="text" select="$text_dots"/>
11595
+ </xsl:call-template>
11596
+ <!-- </xsl:element>
11597
+ </xsl:variable>
11598
+ <xsl:copy-of select="xalan:nodeset($text_dots)/*[local-name() = 'text']/node()"/> -->
11338
11599
  </xsl:when>
11339
11600
  <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
11340
11601
  </xsl:choose>
11341
11602
  </xsl:for-each>
11342
11603
  </xsl:when>
11343
- <xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
11604
+ <xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/*[local-name() = 'text']/node()"/></xsl:otherwise>
11344
11605
  </xsl:choose>
11345
-
11606
+ </xsl:if>
11346
11607
  </xsl:template>
11347
11608
 
11348
11609
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
@@ -11865,6 +12126,15 @@
11865
12126
  </xsl:otherwise>
11866
12127
  </xsl:choose>
11867
12128
  </xsl:for-each>
12129
+ <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
12130
+ <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
12131
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
12132
+ <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
12133
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, $attachment_path, ')')"/>
12134
+ <xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
12135
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$filename_embedded}"/>
12136
+ </xsl:for-each>
12137
+ </xsl:if>
11868
12138
  </xsl:template> <!-- addPDFUAmeta -->
11869
12139
 
11870
12140
  <xsl:template name="getId">
@@ -778,7 +778,7 @@ body {
778
778
  width: 323px;
779
779
  font-size: 0.9em;
780
780
  overflow: auto;
781
- padding: 0 0 0 45px;
781
+ padding: 0 0 0 30px;
782
782
  background-color: #f7f7f7; } }
783
783
 
784
784
  @media print {
@@ -41,7 +41,7 @@ body {
41
41
 
42
42
  nav {
43
43
  @include sidebarNav(
44
- $offsetLeft: 45px,
44
+ $offsetLeft: 30px,
45
45
  $colorBg: #f7f7f7,
46
46
  $width: 323px);
47
47
 
@@ -13,9 +13,9 @@
13
13
  <ref name="csd-standard"/>
14
14
  </start>
15
15
  <define name="FigureBody">
16
- <optional>
16
+ <zeroOrMore>
17
17
  <ref name="source"/>
18
- </optional>
18
+ </zeroOrMore>
19
19
  <optional>
20
20
  <ref name="tname"/>
21
21
  </optional>
@@ -17,7 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
- <!-- VERSION v1.3.2 -->
20
+ <!-- VERSION v1.3.3 -->
21
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
22
22
  <include href="reqt.rng"/>
23
23
  <include href="basicdoc.rng">
@@ -331,9 +331,9 @@
331
331
  <zeroOrMore>
332
332
  <ref name="table-note"/>
333
333
  </zeroOrMore>
334
- <optional>
334
+ <zeroOrMore>
335
335
  <ref name="source"/>
336
- </optional>
336
+ </zeroOrMore>
337
337
  </define>
338
338
  <define name="FigureAttr">
339
339
  <optional>
@@ -380,9 +380,9 @@
380
380
  <zeroOrMore>
381
381
  <ref name="note"/>
382
382
  </zeroOrMore>
383
- <optional>
383
+ <zeroOrMore>
384
384
  <ref name="source"/>
385
- </optional>
385
+ </zeroOrMore>
386
386
  </define>
387
387
  <define name="source">
388
388
  <element name="source">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "2.4.9".freeze
3
+ VERSION = "2.4.11".freeze
4
4
  end
5
5
  end
data/metanorma-cc.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.bindir = "exe"
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ["lib"]
30
- spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
30
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
31
31
 
32
32
  spec.add_dependency "metanorma-generic", "~> 2.6.2"
33
33
 
data/metanorma.yml CHANGED
@@ -12,7 +12,6 @@ htmlintropage: lib/isodoc/cc/html/html_cc_intro.html
12
12
  htmlstylesheet: lib/isodoc/cc/html/htmlstyle.scss
13
13
  html_normalfontsize: "15px"
14
14
  html_footnotefontsize: "0.9em"
15
- scripts: lib/isodoc/cc/html/scripts.html
16
15
  i18nyaml: lib/isodoc/cc/i18n-en.yaml
17
16
  word_bodyfont: '"Source Sans Pro","Arial",sans-serif'
18
17
  word_headerfont: '"Source Sans Pro","Arial",sans-serif'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.9
4
+ version: 2.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-17 00:00:00.000000000 Z
11
+ date: 2024-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -196,7 +196,6 @@ files:
196
196
  - lib/isodoc/cc/html/html_cc_titlepage.html
197
197
  - lib/isodoc/cc/html/htmlstyle.css
198
198
  - lib/isodoc/cc/html/htmlstyle.scss
199
- - lib/isodoc/cc/html/scripts.html
200
199
  - lib/isodoc/cc/html/word_cc_intro.html
201
200
  - lib/isodoc/cc/html/word_cc_titlepage.html
202
201
  - lib/isodoc/cc/html/wordstyle.css
@@ -238,7 +237,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
238
237
  requirements:
239
238
  - - ">="
240
239
  - !ruby/object:Gem::Version
241
- version: 2.7.0
240
+ version: 3.1.0
242
241
  required_rubygems_version: !ruby/object:Gem::Requirement
243
242
  requirements:
244
243
  - - ">="
@@ -1,70 +0,0 @@
1
- <script>
2
- $("#toc").on('click', 'li', function(e) {
3
- $(this).parent().find('li.toc-active').removeClass('toc-active');
4
- $(this).addClass('toc-active');
5
- });
6
- </script>
7
-
8
- <script>
9
- //TOC toggle animation
10
- $('#toggle').on('click', function(){
11
- if( $('nav').is(':visible') ) {
12
- $('nav').animate({ 'left': '-353px' }, 'slow', function(){
13
- $('nav').hide();
14
- });
15
- $('.container').animate({ 'padding-left': '31px' }, 'slow');
16
- }
17
- else {
18
- $('nav').show();
19
- $('nav').animate({ 'left': '0px' }, 'slow');
20
- }
21
- });
22
- </script>
23
-
24
- <script>
25
- // Scroll to top button
26
- window.onscroll = function() {scrollFunction()};
27
-
28
- function scrollFunction() {
29
- if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
30
- document.getElementById("myBtn").style.display = "block";
31
- } else {
32
- document.getElementById("myBtn").style.display = "none";
33
- }
34
- }
35
-
36
- // When the user clicks on the button, scroll to the top of the document
37
- function topFunction() {
38
- document.body.scrollTop = 0;
39
- document.documentElement.scrollTop = 0;
40
- }
41
- </script>
42
-
43
- <script>
44
- // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
45
- //
46
- // AnchorJS - v4.2.2 - 2020-04-20
47
- // https://www.bryanbraun.com/anchorjs/
48
- // Copyright (c) 2020 Bryan Braun; Licensed MIT
49
- //
50
- // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
51
- !function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(this,function(){"use strict";return function(A){function f(A){A.icon=A.hasOwnProperty("icon")?A.icon:"",A.visible=A.hasOwnProperty("visible")?A.visible:"hover",A.placement=A.hasOwnProperty("placement")?A.placement:"right",A.ariaLabel=A.hasOwnProperty("ariaLabel")?A.ariaLabel:"Anchor",A.class=A.hasOwnProperty("class")?A.class:"",A.base=A.hasOwnProperty("base")?A.base:"",A.truncate=A.hasOwnProperty("truncate")?Math.floor(A.truncate):64,A.titleText=A.hasOwnProperty("titleText")?A.titleText:""}function p(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new Error("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}this.options=A||{},this.elements=[],f(this.options),this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)},this.add=function(A){var e,t,i,n,o,s,a,r,c,h,l,u,d=[];if(f(this.options),"touch"===(l=this.options.visible)&&(l=this.isTouchDevice()?"always":"hover"),0===(e=p(A=A||"h2, h3, h4, h5, h6")).length)return this;for(!function(){if(null!==document.head.querySelector("style.anchorjs"))return;var A,e=document.createElement("style");e.className="anchorjs",e.appendChild(document.createTextNode("")),void 0===(A=document.head.querySelector('[rel="stylesheet"],style'))?document.head.appendChild(e):document.head.insertBefore(e,A);e.sheet.insertRule(".anchorjs-link{opacity:0;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}",e.sheet.cssRules.length),e.sheet.insertRule(":hover>.anchorjs-link,.anchorjs-link:focus{opacity:1}",e.sheet.cssRules.length),e.sheet.insertRule("[data-anchorjs-icon]::after{content:attr(data-anchorjs-icon)}",e.sheet.cssRules.length),e.sheet.insertRule('@font-face{font-family:anchorjs-icons;src:url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype")}',e.sheet.cssRules.length)}(),t=document.querySelectorAll("[id]"),i=[].map.call(t,function(A){return A.id}),o=0;o<e.length;o++)if(this.hasAnchorJSLink(e[o]))d.push(o);else{if(e[o].hasAttribute("id"))n=e[o].getAttribute("id");else if(e[o].hasAttribute("data-anchor-id"))n=e[o].getAttribute("data-anchor-id");else{for(c=r=this.urlify(e[o].textContent),a=0;void 0!==s&&(c=r+"-"+a),a+=1,-1!==(s=i.indexOf(c)););s=void 0,i.push(c),e[o].setAttribute("id",c),n=c}(h=document.createElement("a")).className="anchorjs-link "+this.options.class,h.setAttribute("aria-label",this.options.ariaLabel),h.setAttribute("data-anchorjs-icon",this.options.icon),this.options.titleText&&(h.title=this.options.titleText),u=document.querySelector("base")?window.location.pathname+window.location.search:"",u=this.options.base||u,h.href=u+"#"+n,"always"===l&&(h.style.opacity="1"),""===this.options.icon&&(h.style.font="1em/1 anchorjs-icons","left"===this.options.placement&&(h.style.lineHeight="inherit")),"left"===this.options.placement?(h.style.position="absolute",h.style.marginLeft="-1em",h.style.paddingRight="0.5em",e[o].insertBefore(h,e[o].firstChild)):(h.style.paddingLeft="0.375em",e[o].appendChild(h))}for(o=0;o<d.length;o++)e.splice(d[o]-o,1);return this.elements=this.elements.concat(e),this},this.remove=function(A){for(var e,t,i=p(A),n=0;n<i.length;n++)(t=i[n].querySelector(".anchorjs-link"))&&(-1!==(e=this.elements.indexOf(i[n]))&&this.elements.splice(e,1),i[n].removeChild(t));return this},this.removeAll=function(){this.remove(this.elements)},this.urlify=function(A){return this.options.truncate||f(this.options),A.trim().replace(/\'/gi,"").replace(/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v]/g,"-").replace(/-{2,}/g,"-").substring(0,this.options.truncate).replace(/^-+|-+$/gm,"").toLowerCase()},this.hasAnchorJSLink=function(A){var e=A.firstChild&&-1<(" "+A.firstChild.className+" ").indexOf(" anchorjs-link "),t=A.lastChild&&-1<(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ");return e||t||!1}}});
52
- // @license-end
53
- </script>
54
- <script>
55
- /*
56
- $(document).ready(function() {
57
- $('[id^=toc]').each(function ()
58
- {
59
- var currentToc = $(this);
60
- var url = window.location.href;
61
- currentToc.wrap("<a href='" + url + "#" + currentToc.attr("id") + "' </a>");
62
- });
63
- });
64
- */
65
- anchors.options = {
66
- placement: 'left'
67
- };
68
- anchors.add('h1, h2, h3, h4');
69
- </script>
70
-