Skip to content

Commit da8559c

Browse files
Limit witdth of name and description columns
Signed-off-by: James Ball <[email protected]>
1 parent ff8902e commit da8559c

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

tests/norm-rule/expected/test-norm-rules.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
]
2020
},
2121
{
22-
"name": "paragraph",
22+
"name": "paragraph-with-a-really-wide-rule-name",
2323
"def_filename": "tests/norm-rule/test.yaml",
2424
"chapter_name": "my-chapter_name",
2525
"description": "Here's a description.\nIt's got 2 lines.\n",
@@ -39,7 +39,7 @@
3939
"instances": [
4040
"MY_PARAMETER"
4141
],
42-
"description": "Here's a one line description.",
42+
"description": "Here's a one line description but it is very wide so should wrap within a cell.",
4343
"tags": [
4444
{
4545
"name": "norm:note-1",
49 Bytes
Binary file not shown.

tests/norm-rule/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ normative_rule_definitions:
1212
kind: extension
1313
instances: [Zicsr, ABC]
1414
tags: ["norm:inline"]
15-
- name: paragraph
15+
- name: paragraph-with-a-really-wide-rule-name
1616
description: |
1717
Here's a description.
1818
It's got 2 lines.
1919
tags: ["norm:para"]
2020
- name: note_with_2_tags
21-
description: Here's a one line description.
21+
description: Here's a one line description but it is very wide so should wrap within a cell.
2222
kind: parameter
2323
instances: [MY_PARAMETER]
2424
tags: ["norm:note-1", "norm:note-3"]

tools/create_normative_rules.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ def output_xlsx(filename, defs, tags)
597597
right_arrow = "\u2192"
598598
defs.norm_rule_defs.each do |d|
599599
worksheet.write(row_num, 0, d.chapter_name)
600-
worksheet.write(row_num, 1, d.name)
600+
worksheet.write(row_num, 1, d.name, wrap_format)
601601
worksheet.write(row_num, 2, d.summary) unless d.summary.nil?
602602
worksheet.write(row_num, 3, d.description.chomp, wrap_format) unless d.description.nil?
603603
worksheet.write(row_num, 4, d.kind) unless d.kind.nil?
@@ -626,6 +626,10 @@ def output_xlsx(filename, defs, tags)
626626
# Set column widths to hold data width.
627627
worksheet.autofit
628628

629+
# Override autofit for really wide columns
630+
worksheet.set_column(1, 1, 20) # name column
631+
worksheet.set_column(3, 3, 30) # description column
632+
629633
workbook.close
630634
end
631635

0 commit comments

Comments
 (0)