diff options
author | Linus Groh <mail@linusgroh.de> | 2023-01-26 18:58:09 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-01-27 20:38:49 +0000 |
commit | 6e7459322d8336bfe52e390ab4a1b2e82e24c05e (patch) | |
tree | 6da4b3a89764a22a1c62eabfa5fc5ee954519c41 /Userland/Libraries/LibMarkdown | |
parent | da81041e97d0fc7d37a985ce6ca4ded19ce2cdd1 (diff) | |
download | serenity-6e7459322d8336bfe52e390ab4a1b2e82e24c05e.zip |
AK: Remove StringBuilder::build() in favor of to_deprecated_string()
Having an alias function that only wraps another one is silly, and
keeping the more obvious name should flush out more uses of deprecated
strings.
No behavior change.
Diffstat (limited to 'Userland/Libraries/LibMarkdown')
-rw-r--r-- | Userland/Libraries/LibMarkdown/BlockQuote.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibMarkdown/CodeBlock.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibMarkdown/CommentBlock.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibMarkdown/ContainerBlock.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibMarkdown/Document.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibMarkdown/Heading.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibMarkdown/List.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibMarkdown/Paragraph.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibMarkdown/Table.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibMarkdown/Text.cpp | 8 |
10 files changed, 22 insertions, 22 deletions
diff --git a/Userland/Libraries/LibMarkdown/BlockQuote.cpp b/Userland/Libraries/LibMarkdown/BlockQuote.cpp index 191f7a96a6..ac40a2650b 100644 --- a/Userland/Libraries/LibMarkdown/BlockQuote.cpp +++ b/Userland/Libraries/LibMarkdown/BlockQuote.cpp @@ -17,7 +17,7 @@ DeprecatedString BlockQuote::render_to_html(bool) const builder.append("<blockquote>\n"sv); builder.append(m_contents->render_to_html()); builder.append("</blockquote>\n"sv); - return builder.build(); + return builder.to_deprecated_string(); } Vector<DeprecatedString> BlockQuote::render_lines_for_terminal(size_t view_width) const diff --git a/Userland/Libraries/LibMarkdown/CodeBlock.cpp b/Userland/Libraries/LibMarkdown/CodeBlock.cpp index 1a2f1e753d..1d388fabca 100644 --- a/Userland/Libraries/LibMarkdown/CodeBlock.cpp +++ b/Userland/Libraries/LibMarkdown/CodeBlock.cpp @@ -51,7 +51,7 @@ DeprecatedString CodeBlock::render_to_html(bool) const builder.append("</pre>\n"sv); - return builder.build(); + return builder.to_deprecated_string(); } Vector<DeprecatedString> CodeBlock::render_lines_for_terminal(size_t) const @@ -174,7 +174,7 @@ OwnPtr<CodeBlock> CodeBlock::parse_backticks(LineIterator& lines, Heading* curre builder.append('\n'); } - return make<CodeBlock>(language, style, builder.build(), current_section); + return make<CodeBlock>(language, style, builder.to_deprecated_string(), current_section); } OwnPtr<CodeBlock> CodeBlock::parse_indent(LineIterator& lines) @@ -197,6 +197,6 @@ OwnPtr<CodeBlock> CodeBlock::parse_indent(LineIterator& lines) builder.append('\n'); } - return make<CodeBlock>("", "", builder.build(), nullptr); + return make<CodeBlock>("", "", builder.to_deprecated_string(), nullptr); } } diff --git a/Userland/Libraries/LibMarkdown/CommentBlock.cpp b/Userland/Libraries/LibMarkdown/CommentBlock.cpp index 0b07ba7459..b885b32e94 100644 --- a/Userland/Libraries/LibMarkdown/CommentBlock.cpp +++ b/Userland/Libraries/LibMarkdown/CommentBlock.cpp @@ -20,7 +20,7 @@ DeprecatedString CommentBlock::render_to_html(bool) const // TODO: This is probably incorrect, because we technically need to escape "--" in some form. However, Browser does not care about this. builder.append("-->\n"sv); - return builder.build(); + return builder.to_deprecated_string(); } Vector<DeprecatedString> CommentBlock::render_lines_for_terminal(size_t) const @@ -69,7 +69,7 @@ OwnPtr<CommentBlock> CommentBlock::parse(LineIterator& lines) line = *lines; } - return make<CommentBlock>(builder.build()); + return make<CommentBlock>(builder.to_deprecated_string()); } } diff --git a/Userland/Libraries/LibMarkdown/ContainerBlock.cpp b/Userland/Libraries/LibMarkdown/ContainerBlock.cpp index 5810b8276b..d18fab6b4b 100644 --- a/Userland/Libraries/LibMarkdown/ContainerBlock.cpp +++ b/Userland/Libraries/LibMarkdown/ContainerBlock.cpp @@ -37,7 +37,7 @@ DeprecatedString ContainerBlock::render_to_html(bool tight) const } } - return builder.build(); + return builder.to_deprecated_string(); } Vector<DeprecatedString> ContainerBlock::render_lines_for_terminal(size_t view_width) const @@ -97,7 +97,7 @@ OwnPtr<ContainerBlock> ContainerBlock::parse(LineIterator& lines) auto flush_paragraph = [&] { if (paragraph_text.is_empty()) return; - auto paragraph = make<Paragraph>(Text::parse(paragraph_text.build())); + auto paragraph = make<Paragraph>(Text::parse(paragraph_text.to_deprecated_string())); blocks.append(move(paragraph)); paragraph_text.clear(); }; diff --git a/Userland/Libraries/LibMarkdown/Document.cpp b/Userland/Libraries/LibMarkdown/Document.cpp index df088e326e..6e6ff08041 100644 --- a/Userland/Libraries/LibMarkdown/Document.cpp +++ b/Userland/Libraries/LibMarkdown/Document.cpp @@ -35,7 +35,7 @@ DeprecatedString Document::render_to_html(StringView extra_head_contents) const </body> </html>)~~~"sv); - return builder.build(); + return builder.to_deprecated_string(); } DeprecatedString Document::render_to_inline_html() const @@ -51,7 +51,7 @@ DeprecatedString Document::render_for_terminal(size_t view_width) const builder.append("\n"sv); } - return builder.build(); + return builder.to_deprecated_string(); } RecursionDecision Document::walk(Visitor& visitor) const diff --git a/Userland/Libraries/LibMarkdown/Heading.cpp b/Userland/Libraries/LibMarkdown/Heading.cpp index e31db29959..1e2b0c3121 100644 --- a/Userland/Libraries/LibMarkdown/Heading.cpp +++ b/Userland/Libraries/LibMarkdown/Heading.cpp @@ -32,7 +32,7 @@ Vector<DeprecatedString> Heading::render_lines_for_terminal(size_t) const break; } - return Vector<DeprecatedString> { builder.build() }; + return Vector<DeprecatedString> { builder.to_deprecated_string() }; } RecursionDecision Heading::walk(Visitor& visitor) const diff --git a/Userland/Libraries/LibMarkdown/List.cpp b/Userland/Libraries/LibMarkdown/List.cpp index ac5a48e221..75f46d2119 100644 --- a/Userland/Libraries/LibMarkdown/List.cpp +++ b/Userland/Libraries/LibMarkdown/List.cpp @@ -35,7 +35,7 @@ DeprecatedString List::render_to_html(bool) const builder.appendff("</{}>\n", tag); - return builder.build(); + return builder.to_deprecated_string(); } Vector<DeprecatedString> List::render_lines_for_terminal(size_t view_width) const @@ -57,13 +57,13 @@ Vector<DeprecatedString> List::render_lines_for_terminal(size_t view_width) cons builder.append(first_line); - lines.append(builder.build()); + lines.append(builder.to_deprecated_string()); for (auto& line : item_lines) { builder.clear(); builder.append(DeprecatedString::repeated(' ', item_indentation)); builder.append(line); - lines.append(builder.build()); + lines.append(builder.to_deprecated_string()); } } diff --git a/Userland/Libraries/LibMarkdown/Paragraph.cpp b/Userland/Libraries/LibMarkdown/Paragraph.cpp index afb0d2860d..3ad5e50967 100644 --- a/Userland/Libraries/LibMarkdown/Paragraph.cpp +++ b/Userland/Libraries/LibMarkdown/Paragraph.cpp @@ -25,7 +25,7 @@ DeprecatedString Paragraph::render_to_html(bool tight) const builder.append('\n'); - return builder.build(); + return builder.to_deprecated_string(); } Vector<DeprecatedString> Paragraph::render_lines_for_terminal(size_t) const diff --git a/Userland/Libraries/LibMarkdown/Table.cpp b/Userland/Libraries/LibMarkdown/Table.cpp index d1f8b37aab..d526e7acff 100644 --- a/Userland/Libraries/LibMarkdown/Table.cpp +++ b/Userland/Libraries/LibMarkdown/Table.cpp @@ -44,12 +44,12 @@ Vector<DeprecatedString> Table::render_lines_for_terminal(size_t view_width) con write_aligned(col.header, width, col.alignment); } - lines.append(builder.build()); + lines.append(builder.to_deprecated_string()); builder.clear(); for (size_t i = 0; i < view_width; ++i) builder.append('-'); - lines.append(builder.build()); + lines.append(builder.to_deprecated_string()); builder.clear(); for (size_t i = 0; i < m_row_count; ++i) { @@ -65,7 +65,7 @@ Vector<DeprecatedString> Table::render_lines_for_terminal(size_t view_width) con size_t width = col.relative_width * unit_width_length; write_aligned(cell, width, col.alignment); } - lines.append(builder.build()); + lines.append(builder.to_deprecated_string()); builder.clear(); } diff --git a/Userland/Libraries/LibMarkdown/Text.cpp b/Userland/Libraries/LibMarkdown/Text.cpp index 2a410f1976..c5296ebfaa 100644 --- a/Userland/Libraries/LibMarkdown/Text.cpp +++ b/Userland/Libraries/LibMarkdown/Text.cpp @@ -266,14 +266,14 @@ DeprecatedString Text::render_to_html() const { StringBuilder builder; m_node->render_to_html(builder); - return builder.build().trim(" \n\t"sv); + return builder.to_deprecated_string().trim(" \n\t"sv); } DeprecatedString Text::render_for_terminal() const { StringBuilder builder; m_node->render_for_terminal(builder); - return builder.build().trim(" \n\t"sv); + return builder.to_deprecated_string().trim(" \n\t"sv); } RecursionDecision Text::walk(Visitor& visitor) const @@ -323,7 +323,7 @@ Vector<Text::Token> Text::tokenize(StringView str) return; tokens.append({ - current_token.build(), + current_token.to_deprecated_string(), left_flanking, right_flanking, punct_before, @@ -627,7 +627,7 @@ NonnullOwnPtr<Text::Node> Text::parse_link(Vector<Token>::ConstIterator& tokens) if (*iterator == ")"sv) { tokens = iterator; - return make<LinkNode>(is_image, move(link_text), address.build().trim_whitespace(), image_width, image_height); + return make<LinkNode>(is_image, move(link_text), address.to_deprecated_string().trim_whitespace(), image_width, image_height); } address.append(iterator->data); |