From aabec42a02805fe1294798764b1a73a5b25e1588 Mon Sep 17 00:00:00 2001 From: Andrew Frantz Date: Mon, 16 Dec 2024 16:47:47 -0500 Subject: [PATCH 1/5] feat: pretty print HTML --- wdl-doc/src/lib.rs | 4 +- wdl-doc/src/parameter.rs | 6 +- wdl-doc/src/struct.rs | 4 +- wdl-doc/src/task.rs | 4 +- wdl-doc/src/workflow.rs | 5 +- .../flag_filter/FlagFilter-struct.html | 17 +++++- .../data_structures/flag_filter/index.html | 6 +- .../validate_flag_filter-workflow.html | 39 ++++++++++++- ...e_string_is_12bit_oct_dec_or_hex-task.html | 39 ++++++++++++- .../read_group/ReadGroup-struct.html | 47 ++++++++++++++- .../read_group/get_read_groups-task.html | 48 +++++++++++++++- .../data_structures/read_group/index.html | 6 +- .../read_group/read_group_to_string-task.html | 39 ++++++++++++- .../read_group/validate_read_group-task.html | 57 ++++++++++++++++++- 14 files changed, 296 insertions(+), 25 deletions(-) diff --git a/wdl-doc/src/lib.rs b/wdl-doc/src/lib.rs index e17e89ce5..bc5dd62eb 100644 --- a/wdl-doc/src/lib.rs +++ b/wdl-doc/src/lib.rs @@ -93,8 +93,8 @@ impl Display for Document { let mut preamble = String::new(); pulldown_cmark::html::push_html(&mut preamble, parser); - write!(f, "{}", document_name)?; - write!(f, "{}", version)?; + write!(f, "{:?}", document_name)?; + write!(f, "{:?}", version)?; write!(f, "{}", preamble) } } diff --git a/wdl-doc/src/parameter.rs b/wdl-doc/src/parameter.rs index 78cc6a4bd..d67a5afd6 100644 --- a/wdl-doc/src/parameter.rs +++ b/wdl-doc/src/parameter.rs @@ -60,8 +60,8 @@ impl Display for Parameter { .build() }; - write!(f, "{}", parameter_name)?; - write!(f, "{}", parameter_type)?; - write!(f, "{}", parameter_expr) + write!(f, "{:?}", parameter_name)?; + write!(f, "{:?}", parameter_type)?; + write!(f, "{:?}", parameter_expr) } } diff --git a/wdl-doc/src/struct.rs b/wdl-doc/src/struct.rs index bd191a4f8..063ec7ac9 100644 --- a/wdl-doc/src/struct.rs +++ b/wdl-doc/src/struct.rs @@ -49,7 +49,7 @@ impl Display for Struct { } let members = members.build(); - write!(f, "{}", struct_name)?; - write!(f, "{}", members) + write!(f, "{:?}", struct_name)?; + write!(f, "{:?}", members) } } diff --git a/wdl-doc/src/task.rs b/wdl-doc/src/task.rs index b38e0a8e4..f5e956eb9 100644 --- a/wdl-doc/src/task.rs +++ b/wdl-doc/src/task.rs @@ -103,7 +103,7 @@ impl Display for Task { .build(), ); - write!(f, "{}", task_name)?; - write!(f, "{}", content.build()) + write!(f, "{:?}", task_name)?; + write!(f, "{:?}", content.build()) } } diff --git a/wdl-doc/src/workflow.rs b/wdl-doc/src/workflow.rs index f4010e260..c71ed2d9e 100644 --- a/wdl-doc/src/workflow.rs +++ b/wdl-doc/src/workflow.rs @@ -1,5 +1,6 @@ //! Create HTML documentation for WDL tasks. +use std::fmt::Debug; use std::fmt::Display; use html::content; @@ -103,7 +104,7 @@ impl Display for Workflow { .build(), ); - write!(f, "{}", task_name)?; - write!(f, "{}", content.build()) + write!(f, "{:?}", task_name)?; + write!(f, "{:?}", content.build()) } } diff --git a/wdl-doc/tests/output_docs/data_structures/flag_filter/FlagFilter-struct.html b/wdl-doc/tests/output_docs/data_structures/flag_filter/FlagFilter-struct.html index bad00e5a2..d2cad40aa 100644 --- a/wdl-doc/tests/output_docs/data_structures/flag_filter/FlagFilter-struct.html +++ b/wdl-doc/tests/output_docs/data_structures/flag_filter/FlagFilter-struct.html @@ -1 +1,16 @@ -

FlagFilter

\ No newline at end of file +

+ FlagFilter +

\ No newline at end of file diff --git a/wdl-doc/tests/output_docs/data_structures/flag_filter/index.html b/wdl-doc/tests/output_docs/data_structures/flag_filter/index.html index 4c1fd8562..03710860d 100644 --- a/wdl-doc/tests/output_docs/data_structures/flag_filter/index.html +++ b/wdl-doc/tests/output_docs/data_structures/flag_filter/index.html @@ -1,4 +1,8 @@ -

flag_filter

WDL Version: 1.1

FlagFilter

+

+ flag_filter +

+ WDL Version: 1.1 +

FlagFilter

A struct to represent the filtering flags used in various samtools commands. The order of precedence is include_if_all, exclude_if_any, include_if_any, and exclude_if_all. diff --git a/wdl-doc/tests/output_docs/data_structures/flag_filter/validate_flag_filter-workflow.html b/wdl-doc/tests/output_docs/data_structures/flag_filter/validate_flag_filter-workflow.html index 21ffcf094..f9047a422 100644 --- a/wdl-doc/tests/output_docs/data_structures/flag_filter/validate_flag_filter-workflow.html +++ b/wdl-doc/tests/output_docs/data_structures/flag_filter/validate_flag_filter-workflow.html @@ -1,6 +1,41 @@ -

validate_flag_filter

\ No newline at end of file diff --git a/wdl-doc/tests/output_docs/data_structures/flag_filter/validate_string_is_12bit_oct_dec_or_hex-task.html b/wdl-doc/tests/output_docs/data_structures/flag_filter/validate_string_is_12bit_oct_dec_or_hex-task.html index bb350a18c..4f05578ec 100644 --- a/wdl-doc/tests/output_docs/data_structures/flag_filter/validate_string_is_12bit_oct_dec_or_hex-task.html +++ b/wdl-doc/tests/output_docs/data_structures/flag_filter/validate_string_is_12bit_oct_dec_or_hex-task.html @@ -1,7 +1,42 @@ -

validate_string_is_12bit_oct_dec_or_hex

\ No newline at end of file diff --git a/wdl-doc/tests/output_docs/data_structures/read_group/ReadGroup-struct.html b/wdl-doc/tests/output_docs/data_structures/read_group/ReadGroup-struct.html index d15f4b441..b359bdb31 100644 --- a/wdl-doc/tests/output_docs/data_structures/read_group/ReadGroup-struct.html +++ b/wdl-doc/tests/output_docs/data_structures/read_group/ReadGroup-struct.html @@ -1 +1,46 @@ -

ReadGroup

\ No newline at end of file +

+ ReadGroup +

\ No newline at end of file diff --git a/wdl-doc/tests/output_docs/data_structures/read_group/get_read_groups-task.html b/wdl-doc/tests/output_docs/data_structures/read_group/get_read_groups-task.html index b04938e49..ca3a7f24a 100644 --- a/wdl-doc/tests/output_docs/data_structures/read_group/get_read_groups-task.html +++ b/wdl-doc/tests/output_docs/data_structures/read_group/get_read_groups-task.html @@ -1,6 +1,50 @@ -

get_read_groups

\ No newline at end of file diff --git a/wdl-doc/tests/output_docs/data_structures/read_group/index.html b/wdl-doc/tests/output_docs/data_structures/read_group/index.html index 854680ed8..fcc4a7a00 100644 --- a/wdl-doc/tests/output_docs/data_structures/read_group/index.html +++ b/wdl-doc/tests/output_docs/data_structures/read_group/index.html @@ -1,4 +1,8 @@ -

read_group

WDL Version: 1.1

Read groups are defined in the SAM spec

+

+ read_group +

+ WDL Version: 1.1 +

Read groups are defined in the SAM spec

\ No newline at end of file + diff --git a/wdl-doc/tests/output_docs/data_structures/flag_filter/validate_string_is_12bit_oct_dec_or_hex-task.html b/wdl-doc/tests/output_docs/data_structures/flag_filter/validate_string_is_12bit_oct_dec_or_hex-task.html index 4f05578ec..b5cc51167 100644 --- a/wdl-doc/tests/output_docs/data_structures/flag_filter/validate_string_is_12bit_oct_dec_or_hex-task.html +++ b/wdl-doc/tests/output_docs/data_structures/flag_filter/validate_string_is_12bit_oct_dec_or_hex-task.html @@ -1,6 +1,7 @@

validate_string_is_12bit_oct_dec_or_hex -

- \ No newline at end of file + diff --git a/wdl-doc/tests/output_docs/data_structures/read_group/ReadGroup-struct.html b/wdl-doc/tests/output_docs/data_structures/read_group/ReadGroup-struct.html index b359bdb31..c95360a31 100644 --- a/wdl-doc/tests/output_docs/data_structures/read_group/ReadGroup-struct.html +++ b/wdl-doc/tests/output_docs/data_structures/read_group/ReadGroup-struct.html @@ -1,6 +1,7 @@

ReadGroup -

diff --git a/wdl-doc/tests/output_docs/data_structures/read_group/get_read_groups-task.html b/wdl-doc/tests/output_docs/data_structures/read_group/get_read_groups-task.html index ca3a7f24a..d716b5361 100644 --- a/wdl-doc/tests/output_docs/data_structures/read_group/get_read_groups-task.html +++ b/wdl-doc/tests/output_docs/data_structures/read_group/get_read_groups-task.html @@ -1,6 +1,7 @@

get_read_groups -

- \ No newline at end of file + diff --git a/wdl-doc/tests/output_docs/data_structures/read_group/index.html b/wdl-doc/tests/output_docs/data_structures/read_group/index.html index fcc4a7a00..34411dc7e 100644 --- a/wdl-doc/tests/output_docs/data_structures/read_group/index.html +++ b/wdl-doc/tests/output_docs/data_structures/read_group/index.html @@ -1,8 +1,10 @@

read_group -

+ +

WDL Version: 1.1 -

Read groups are defined in the SAM spec

+

+

Read groups are defined in the SAM spec

\ No newline at end of file + diff --git a/wdl-doc/tests/output_docs/data_structures/read_group/validate_read_group-task.html b/wdl-doc/tests/output_docs/data_structures/read_group/validate_read_group-task.html index eda77af76..4b0c50291 100644 --- a/wdl-doc/tests/output_docs/data_structures/read_group/validate_read_group-task.html +++ b/wdl-doc/tests/output_docs/data_structures/read_group/validate_read_group-task.html @@ -1,6 +1,7 @@

validate_read_group -

- \ No newline at end of file + From a27e0b2fe0a8c9a0b7ada909487a9ac7c89cb7f7 Mon Sep 17 00:00:00 2001 From: Andrew Frantz Date: Tue, 17 Dec 2024 08:40:05 -0500 Subject: [PATCH 5/5] chore: clippy --- wdl-doc/src/lib.rs | 4 ++-- wdl-doc/src/parameter.rs | 6 +++--- wdl-doc/src/struct.rs | 4 ++-- wdl-doc/src/task.rs | 4 ++-- wdl-doc/src/workflow.rs | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/wdl-doc/src/lib.rs b/wdl-doc/src/lib.rs index b98ca998d..a8448952c 100644 --- a/wdl-doc/src/lib.rs +++ b/wdl-doc/src/lib.rs @@ -93,8 +93,8 @@ impl Display for Document { let mut preamble = String::new(); pulldown_cmark::html::push_html(&mut preamble, parser); - write!(f, "{:?}\n", document_name)?; - write!(f, "{:?}\n", version)?; + writeln!(f, "{:?}", document_name)?; + writeln!(f, "{:?}", version)?; write!(f, "{}", preamble) } } diff --git a/wdl-doc/src/parameter.rs b/wdl-doc/src/parameter.rs index 70f65aff1..c0bcead55 100644 --- a/wdl-doc/src/parameter.rs +++ b/wdl-doc/src/parameter.rs @@ -60,8 +60,8 @@ impl Display for Parameter { .build() }; - write!(f, "{:?}\n", parameter_name)?; - write!(f, "{:?}\n", parameter_type)?; - write!(f, "{:?}\n", parameter_expr) + writeln!(f, "{:?}", parameter_name)?; + writeln!(f, "{:?}", parameter_type)?; + writeln!(f, "{:?}", parameter_expr) } } diff --git a/wdl-doc/src/struct.rs b/wdl-doc/src/struct.rs index fe848bd9a..0683701e1 100644 --- a/wdl-doc/src/struct.rs +++ b/wdl-doc/src/struct.rs @@ -49,7 +49,7 @@ impl Display for Struct { } let members = members.build(); - write!(f, "{:?}\n", struct_name)?; - write!(f, "{:?}\n", members) + writeln!(f, "{:?}", struct_name)?; + writeln!(f, "{:?}", members) } } diff --git a/wdl-doc/src/task.rs b/wdl-doc/src/task.rs index 6b50ae1d4..4a7f87696 100644 --- a/wdl-doc/src/task.rs +++ b/wdl-doc/src/task.rs @@ -103,7 +103,7 @@ impl Display for Task { .build(), ); - write!(f, "{:?}\n", task_name)?; - write!(f, "{:?}\n", content.build()) + writeln!(f, "{:?}", task_name)?; + writeln!(f, "{:?}", content.build()) } } diff --git a/wdl-doc/src/workflow.rs b/wdl-doc/src/workflow.rs index dbb3a940c..8828c5a72 100644 --- a/wdl-doc/src/workflow.rs +++ b/wdl-doc/src/workflow.rs @@ -104,7 +104,7 @@ impl Display for Workflow { .build(), ); - write!(f, "{:?}\n", task_name)?; - write!(f, "{:?}\n", content.build()) + writeln!(f, "{:?}", task_name)?; + writeln!(f, "{:?}", content.build()) } }