metanorma-un 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -832,8 +832,18 @@
832
832
 
833
833
  <xsl:param name="table_if_debug">false</xsl:param> <!-- set 'true' to put debug width data before table or dl -->
834
834
 
835
+ <xsl:variable name="isApplyAutolayoutAlgorithm_">
836
+ true
837
+ </xsl:variable>
838
+ <xsl:variable name="isApplyAutolayoutAlgorithm" select="normalize-space($isApplyAutolayoutAlgorithm_)"/>
839
+
835
840
  <xsl:variable name="isGenerateTableIF_">
836
- false
841
+ <xsl:choose>
842
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">
843
+ <xsl:value-of select="normalize-space($table_if) = 'true'"/>
844
+ </xsl:when>
845
+ <xsl:otherwise>false</xsl:otherwise>
846
+ </xsl:choose>
837
847
  </xsl:variable>
838
848
  <xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/>
839
849
 
@@ -1432,7 +1442,7 @@
1432
1442
  </xsl:attribute-set>
1433
1443
 
1434
1444
  <xsl:attribute-set name="dt-block-style">
1435
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
1445
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
1436
1446
 
1437
1447
  </xsl:attribute-set>
1438
1448
 
@@ -2381,6 +2391,7 @@
2381
2391
 
2382
2392
  <xsl:variable name="margin-side">
2383
2393
  <xsl:choose>
2394
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">0</xsl:when>
2384
2395
  <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2385
2396
  <xsl:otherwise>0</xsl:otherwise>
2386
2397
  </xsl:choose>
@@ -2463,6 +2474,7 @@
2463
2474
  </td>
2464
2475
  </tr>
2465
2476
  -->
2477
+ <!-- Simple_table=<xsl:copy-of select="$simple-table"/> -->
2466
2478
  <xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
2467
2479
 
2468
2480
  </xsl:when>
@@ -2594,12 +2606,17 @@
2594
2606
  <xsl:template name="calculate-column-widths">
2595
2607
  <xsl:param name="table"/>
2596
2608
  <xsl:param name="cols-count"/>
2597
-
2609
+ <xsl:choose>
2610
+ <xsl:when test="$isApplyAutolayoutAlgorithm = 'true'">
2611
+ <xsl:call-template name="get-calculated-column-widths-autolayout-algorithm"/>
2612
+ </xsl:when>
2613
+ <xsl:otherwise>
2598
2614
  <xsl:call-template name="calculate-column-widths-proportional">
2599
2615
  <xsl:with-param name="cols-count" select="$cols-count"/>
2600
2616
  <xsl:with-param name="table" select="$table"/>
2601
2617
  </xsl:call-template>
2602
-
2618
+ </xsl:otherwise>
2619
+ </xsl:choose>
2603
2620
  </xsl:template>
2604
2621
 
2605
2622
  <!-- ================================================== -->
@@ -2777,6 +2794,7 @@
2777
2794
  <!-- (https://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.5.2) -->
2778
2795
  <!-- ================================================== -->
2779
2796
 
2797
+ <!-- INPUT: table with columns widths, generated by table_if.xsl -->
2780
2798
  <xsl:template name="calculate-column-widths-autolayout-algorithm">
2781
2799
  <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
2782
2800
 
@@ -2788,67 +2806,6 @@
2788
2806
 
2789
2807
  <!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
2790
2808
 
2791
- <!-- get current table id -->
2792
- <xsl:variable name="table_id" select="@id"/>
2793
- <!-- find table by id in the file 'table_widths' -->
2794
- <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
2795
- <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
2796
-
2797
- <!-- table='<xsl:copy-of select="$table"/>' -->
2798
- <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
2799
- <!-- table-if='<xsl:copy-of select="$table-if"/>' -->
2800
- <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
2801
-
2802
- <xsl:variable name="table_with_cell_widths_">
2803
- <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
2804
- </xsl:variable>
2805
- <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
2806
-
2807
- <!-- <xsl:if test="$table_if_debug = 'true'">
2808
- <xsl:copy-of select="$table_with_cell_widths"/>
2809
- </xsl:if> -->
2810
-
2811
- <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
2812
-
2813
- <xsl:variable name="column_widths_">
2814
- <!-- iteration of columns -->
2815
- <xsl:for-each select="$table_with_cell_widths//tr[1]/td">
2816
- <xsl:variable name="pos" select="position()"/>
2817
- <column>
2818
- <xsl:attribute name="width_max">
2819
- <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
2820
- <xsl:sort select="." data-type="number" order="descending"/>
2821
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2822
- </xsl:for-each>
2823
- </xsl:attribute>
2824
- <xsl:attribute name="width_min">
2825
- <xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
2826
- <xsl:sort select="." data-type="number" order="descending"/>
2827
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2828
- </xsl:for-each>
2829
- </xsl:attribute>
2830
- </column>
2831
- </xsl:for-each>
2832
- </xsl:variable>
2833
- <xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
2834
-
2835
- <!-- <column_widths>
2836
- <xsl:copy-of select="$column_widths"/>
2837
- </column_widths> -->
2838
-
2839
- <!-- These in turn, are used to find the minimum and maximum width for the table. -->
2840
- <xsl:variable name="table_widths_">
2841
- <table>
2842
- <xsl:attribute name="width_max">
2843
- <xsl:value-of select="sum($column_widths/column/@width_max)"/>
2844
- </xsl:attribute>
2845
- <xsl:attribute name="width_min">
2846
- <xsl:value-of select="sum($column_widths/column/@width_min)"/>
2847
- </xsl:attribute>
2848
- </table>
2849
- </xsl:variable>
2850
- <xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
2851
-
2852
2809
  <xsl:variable name="page_width">
2853
2810
  <xsl:choose>
2854
2811
  <xsl:when test="$parent_table_page-width != ''">
@@ -2861,16 +2818,13 @@
2861
2818
  </xsl:variable>
2862
2819
 
2863
2820
  <xsl:if test="$table_if_debug = 'true'">
2864
- <table_width>
2865
- <xsl:copy-of select="$table_widths"/>
2866
- </table_width>
2867
- <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
2821
+ <page_width><xsl:value-of select="$page_width"/></page_width>
2868
2822
  </xsl:if>
2869
2823
 
2870
2824
  <!-- There are three cases: -->
2871
2825
  <xsl:choose>
2872
2826
  <!-- 1. The minimum table width is equal to or wider than the available space -->
2873
- <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
2827
+ <xsl:when test="@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
2874
2828
  <!-- call old algorithm -->
2875
2829
  <case1/>
2876
2830
  <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
@@ -2880,10 +2834,10 @@
2880
2834
  </xsl:call-template> -->
2881
2835
  </xsl:when>
2882
2836
  <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
2883
- <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
2837
+ <xsl:when test="@width_max &lt;= $page_width">
2884
2838
  <case2/>
2885
2839
  <autolayout/>
2886
- <xsl:for-each select="$column_widths/column/@width_max">
2840
+ <xsl:for-each select="column/@width_max">
2887
2841
  <column divider="100"><xsl:value-of select="."/></column>
2888
2842
  </xsl:for-each>
2889
2843
  </xsl:when>
@@ -2893,19 +2847,19 @@
2893
2847
  For each column, let d be the difference between maximum and minimum width of that column.
2894
2848
  Now set the column's width to the minimum width plus d times W over D.
2895
2849
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
2896
- <xsl:when test="($table_widths/table/@width_max &gt; $page_width and $table_widths/table/@width_min &lt; $page_width) or ($table_widths/table/@width_min &gt;= $page_width)">
2850
+ <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
2897
2851
  <!-- difference between the available space and the minimum table width -->
2898
- <xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
2852
+ <xsl:variable name="W" select="$page_width - @width_min"/>
2899
2853
  <W><xsl:value-of select="$W"/></W>
2900
2854
  <!-- difference between maximum and minimum width of the table -->
2901
- <xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
2855
+ <xsl:variable name="D" select="@width_max - @width_min"/>
2902
2856
  <D><xsl:value-of select="$D"/></D>
2903
2857
  <case3/>
2904
2858
  <autolayout/>
2905
- <xsl:if test="$table_widths/table/@width_min &gt;= $page_width">
2859
+ <xsl:if test="@width_min &gt;= $page_width">
2906
2860
  <split_keep-within-line>true</split_keep-within-line>
2907
2861
  </xsl:if>
2908
- <xsl:for-each select="$column_widths/column">
2862
+ <xsl:for-each select="column">
2909
2863
  <!-- difference between maximum and minimum width of that column. -->
2910
2864
  <xsl:variable name="d" select="@width_max - @width_min"/>
2911
2865
  <d><xsl:value-of select="$d"/></d>
@@ -2931,23 +2885,39 @@
2931
2885
 
2932
2886
  <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
2933
2887
 
2888
+ <ancestor_tree>
2889
+ <xsl:for-each select="ancestor::*">
2890
+ <ancestor><xsl:value-of select="local-name()"/></ancestor>
2891
+ </xsl:for-each>
2892
+ </ancestor_tree>
2893
+
2934
2894
  <xsl:variable name="parent_table_page-width_">
2935
2895
  <xsl:if test="$parent_table_id != ''">
2936
2896
  <!-- determine column number in the parent table -->
2937
2897
  <xsl:variable name="parent_table_column_number">
2938
2898
  <xsl:choose>
2939
- <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
2899
+ <!-- <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when> -->
2900
+ <xsl:when test="(ancestor::*[local-name() = 'dd' or local-name() = 'table' or local-name() = 'dl'])[last()][local-name() = 'dd' or local-name() = 'dl']">2</xsl:when>
2940
2901
  <xsl:otherwise> <!-- parent is table -->
2941
2902
  <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
2942
2903
  </xsl:otherwise>
2943
2904
  </xsl:choose>
2944
2905
  </xsl:variable>
2945
2906
  <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
2946
- <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
2907
+
2908
+ <xsl:variable name="parent_table_column_" select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
2909
+ <xsl:variable name="parent_table_column" select="xalan:nodeset($parent_table_column_)"/>
2910
+ <!-- <xsl:variable name="divider">
2911
+ <xsl:value-of select="$parent_table_column/@divider"/>
2912
+ <xsl:if test="not($parent_table_column/@divider)">1</xsl:if>
2913
+ </xsl:variable> -->
2914
+ <xsl:value-of select="$parent_table_column/text()"/> <!-- * 10 -->
2947
2915
  </xsl:if>
2948
2916
  </xsl:variable>
2949
2917
  <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
2950
2918
 
2919
+ <parent_table_page-width><xsl:value-of select="$parent_table_page-width"/></parent_table_page-width>
2920
+
2951
2921
  <!-- get current table id -->
2952
2922
  <xsl:variable name="table_id" select="@id"/>
2953
2923
 
@@ -2968,50 +2938,6 @@
2968
2938
 
2969
2939
  </xsl:template> <!-- get-calculated-column-widths-autolayout-algorithm -->
2970
2940
 
2971
- <!-- ============================= -->
2972
- <!-- mode: determine_cell_widths-if -->
2973
- <!-- ============================= -->
2974
- <xsl:template match="@*|node()" mode="determine_cell_widths-if">
2975
- <xsl:copy>
2976
- <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
2977
- </xsl:copy>
2978
- </xsl:template>
2979
-
2980
- <xsl:template match="td | th" mode="determine_cell_widths-if">
2981
- <xsl:copy>
2982
- <xsl:copy-of select="@*"/>
2983
-
2984
- <!-- The maximum width is given by the widest line. -->
2985
- <xsl:attribute name="width_max">
2986
- <xsl:for-each select="p_len">
2987
- <xsl:sort select="." data-type="number" order="descending"/>
2988
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2989
- </xsl:for-each>
2990
- </xsl:attribute>
2991
-
2992
- <!-- The minimum width is given by the widest text element (word, image, etc.) -->
2993
- <xsl:variable name="width_min">
2994
- <xsl:for-each select="word_len">
2995
- <xsl:sort select="." data-type="number" order="descending"/>
2996
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2997
- </xsl:for-each>
2998
- </xsl:variable>
2999
- <xsl:attribute name="width_min">
3000
- <xsl:value-of select="$width_min"/>
3001
- </xsl:attribute>
3002
-
3003
- <xsl:if test="$width_min = 0">
3004
- <xsl:attribute name="width_min">1</xsl:attribute>
3005
- </xsl:if>
3006
-
3007
- <xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
3008
-
3009
- </xsl:copy>
3010
- </xsl:template>
3011
- <!-- ============================= -->
3012
- <!-- END mode: determine_cell_widths-if -->
3013
- <!-- ============================= -->
3014
-
3015
2941
  <!-- ================================================== -->
3016
2942
  <!-- Calculate column's width based on HTML4 algorithm -->
3017
2943
  <!-- ================================================== -->
@@ -3202,6 +3128,7 @@
3202
3128
  <xsl:when test="$table_or_dl = 'table'">
3203
3129
  <xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
3204
3130
  <fo:table-row number-columns-spanned="{$col_count}">
3131
+ <xsl:copy-of select="../@font-weight"/>
3205
3132
  <!-- <test_table><xsl:copy-of select="."/></test_table> -->
3206
3133
  <xsl:call-template name="td"/>
3207
3134
  </fo:table-row>
@@ -3368,7 +3295,7 @@
3368
3295
 
3369
3296
  <xsl:apply-templates/>
3370
3297
 
3371
- <xsl:if test="$isGenerateTableIF = 'true'"><fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
3298
+ <xsl:if test="$isGenerateTableIF = 'true'"> <fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
3372
3299
 
3373
3300
  </fo:block>
3374
3301
  </fo:table-cell>
@@ -3698,6 +3625,7 @@
3698
3625
  <xsl:template match="*[local-name()='dl']">
3699
3626
  <xsl:variable name="isAdded" select="@added"/>
3700
3627
  <xsl:variable name="isDeleted" select="@deleted"/>
3628
+ <!-- <dl><xsl:copy-of select="."/></dl> -->
3701
3629
  <fo:block-container>
3702
3630
 
3703
3631
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -4231,21 +4159,16 @@
4231
4159
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
4232
4160
  <xsl:template match="*[local-name()='dt']" mode="dl_if">
4233
4161
  <xsl:param name="id"/>
4234
- <xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
4235
4162
  <tr>
4236
4163
  <td>
4237
4164
  <xsl:copy-of select="node()"/>
4238
4165
  </td>
4239
4166
  <td>
4240
-
4241
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
4242
-
4243
- <!-- get paragraphs from nested 'dl' -->
4244
- <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
4245
-
4167
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
4168
+ <!-- get paragraphs from nested 'dl' -->
4169
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
4246
4170
  </td>
4247
4171
  </tr>
4248
-
4249
4172
  </xsl:template>
4250
4173
  <xsl:template match="*[local-name()='dd']" mode="dl_if"/>
4251
4174
 
@@ -4896,6 +4819,9 @@
4896
4819
  <xsl:variable name="td">
4897
4820
  <xsl:element name="td">
4898
4821
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
4822
+ <xsl:if test="local-name()='th'">
4823
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4824
+ </xsl:if>
4899
4825
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4900
4826
  <xsl:apply-templates mode="simple-table-colspan"/>
4901
4827
  </xsl:element>
@@ -4908,6 +4834,9 @@
4908
4834
  <xsl:otherwise>
4909
4835
  <xsl:element name="td">
4910
4836
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4837
+ <xsl:if test="local-name()='th'">
4838
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4839
+ </xsl:if>
4911
4840
  <xsl:apply-templates mode="simple-table-colspan"/>
4912
4841
  </xsl:element>
4913
4842
  </xsl:otherwise>
@@ -5037,8 +4966,14 @@
5037
4966
  <xsl:copy-of select="@*"/>
5038
4967
  <xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
5039
4968
  <xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
4969
+ <xsl:variable name="divide">
4970
+ <xsl:choose>
4971
+ <xsl:when test="@divide"><xsl:value-of select="@divide"/></xsl:when>
4972
+ <xsl:otherwise>1</xsl:otherwise>
4973
+ </xsl:choose>
4974
+ </xsl:variable>
5040
4975
  <xsl:attribute name="id">
5041
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
4976
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
5042
4977
  </xsl:attribute>
5043
4978
 
5044
4979
  <xsl:for-each select="*[local-name() = 'p']">
@@ -5046,10 +4981,12 @@
5046
4981
  <xsl:copy-of select="@*"/>
5047
4982
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
5048
4983
  <xsl:attribute name="id">
5049
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
4984
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
5050
4985
  </xsl:attribute>
5051
4986
 
5052
- <xsl:copy-of select="node()"/>
4987
+ <!-- <xsl:copy-of select="node()" /> -->
4988
+ <xsl:apply-templates mode="simple-table-noid"/>
4989
+
5053
4990
  </xsl:copy>
5054
4991
  </xsl:for-each>
5055
4992
 
@@ -5078,7 +5015,7 @@
5078
5015
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
5079
5016
  <xsl:copy>
5080
5017
  <xsl:attribute name="id">
5081
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
5018
+ <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
5082
5019
  </xsl:attribute>
5083
5020
  <xsl:copy-of select="node()"/>
5084
5021
  </xsl:copy>
@@ -5087,6 +5024,24 @@
5087
5024
  </xsl:copy>
5088
5025
 
5089
5026
  </xsl:template>
5027
+
5028
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p']//*" mode="simple-table-noid">
5029
+ <xsl:copy>
5030
+ <xsl:choose>
5031
+ <xsl:when test="$isGenerateTableIF = 'true'">
5032
+ <xsl:copy-of select="@*[local-name() != 'id']"/> <!-- to prevent repeat id in colspan/rowspan cells -->
5033
+ <!-- <xsl:if test="local-name() = 'dl' or local-name() = 'table'">
5034
+ <xsl:copy-of select="@id"/>
5035
+ </xsl:if> -->
5036
+ </xsl:when>
5037
+ <xsl:otherwise>
5038
+ <xsl:copy-of select="@*"/>
5039
+ </xsl:otherwise>
5040
+ </xsl:choose>
5041
+ <xsl:apply-templates select="node()" mode="simple-table-noid"/>
5042
+ </xsl:copy>
5043
+ </xsl:template>
5044
+
5090
5045
  <!-- End mode: simple-table-id -->
5091
5046
  <!-- ===================== -->
5092
5047
  <!-- ===================== -->
@@ -5096,7 +5051,7 @@
5096
5051
  <!-- =============================== -->
5097
5052
  <xsl:template match="@*|node()" mode="td_text_with_formatting">
5098
5053
  <xsl:copy>
5099
- <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
5054
+ <xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
5100
5055
  </xsl:copy>
5101
5056
  </xsl:template>
5102
5057
 
@@ -5210,6 +5165,10 @@
5210
5165
 
5211
5166
  <fo:inline xsl:use-attribute-sets="mathml-style">
5212
5167
 
5168
+ <xsl:if test="$isGenerateTableIF = 'true' and ancestor::*[local-name() = 'td' or local-name() = 'th' or local-name() = 'dl'] and not(following-sibling::node()[not(self::comment())][normalize-space() != ''])"> <!-- math in table cell, and math is last element -->
5169
+ <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
5170
+ </xsl:if>
5171
+
5213
5172
  <xsl:call-template name="setTrackChangesStyles">
5214
5173
  <xsl:with-param name="isAdded" select="$isAdded"/>
5215
5174
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
@@ -7208,15 +7167,12 @@
7208
7167
 
7209
7168
  <xsl:template match="*[local-name()='tr']" mode="requirement">
7210
7169
  <fo:table-row height="7mm" border-bottom="0.5pt solid grey">
7211
- <xsl:if test="parent::*[local-name()='thead']"> <!-- and not(ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']) -->
7212
- <xsl:attribute name="background-color">rgb(33, 55, 92)</xsl:attribute>
7213
- </xsl:if>
7214
- <xsl:if test="starts-with(*[local-name()='td'][1], 'Requirement ')">
7215
- <xsl:attribute name="background-color">rgb(252, 246, 222)</xsl:attribute>
7216
- </xsl:if>
7217
- <xsl:if test="starts-with(*[local-name()='td'][1], 'Recommendation ')">
7218
- <xsl:attribute name="background-color">rgb(233, 235, 239)</xsl:attribute>
7170
+
7171
+ <xsl:if test="parent::*[local-name()='thead'] or starts-with(*[local-name()='td' or local-name()='th'][1], 'Requirement ') or starts-with(*[local-name()='td' or local-name()='th'][1], 'Recommendation ')">
7172
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
7173
+
7219
7174
  </xsl:if>
7175
+
7220
7176
  <xsl:apply-templates mode="requirement"/>
7221
7177
  </fo:table-row>
7222
7178
  </xsl:template>
@@ -8694,7 +8650,7 @@
8694
8650
  </tbody>
8695
8651
  </xsl:variable>
8696
8652
  <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
8697
- <xsl:call-template name="calculate-column-widths">
8653
+ <xsl:call-template name="calculate-column-widths-proportional">
8698
8654
  <xsl:with-param name="cols-count" select="$cols-count"/>
8699
8655
  <xsl:with-param name="table" select="$toc_table_simple"/>
8700
8656
  </xsl:call-template>
@@ -225,9 +225,9 @@
225
225
  <zeroOrMore>
226
226
  <ref name="forename"/>
227
227
  </zeroOrMore>
228
- <zeroOrMore>
229
- <ref name="initial"/>
230
- </zeroOrMore>
228
+ <optional>
229
+ <ref name="formatted-initials"/>
230
+ </optional>
231
231
  <ref name="surname"/>
232
232
  <zeroOrMore>
233
233
  <ref name="addition"/>
@@ -247,8 +247,8 @@
247
247
  <ref name="LocalizedString"/>
248
248
  </element>
249
249
  </define>
250
- <define name="initial">
251
- <element name="initial">
250
+ <define name="formatted-initials">
251
+ <element name="formatted-initials">
252
252
  <ref name="LocalizedString"/>
253
253
  </element>
254
254
  </define>
@@ -264,6 +264,9 @@
264
264
  </define>
265
265
  <define name="forename">
266
266
  <element name="forename">
267
+ <optional>
268
+ <attribute name="initial"/>
269
+ </optional>
267
270
  <ref name="LocalizedString"/>
268
271
  </element>
269
272
  </define>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.9.7".freeze
3
+ VERSION = "0.9.8".freeze
4
4
  end
5
5
  end
data/lib/metanorma-un.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  require "metanorma/un"
2
2
  require "asciidoctor"
3
3
  require "isodoc/un"
4
+ require "metanorma"
4
5
 
5
- if defined? Metanorma
6
+ if defined? Metanorma::Registry
6
7
  Metanorma::Registry.instance.register(Metanorma::UN::Processor)
7
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-24 00:00:00.000000000 Z
11
+ date: 2022-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -217,6 +217,7 @@ extensions: []
217
217
  extra_rdoc_files: []
218
218
  files:
219
219
  - ".github/workflows/rake.yml"
220
+ - ".github/workflows/release.yml"
220
221
  - ".gitignore"
221
222
  - ".hound.yml"
222
223
  - ".rubocop.yml"
@@ -234,16 +235,13 @@ files:
234
235
  - lib/isodoc/un/html/html_unece_intro.html
235
236
  - lib/isodoc/un/html/html_unece_plenary_titlepage.html
236
237
  - lib/isodoc/un/html/html_unece_titlepage.html
237
- - lib/isodoc/un/html/htmlstyle.css
238
238
  - lib/isodoc/un/html/htmlstyle.scss
239
239
  - lib/isodoc/un/html/logo.jpg
240
240
  - lib/isodoc/un/html/scripts.html
241
- - lib/isodoc/un/html/unece.css
242
241
  - lib/isodoc/un/html/unece.scss
243
242
  - lib/isodoc/un/html/word_unece_intro.html
244
243
  - lib/isodoc/un/html/word_unece_plenary_titlepage.html
245
244
  - lib/isodoc/un/html/word_unece_titlepage.html
246
- - lib/isodoc/un/html/wordstyle.css
247
245
  - lib/isodoc/un/html/wordstyle.scss
248
246
  - lib/isodoc/un/html_convert.rb
249
247
  - lib/isodoc/un/i18n-en.yaml
@@ -276,7 +274,7 @@ homepage: https://github.com/metanorma/metanorma-un
276
274
  licenses:
277
275
  - BSD-2-Clause
278
276
  metadata: {}
279
- post_install_message:
277
+ post_install_message:
280
278
  rdoc_options: []
281
279
  require_paths:
282
280
  - lib
@@ -291,8 +289,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
289
  - !ruby/object:Gem::Version
292
290
  version: '0'
293
291
  requirements: []
294
- rubygems_version: 3.3.16
295
- signing_key:
292
+ rubygems_version: 3.1.6
293
+ signing_key:
296
294
  specification_version: 4
297
295
  summary: Metanorma for UN.
298
296
  test_files: []