Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pretty print HTML #270

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions wdl-doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

* `wdl-doc` crate for documenting WDL codebases ([#258](https://github.com/stjude-rust-labs/wdl/pull/248)).

### Changed

* Pretty print HTML ([#270](https://github.com/stjude-rust-labs/wdl/pull/270)).
a-frantz marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions wdl-doc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
6 changes: 3 additions & 3 deletions wdl-doc/src/parameter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
4 changes: 2 additions & 2 deletions wdl-doc/src/struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
4 changes: 2 additions & 2 deletions wdl-doc/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
5 changes: 3 additions & 2 deletions wdl-doc/src/workflow.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Create HTML documentation for WDL tasks.

use std::fmt::Debug;
use std::fmt::Display;

use html::content;
Expand Down Expand Up @@ -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())
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
<h1>FlagFilter</h1><ul><li>include_if_all: String</li><li>exclude_if_any: String</li><li>include_if_any: String</li><li>exclude_if_all: String</li></ul>
<h1>
FlagFilter
</h1><ul>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this needs some newlines.

<li>
include_if_all: String
</li>
<li>
exclude_if_any: String
</li>
<li>
include_if_any: String
</li>
<li>
exclude_if_all: String
</li>
</ul>
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<h1>flag_filter</h1><p>WDL Version: 1.1</p><h1>FlagFilter</h1>
<h1>
flag_filter
</h1><p>
WDL Version: 1.1
</p><h1>FlagFilter</h1>
<p>A struct to represent the filtering flags used in various <code>samtools</code> commands.
The order of precedence is <code>include_if_all</code>, <code>exclude_if_any</code>, <code>include_if_any</code>,
and <code>exclude_if_all</code>.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@
<h1>validate_flag_filter</h1><ul><li>Meta:meta {
<h1>
validate_flag_filter
</h1><ul>
<li>
Meta:
meta {
description: "Validates a FlagFilter struct."
outputs: {
check: "Dummy output to enable caching."
}
}</li><li>Inputs:<ul><li><h2>flags</h2><p>Type: FlagFilter</p><p>Expr: None</p></li></ul></li><li>Outputs:<ul><li><h2>check</h2><p>Type: String</p><p>Expr: "passed"</p></li></ul></li></ul>
}
</li>
<li>
Inputs:
<ul>
<li>
<h2>
flags
</h2><p>
Type: FlagFilter
</p><p>
Expr: None
</p>
</li>
</ul>
</li>
<li>
Outputs:
<ul>
<li>
<h2>
check
</h2><p>
Type: String
</p><p>
Expr: "passed"
</p>
</li>
</ul>
</li>
</ul>
Original file line number Diff line number Diff line change
@@ -1,7 +1,42 @@
<h1>validate_string_is_12bit_oct_dec_or_hex</h1><ul><li>Meta:meta {
<h1>
validate_string_is_12bit_oct_dec_or_hex
</h1><ul>
<li>
Meta:
meta {
description: "Validates that a string is a octal, decimal, or hexadecimal number and less than 2^12."
help: "Hexadecimal numbers must be prefixed with '0x' and only contain the characters [0-9A-F] to be valid (i.e. [a-f] is not allowed). Octal number must start with '0' and only contain the characters [0-7] to be valid. And decimal numbers must start with a digit between 1-9 and only contain the characters [0-9] to be valid."
outputs: {
check: "Dummy output to enable caching."
}
}</li><li>Inputs:<ul><li><h2>number</h2><p>Type: String</p><p>Expr: None</p></li></ul></li><li>Outputs:<ul><li><h2>check</h2><p>Type: String</p><p>Expr: "passed"</p></li></ul></li></ul>
}
</li>
<li>
Inputs:
<ul>
<li>
<h2>
number
</h2><p>
Type: String
</p><p>
Expr: None
</p>
</li>
</ul>
</li>
<li>
Outputs:
<ul>
<li>
<h2>
check
</h2><p>
Type: String
</p><p>
Expr: "passed"
</p>
</li>
</ul>
</li>
</ul>
Original file line number Diff line number Diff line change
@@ -1 +1,46 @@
<h1>ReadGroup</h1><ul><li>ID: String</li><li>BC: String?</li><li>CN: String?</li><li>DS: String?</li><li>DT: String?</li><li>FO: String?</li><li>KS: String?</li><li>LB: String?</li><li>PG: String?</li><li>PI: Int?</li><li>PL: String?</li><li>PM: String?</li><li>PU: String?</li><li>SM: String?</li></ul>
<h1>
ReadGroup
</h1><ul>
<li>
ID: String
</li>
<li>
BC: String?
</li>
<li>
CN: String?
</li>
<li>
DS: String?
</li>
<li>
DT: String?
</li>
<li>
FO: String?
</li>
<li>
KS: String?
</li>
<li>
LB: String?
</li>
<li>
PG: String?
</li>
<li>
PI: Int?
</li>
<li>
PL: String?
</li>
<li>
PM: String?
</li>
<li>
PU: String?
</li>
<li>
SM: String?
</li>
</ul>
Original file line number Diff line number Diff line change
@@ -1,6 +1,50 @@
<h1>get_read_groups</h1><ul><li>Meta:meta {
<h1>
get_read_groups
</h1><ul>
<li>
Meta:
meta {
description: "Gets read group information from a BAM file and writes it out as JSON which is converted to a WDL struct."
outputs: {
read_groups: "An array of ReadGroup structs containing read group information."
}
}</li><li>Inputs:<ul><li><h2>bam</h2><p>Type: File</p><p>Expr: None</p></li><li><h2>modify_disk_size_gb</h2><p>Type: Int</p><p>Expr: 0</p></li></ul></li><li>Outputs:<ul><li><h2>read_groups</h2><p>Type: Array[ReadGroup]</p><p>Expr: read_json("read_groups.json")</p></li></ul></li></ul>
}
</li>
<li>
Inputs:
<ul>
<li>
<h2>
bam
</h2><p>
Type: File
</p><p>
Expr: None
</p>
</li>
<li>
<h2>
modify_disk_size_gb
</h2><p>
Type: Int
</p><p>
Expr: 0
</p>
</li>
</ul>
</li>
<li>
Outputs:
<ul>
<li>
<h2>
read_groups
</h2><p>
Type: Array[ReadGroup]
</p><p>
Expr: read_json("read_groups.json")
</p>
</li>
</ul>
</li>
</ul>
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<h1>read_group</h1><p>WDL Version: 1.1</p><p>Read groups are defined in the SAM spec</p>
<h1>
read_group
</h1><p>
WDL Version: 1.1
</p><p>Read groups are defined in the SAM spec</p>
<ul>
<li>ID: Read group identifier. Each Read Group must have a unique ID.
The value of ID is used in the RG tags of alignment records.</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@
<h1>read_group_to_string</h1><ul><li>Meta:meta {
<h1>
read_group_to_string
</h1><ul>
<li>
Meta:
meta {
description: "Stringifies a ReadGroup struct"
outputs: {
stringified_read_group: "Input ReadGroup as a string"
}
}</li><li>Inputs:<ul><li><h2>read_group</h2><p>Type: ReadGroup</p><p>Expr: None</p></li></ul></li><li>Outputs:<ul><li><h2>stringified_read_group</h2><p>Type: String</p><p>Expr: read_string("out.txt")</p></li></ul></li></ul>
}
</li>
<li>
Inputs:
<ul>
<li>
<h2>
read_group
</h2><p>
Type: ReadGroup
</p><p>
Expr: None
</p>
</li>
</ul>
</li>
<li>
Outputs:
<ul>
<li>
<h2>
stringified_read_group
</h2><p>
Type: String
</p><p>
Expr: read_string("out.txt")
</p>
</li>
</ul>
</li>
</ul>
Loading
Loading