chore: bump md-to-pdf to v0.1.1

This commit is contained in:
as-op
2024-06-26 16:33:15 +02:00
parent 9a9940c0ab
commit 2a7c37943a
6 changed files with 177 additions and 17 deletions
+1 -1
View File
@@ -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: "8772c791a21819751c0d111be903b3b44ef7d862"
gem "md_to_pdf", git: "https://github.com/opf/md-to-pdf", ref: "32603f09a249999a00e8ca23eb17215b46a26c0f"
gem "prawn", "~> 2.4"
gem "ttfunk", "~> 1.7.0" # remove after https://github.com/prawnpdf/prawn/issues/1346 resolved.
+4 -4
View File
@@ -8,16 +8,16 @@ GIT
GIT
remote: https://github.com/opf/md-to-pdf
revision: 8772c791a21819751c0d111be903b3b44ef7d862
ref: 8772c791a21819751c0d111be903b3b44ef7d862
revision: 32603f09a249999a00e8ca23eb17215b46a26c0f
ref: 32603f09a249999a00e8ca23eb17215b46a26c0f
specs:
md_to_pdf (0.0.27)
md_to_pdf (0.1.1)
color_conversion (~> 0.1)
front_matter_parser (~> 1.0)
json-schema (~> 4.3)
markly (~> 0.10)
matrix (~> 0.4)
nokogiri (~> 1.1)
nokogiri (~> 1.16)
prawn (~> 2.4)
prawn-table (~> 0.2)
text-hyphen (~> 1.5)
@@ -33,9 +33,10 @@ module WorkPackage::PDFExport::Markdown
include MarkdownToPDF::Core
include MarkdownToPDF::Parser
def initialize(styling_yml)
def initialize(styling_yml, pdf)
@styles = MarkdownToPDF::Styles.new(styling_yml)
init_options({ auto_generate_header_ids: false })
pdf_init_md2pdf_fonts(pdf)
# @hyphens = Hyphen.new('en', false)
end
@@ -96,7 +97,7 @@ module WorkPackage::PDFExport::Markdown
end
def write_markdown!(work_package, markdown)
md2pdf = MD2PDF.new(styles.wp_markdown_styling_yml)
md2pdf = MD2PDF.new(styles.wp_markdown_styling_yml, pdf)
md2pdf.draw_markdown(markdown, pdf, ->(src) {
with_images? ? attachment_image_filepath(work_package, src) : nil
})
+63 -1
View File
@@ -392,7 +392,7 @@
"group_heading" : {
"type" : "object",
"title" : "Overview group heading",
"description" : "Styling for the group lavel if grouping is activated",
"description" : "Styling for the group label if grouping is activated",
"x-example" : {
"group_heading" : {
"size" : 11,
@@ -981,6 +981,9 @@
"task_list_point" : {
"title" : "Markdown task list point",
"$ref" : "#/$defs/task_list_point"
},
"alerts": {
"$ref": "#/$defs/alerts"
}
},
"patternProperties" : {
@@ -1744,6 +1747,65 @@
"type" : "boolean"
}
}
},
"alert": {
"type": "object",
"title": "Alert",
"description": "Styling to denote a quote as alert box",
"x-example": {
"ALERT": {
"alert_color": "f4f9ff",
"border_color": "f4f9ff",
"border_width": 2,
"no_border_right": true,
"no_border_left": false,
"no_border_bottom": true,
"no_border_top": true
}
},
"properties": {
"background_color": {
"$ref": "#/$defs/color"
},
"alert_color": {
"$ref": "#/$defs/color"
}
},
"allOf": [
{
"$ref": "#/$defs/font"
},
{
"$ref": "#/$defs/border"
},
{
"$ref": "#/$defs/padding"
},
{
"$ref": "#/$defs/margin"
}
]
},
"alerts": {
"type": "object",
"title": "alert boxes (styled blockquotes)",
"properties": {
"NOTE": {
"$ref": "#/$defs/alert"
},
"TIP": {
"$ref": "#/$defs/alert"
},
"WARNING": {
"$ref": "#/$defs/alert"
},
"IMPORTANT": {
"$ref": "#/$defs/alert"
},
"CAUTION": {
"$ref": "#/$defs/alert"
}
}
}
}
}
@@ -192,6 +192,62 @@ work_package:
size: 8
border_width: 0.25
padding: 5
alerts:
NOTE:
border_color: '0969da'
alert_color: '0969da'
padding: '4mm'
size: 10
styles: [ ]
border_width: 2
no_border_right: true
no_border_left: false
no_border_bottom: true
no_border_top: true
TIP:
border_color: '1a7f37'
alert_color: '1a7f37'
padding: '4mm'
size: 10
styles: [ ]
border_width: 2
no_border_right: true
no_border_left: false
no_border_bottom: true
no_border_top: true
IMPORTANT:
border_color: '8250df'
alert_color: '8250df'
padding: '4mm'
size: 10
styles: [ ]
border_width: 2
no_border_right: true
no_border_left: false
no_border_bottom: true
no_border_top: true
WARNING:
border_color: 'bf8700'
alert_color: 'bf8700'
padding: '4mm'
size: 10
styles: [ ]
border_width: 2
no_border_right: true
no_border_left: false
no_border_bottom: true
no_border_top: true
CAUTION:
border_color: 'd1242f'
alert_color: 'd1242f'
size: 10
styles: [ ]
padding: '4mm'
border_width: 2
no_border_right: true
no_border_left: false
no_border_bottom: true
no_border_top: true
cover:
header:
@@ -15,6 +15,34 @@ This document describes the style settings format for the [PDF Export styling fi
| `cover` | **Cover page**<br/>Styling for the cover page of the PDF report export<br/>See [Cover page](#cover-page) | object |
| `overview` | **Overview**<br/>Styling for the PDF table export<br/>See [Overview](#overview) | object |
## Alert
Styling to denote a quote as alert box
Key: `alert`
Example:
```yaml
ALERT:
alert_color: f4f9ff
border_color: f4f9ff
border_width: 2
no_border_right: true
no_border_left: false
no_border_bottom: true
no_border_top: true
```
| Key | Description | Data type |
| - | - | - |
| `background_color` | **Color**<br/>A color in RRGGBB format<br/>Example: `F0F0F0` | string |
| `alert_color` | **Color**<br/>A color in RRGGBB format<br/>Example: `F0F0F0` | string |
| … | See [Font properties](#font-properties) | |
| … | See [Border Properties](#border-properties) | |
| … | See [Padding Properties](#padding-properties) | |
| … | See [Margin properties](#margin-properties) | |
## Border Properties
Properties to set borders
@@ -287,6 +315,7 @@ markdown:
| `unordered_list_point` | **Markdown unordered list point**<br/>Default styling for unordered list points on all levels.<br/>use unordered_list_point_`x` as key for unordered list points level `x`.<br/>See [Markdown unordered list point](#markdown-unordered-list-point) | object |
| `task_list` | **Markdown task list**<br/>See [Markdown unordered list](#markdown-unordered-list) | object |
| `task_list_point` | **Markdown task list point**<br/>See [Markdown task list point](#markdown-task-list-point) | object |
| `alerts` | **alert boxes (styled blockquotes)**<br/>See [alert boxes (styled blockquotes)](#alert-boxes-styled-blockquotes) | object |
| `ordered_list_point_1`<br/>`ordered_list_point_2`<br/>`ordered_list_point_x` | Markdown ordered list point level<br/>See [Markdown ordered list point](#markdown-ordered-list-point) | object |
| `ordered_list_1`<br/>`ordered_list_2`<br/>`ordered_list_x` | Markdown ordered list level<br/>See [Markdown ordered list](#markdown-ordered-list) | object |
| `unordered_list_point_1`<br/>`unordered_list_point_2`<br/>`unordered_list_point_x` | Markdown unordered list point level<br/>See [Markdown unordered list point](#markdown-unordered-list-point) | object |
@@ -621,14 +650,14 @@ overview:
table: {}
```
| 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 |
| Key | Description | Data type |
| - | - | - |
| `group_heading` | **Overview group heading**<br/>Styling for the group lavel 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 label if grouping is activated
Styling for the group lavel if grouping is activated
Key: `group_heading`
@@ -1092,10 +1121,10 @@ subject:
margin_bottom: 10
```
| Key | Description | Data type |
|-----|---------------------------------------------|-----------|
| … | See [Font properties](#font-properties) | |
| … | See [Margin properties](#margin-properties) | |
| Key | Description | Data type |
| - | - | - |
| … | See [Font properties](#font-properties) | |
| … | See [Margin properties](#margin-properties) | |
## Work package subject level
@@ -1123,6 +1152,18 @@ subject_level_3:
| … | See [Font properties](#font-properties) | |
| … | See [Margin properties](#margin-properties) | |
## alert boxes (styled blockquotes)
Key: `alerts`
| Key | Description | Data type |
| - | - | - |
| `NOTE` | **Alert**<br/>Styling to denote a quote as alert box<br/>See [Alert](#alert) | object |
| `TIP` | **Alert**<br/>Styling to denote a quote as alert box<br/>See [Alert](#alert) | object |
| `WARNING` | **Alert**<br/>Styling to denote a quote as alert box<br/>See [Alert](#alert) | object |
| `IMPORTANT` | **Alert**<br/>Styling to denote a quote as alert box<br/>See [Alert](#alert) | object |
| `CAUTION` | **Alert**<br/>Styling to denote a quote as alert box<br/>See [Alert](#alert) | object |
## Units
available units are