Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

bump md-to-pdf to v0.1.5

as-op1e9c16a7f233
diff --git a/Gemfile b/Gemfile
index 389124b98e4..ea12c3bde14 100644
--- a/Gemfile
+++ b/Gemfile
@@ -158,7 +158,7 @@ gem "structured_warnings", "~> 0.4.0"
gem "airbrake", "~> 13.0.0", require: false
gem "markly", "~> 0.10" # another markdown parser like commonmarker, but with AST support used in PDF export
-gem "md_to_pdf", git: "https://github.com/opf/md-to-pdf", ref: "fe05b4f8bae8fd46f4fa93b8e0adee6295ef7388"
+gem "md_to_pdf", git: "https://github.com/opf/md-to-pdf", ref: "965034bdd4b119c7233ea4ecd62d3964d3dec11d"
gem "prawn", "~> 2.4"
gem "ttfunk", "~> 1.7.0" # remove after https://github.com/prawnpdf/prawn/issues/1346 resolved.
diff --git a/Gemfile.lock b/Gemfile.lock
index 642e4a43aec..87d1b725649 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -8,16 +8,16 @@ GIT
GIT
remote: https://github.com/opf/md-to-pdf
- revision: fe05b4f8bae8fd46f4fa93b8e0adee6295ef7388
- ref: fe05b4f8bae8fd46f4fa93b8e0adee6295ef7388
+ revision: 965034bdd4b119c7233ea4ecd62d3964d3dec11d
+ ref: 965034bdd4b119c7233ea4ecd62d3964d3dec11d
specs:
- md_to_pdf (0.1.2)
+ md_to_pdf (0.1.5)
color_conversion (~> 0.1)
front_matter_parser (~> 1.0)
json-schema (~> 4.3)
markly (~> 0.10)
matrix (~> 0.4)
- nokogiri (~> 1.16)
+ nokogiri (~> 1.18)
prawn (~> 2.4)
prawn-table (~> 0.2)
text-hyphen (~> 1.5)
diff --git a/app/models/work_package/pdf_export/export/schema.json b/app/models/work_package/pdf_export/export/schema.json
index 316f6046966..f82609c7b71 100644
--- a/app/models/work_package/pdf_export/export/schema.json
+++ b/app/models/work_package/pdf_export/export/schema.json
@@ -769,6 +769,45 @@
}
]
},
+ "html_table" : {
+ "type" : "object",
+ "title" : "HTML table",
+ "x-example" : {
+ "table" : {
+ "auto_width" : true,
+ "header" : {
+ "background_color" : "F0F0F0",
+ "no_repeating" : true,
+ "size" : 12
+ },
+ "cell" : {
+ "background_color" : "000FFF",
+ "size" : 10
+ }
+ }
+ },
+ "properties" : {
+ "auto_width" : {
+ "title" : "Automatic column widths",
+ "description" : "Table columns should fit the content, equal spacing of columns if value is `false`",
+ "type" : "boolean"
+ },
+ "header" : {
+ "$ref" : "#/$defs/table_header"
+ },
+ "cell" : {
+ "$ref" : "#/$defs/table_cell"
+ }
+ },
+ "allOf" : [
+ {
+ "$ref" : "#/$defs/margin"
+ },
+ {
+ "$ref" : "#/$defs/border"
+ }
+ ]
+ },
"headless_table" : {
"type" : "object",
"title" : "Markdown headless table",
@@ -1554,7 +1593,7 @@
"x-example" : {
"ordered_list_point" : {
"template" : "<number>.",
- "alphabetical" : false,
+ "list_style_type" : "decimal",
"spacing" : "0.75mm",
"spanning" : true
}
@@ -1563,10 +1602,22 @@
"spacing" : {
"$ref" : "#/$defs/measurement"
},
- "alphabetical" : {
- "title" : "Alphabetical bullet points",
- "description" : "Convert the list item number into a character, eg. `a.` `b.` `c.`",
- "type" : "boolean"
+ "alphabetical": {
+ "title": "Alphabetical bullet points",
+ "description": "(deprecated; use list_style_type) Convert the list item number into a character, eg. `a.` `b.` `c.`",
+ "type": "boolean"
+ },
+ "list_style_type": {
+ "title": "List style type",
+ "description": "The style of the list bullet points, eg. `decimal`, `lower-latin`, `upper-roman`",
+ "type": "string",
+ "enum": [
+ "decimal",
+ "lower-latin",
+ "lower-roman",
+ "upper-latin",
+ "upper-roman"
+ ]
},
"spanning" : {
"title" : "Spanning",
diff --git a/app/models/work_package/pdf_export/export/standard.yml b/app/models/work_package/pdf_export/export/standard.yml
index ecfc8a0a904..90bb690fe34 100644
--- a/app/models/work_package/pdf_export/export/standard.yml
+++ b/app/models/work_package/pdf_export/export/standard.yml
@@ -138,6 +138,16 @@ work_package:
spacing: 1
ordered_list_point:
spacing: 4
+ spanning: true
+ list_style_type: decimal
+ ordered_list_point_2:
+ list_style_type: lower-latin
+ ordered_list_point_3:
+ list_style_type: lower-roman
+ ordered_list_point_4:
+ list_style_type: upper-latin
+ ordered_list_point_5:
+ list_style_type: upper-roman
task_list:
spacing: 1
task_list_point:
@@ -192,6 +202,17 @@ work_package:
size: 8
border_width: 0.25
padding: 5
+ html_table:
+ auto_width: true
+ margin_top: 4
+ margin_bottom: 4
+ header:
+ size: 9
+ styles: [ "bold" ]
+ cell:
+ size: 8
+ border_width: 0.25
+ padding: 5
alerts:
NOTE:
border_color: '0969da'
diff --git a/app/models/work_package/pdf_export/generator/contracts.yml b/app/models/work_package/pdf_export/generator/contracts.yml
index 3850d10877b..1559578f0bd 100644
--- a/app/models/work_package/pdf_export/generator/contracts.yml
+++ b/app/models/work_package/pdf_export/generator/contracts.yml
@@ -62,15 +62,25 @@ ordered-list:
spacing: 3mm
padding-bottom: 3mm
-ordered-list-point:
+ordered_list_point:
spanning: true
+ list_style_type: decimal
ordered-list-point-1:
template: '(<number>)'
-ordered-list-point-2:
+ordered_list_point_2:
template: '<number>)'
- alphabetical: true
+ list_style_type: lower-latin
+
+ordered_list_point_3:
+ list_style_type: lower-roman
+
+ordered_list_point_4:
+ list_style_type: upper-latin
+
+ordered_list_point_5:
+ list_style_type: upper-roman
hrule:
margin-top: 2mm
@@ -111,15 +121,17 @@ table:
background-color: 'F0F0F0'
size: 10
cell:
- no-border: true
padding: 1mm
size: 9
-headless-table:
+html_table:
margin-top: 2mm
margin-bottom: 4mm
+ header:
+ styles: [ 'bold' ]
+ background-color: 'F0F0F0'
+ size: 10
cell:
- no-border: true
padding: 1mm
size: 9
diff --git a/docs/system-admin-guide/design/pdf-export-styles/README.md b/docs/system-admin-guide/design/pdf-export-styles/README.md
index d5a648410b6..335bc418d89 100644
--- a/docs/system-admin-guide/design/pdf-export-styles/README.md
+++ b/docs/system-admin-guide/design/pdf-export-styles/README.md
@@ -189,6 +189,7 @@ header:
| `padding_top` | **Padding top**<br/>Padding only on the top side of the hero banner<br/>Examples: `10mm`, `10` | number or string<br/>See [Units](#units) |
| `title` | **The first block in the hero**<br/>See [The first block in the hero](#the-first-block-in-the-hero) | object |
| `heading` | **The main block in the hero**<br/>See [The main block in the hero](#the-main-block-in-the-hero) | object |
+| `dates` | **The dates block in the hero**<br/>See [The dates block in the hero](#the-dates-block-in-the-hero) | object |
| `subheading` | **The last block in the hero**<br/>See [The last block in the hero](#the-last-block-in-the-hero) | object |
## Font properties
@@ -217,6 +218,32 @@ leading: 2
| `color` | **Color**<br/>A color in RRGGBB format<br/>Example: `F0F0F0` | string |
| `styles` | Example: `[bold]`<br/>Valid values:<br/>`bold`, `italic`, `underline`, `strikethrough`, `superscript`, `subscript` | array of string |
+## HTML table
+
+Key: `html_table`
+
+Example:
+
+```yaml
+table:
+ auto_width: true
+ header:
+ background_color: F0F0F0
+ no_repeating: true
+ size: 12
+ cell:
+ background_color: 000FFF
+ size: 10
+```
+
+| Key | Description | Data type |
+| - | - | - |
+| `auto_width` | **Automatic column widths**<br/>Table columns should fit the content, equal spacing of columns if value is `false` | boolean |
+| `header` | **Table header cell**<br/>Styling for a table header cell<br/>See [Table header cell](#table-header-cell) | object |
+| `cell` | **Table cell**<br/>Styling for a table cell<br/>See [Table cell](#table-cell) | object |
+| … | See [Margin properties](#margin-properties) | |
+| … | See [Border Properties](#border-properties) | |
+
## Image caption
Styling for the caption below an image
@@ -301,6 +328,7 @@ markdown:
| `font` | **Font properties**<br/>Properties to set the font style<br/>See [Font properties](#font-properties) | object |
| `paragraph` | **Markdown paragraph**<br/>A block of text<br/>See [Markdown paragraph](#markdown-paragraph) | object |
| `table` | **Markdown table**<br/>See [Markdown table](#markdown-table) | object |
+| `html_table` | **HTML table**<br/>See [HTML table](#html-table) | object |
| `headless_table` | **Markdown headless table**<br/>Tables without or empty header rows can be styled differently.<br/>See [Markdown headless table](#markdown-headless-table) | object |
| `code` | **Markdown code**<br/>Styling to denote a word or phrase as code<br/>See [Markdown code](#markdown-code) | object |
| `codeblock` | **Markdown code block**<br/>Styling to denote a paragraph as code<br/>See [Markdown code block](#markdown-code-block) | object |
@@ -520,7 +548,7 @@ Example:
```yaml
ordered_list_point:
template: "<number>."
- alphabetical: false
+ list_style_type: decimal
spacing: 0.75mm
spanning: true
```
@@ -528,7 +556,8 @@ ordered_list_point:
| Key | Description | Data type |
| - | - | - |
| `spacing` | A number >= 0 and an optional unit<br/>Examples: `10mm`, `10` | number or string<br/>See [Units](#units) |
-| `alphabetical` | **Alphabetical bullet points**<br/>Convert the list item number into a character, eg. `a.` `b.` `c.` | boolean |
+| `alphabetical` | **Alphabetical bullet points**<br/>(deprecated; use list_style_type) Convert the list item number into a character, eg. `a.` `b.` `c.` | boolean |
+| `list_style_type` | **List style type**<br/>The style of the list bullet points, eg. `decimal`, `lower-latin`, `upper-roman`<br/>Valid values:<br/>`decimal`, `lower-latin`, `lower-roman`, `upper-latin`, `upper-roman` | string |
| `spanning` | **Spanning**<br/>Use the width of the largest bullet as indention. | boolean |
| `template` | **Template**<br/>customize what the prefix should contain, eg. `(<number>)` | string |
| … | See [Font properties](#font-properties) | |
@@ -650,14 +679,14 @@ overview:
table: {}
```
-| Key | Description | Data type |
-| - |-----------------------------------------------------------------------------------------------------------------------------------------------| - |
-| `group_heading` | **Overview group heading**<br/>Styling for the group level if grouping is activated<br/>See [Overview group heading](#overview-group-heading) | object |
-| `table` | **Overview table**<br/>See [Overview table](#overview-table) | object |
+| Key | Description | Data type |
+| - | - | - |
+| `group_heading` | **Overview group heading**<br/>Styling for the group label if grouping is activated<br/>See [Overview group heading](#overview-group-heading) | object |
+| `table` | **Overview table**<br/>See [Overview table](#overview-table) | object |
## Overview group heading
-Styling for the group level if grouping is activated
+Styling for the group label if grouping is activated
Key: `group_heading`
@@ -943,6 +972,28 @@ Key: `item_level_x`
| … | See [Font properties](#font-properties) | |
| … | See [Margin properties](#margin-properties) | |
+## The dates block in the hero
+
+Key: `dates`
+
+Example:
+
+```yaml
+heading:
+ spacing: 10
+ max_height: 20
+ size: 32
+ color: 414d5f
+ styles:
+ - bold
+```
+
+| Key | Description | Data type |
+| - | - | - |
+| `max_height` | **Maximum height of the block**<br/>A number >= 0 and an optional unit<br/>Example: `30` | number or string<br/>See [Units](#units) |
+| `spacing` | **Minimum spacing between dates and subheading**<br/>A number >= 0 and an optional unit<br/>Example: `10` | number or string<br/>See [Units](#units) |
+| … | See [Font properties](#font-properties) | |
+
## The first block in the hero
Key: `title`
diff --git a/script/pdf_export/generate_styles_doc b/script/pdf_export/generate_styles_doc
index df4e7be5506..3e153a9afdb 100755
--- a/script/pdf_export/generate_styles_doc
+++ b/script/pdf_export/generate_styles_doc
@@ -5,6 +5,7 @@
require "md_to_pdf/style/schema_doc"
require "yaml"
require "json"
+require 'fileutils'
root = File.expand_path("../../", __dir__)
schema_file = File.join(root, "app", "models", "work_package", "pdf_export", "export", "schema.json")
diff --git a/script/pdf_export/validate_styles b/script/pdf_export/validate_styles
index 2f9d2af3a28..0c70d044453 100755
--- a/script/pdf_export/validate_styles
+++ b/script/pdf_export/validate_styles
@@ -10,8 +10,8 @@ class SchemaValidator
def validate
root = File.expand_path("../../", __dir__)
- schema = JSON::load_file(File.join(root, "app", "models", "work_package", "pdf_export", "schema.json"))
- styles_file = File.join(root, "app", "models", "work_package", "pdf_export", "standard.yml")
+ schema = JSON::load_file(File.join(root, "app", "models", "work_package", "pdf_export", "export", "schema.json"))
+ styles_file = File.join(root, "app", "models", "work_package", "pdf_export", "export", "standard.yml")
styles = YAML.load_file(styles_file)
validate_schema!(styles, schema)
puts "Valid: #{styles_file}"