Skip to content

Commit 9a8ff34

Browse files
authored
[mlir][doc] Trim summary text during DocGen (llvm#68477)
When defining a multi-line string in tblgen, the output in the Markdown file currently contains too much whitespace and newlines for Hugo's Markdown parser. For example, for `arith.addui_extended` the tblgen ```tblgen let summary = [{ extended unsigned integer addition operation returning sum and overflow bit }]; ``` is currently converted to ```markdown _ extended unsigned integer addition operation returning sum and overflow bit _ ``` which causes the text to not be italicized (as can be seen at https://mlir.llvm.org/docs/Dialects/ArithOps/#arithaddui_extended-arithadduiextendedop). After this PR, the output becomes ``` _Extended unsigned integer addition operation returning sum and overflow bit_ ```
1 parent 69b6b48 commit 9a8ff34

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mlir/tools/mlir-tblgen/OpDocGen.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ using mlir::tblgen::Operator;
5454

5555
void mlir::tblgen::emitSummary(StringRef summary, raw_ostream &os) {
5656
if (!summary.empty()) {
57-
char first = std::toupper(summary.front());
58-
llvm::StringRef rest = summary.drop_front();
57+
llvm::StringRef trimmed = summary.trim();
58+
char first = std::toupper(trimmed.front());
59+
llvm::StringRef rest = trimmed.drop_front();
5960
os << "\n_" << first << rest << "_\n\n";
6061
}
6162
}

0 commit comments

Comments
 (0)