Skip to content

Commit ec81e24

Browse files
rename HTML types to use uppercase acronyms
1 parent 187131c commit ec81e24

File tree

5 files changed

+30
-30
lines changed

5 files changed

+30
-30
lines changed

Sources/Markdown/Markdown.docc/Markdown/FormatterAndOptions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
### Formatter
66

77
- ``MarkupFormatter``
8-
- ``HtmlFormatter``
8+
- ``HTMLFormatter``
99

1010
### Options
1111

1212
- ``MarkupDumpOptions``
13-
- ``HtmlFormatterOptions``
13+
- ``HTMLFormatterOptions``
1414

1515
<!-- Copyright (c) 2021-2022 Apple Inc and the Swift Project authors. All Rights Reserved. -->

Sources/Markdown/Walker/Walkers/HtmlFormatter.swift renamed to Sources/Markdown/Walker/Walkers/HTMLFormatter.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
import Foundation
1212

13-
/// Options given to the ``HtmlFormatter``.
14-
public struct HtmlFormatterOptions: OptionSet {
13+
/// Options given to the ``HTMLFormatter``.
14+
public struct HTMLFormatterOptions: OptionSet {
1515
public var rawValue: UInt
1616
public init(rawValue: UInt) {
1717
self.rawValue = rawValue
@@ -29,36 +29,36 @@ public struct HtmlFormatterOptions: OptionSet {
2929
/// ```markdown
3030
/// > This is a compound sentence: It contains two clauses separated by a colon.
3131
/// ```
32-
public static let parseAsides = HtmlFormatterOptions(rawValue: 1 << 0)
32+
public static let parseAsides = HTMLFormatterOptions(rawValue: 1 << 0)
3333

3434
/// Parse inline attributes as JSON and use the `"class"` property as the resulting span's `class`.
35-
public static let parseInlineAttributeClass = HtmlFormatterOptions(rawValue: 1 << 1)
35+
public static let parseInlineAttributeClass = HTMLFormatterOptions(rawValue: 1 << 1)
3636
}
3737

3838
/// A ``MarkupWalker`` that prints rendered HTML for a given ``Markup`` tree.
39-
public struct HtmlFormatter: MarkupWalker {
39+
public struct HTMLFormatter: MarkupWalker {
4040
/// The resulting HTML built up after printing.
4141
public var result = ""
4242

43-
let options: HtmlFormatterOptions
43+
let options: HTMLFormatterOptions
4444

4545
var inTableHead = false
4646
var tableColumnAlignments: [Table.ColumnAlignment?]? = nil
4747
var currentTableColumn = 0
4848

49-
public init(options: HtmlFormatterOptions = []) {
49+
public init(options: HTMLFormatterOptions = []) {
5050
self.options = options
5151
}
5252

5353
/// Format HTML for the given markup tree.
54-
public static func format(_ markup: Markup, options: HtmlFormatterOptions = []) -> String {
55-
var walker = HtmlFormatter(options: options)
54+
public static func format(_ markup: Markup, options: HTMLFormatterOptions = []) -> String {
55+
var walker = HTMLFormatter(options: options)
5656
walker.visit(markup)
5757
return walker.result
5858
}
5959

6060
/// Format HTML for the given input text.
61-
public static func format(_ inputString: String, options: HtmlFormatterOptions = []) -> String {
61+
public static func format(_ inputString: String, options: HTMLFormatterOptions = []) -> String {
6262
let document = Document(parsing: inputString)
6363
return format(document, options: options)
6464
}

Sources/markdown-tool/Commands/PrintHtmlCommand.swift renamed to Sources/markdown-tool/Commands/PrintHTMLCommand.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Markdown
1313

1414
extension MarkdownCommand {
1515
/// A command to render HTML for given Markdown content.
16-
struct PrintHtml: ParsableCommand {
16+
struct PrintHTML: ParsableCommand {
1717
static var configuration = CommandConfiguration(commandName: "print-html", abstract: "Convert Markdown content into HTML")
1818

1919
@Argument(
@@ -44,15 +44,15 @@ extension MarkdownCommand {
4444
(_, document) = try MarkdownCommand.parseStandardInput(options: [])
4545
}
4646

47-
var formatterOptions = HtmlFormatterOptions()
47+
var formatterOptions = HTMLFormatterOptions()
4848
if parseAsides {
4949
formatterOptions.insert(.parseAsides)
5050
}
5151
if parseInlineAttributeClass {
5252
formatterOptions.insert(.parseInlineAttributeClass)
5353
}
5454

55-
print(HtmlFormatter.format(document, options: formatterOptions))
55+
print(HTMLFormatter.format(document, options: formatterOptions))
5656
}
5757
}
5858
}

Sources/markdown-tool/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct MarkdownCommand: ParsableCommand {
2727
static let configuration = CommandConfiguration(commandName: "markdown", shouldDisplay: false, subcommands: [
2828
DumpTree.self,
2929
Format.self,
30-
PrintHtml.self,
30+
PrintHTML.self,
3131
])
3232

3333
static func parseFile(at path: String, options: ParseOptions) throws -> (source: String, parsed: Document) {

Tests/MarkdownTests/Visitors/HtmlFormatterTests.swift renamed to Tests/MarkdownTests/Visitors/HTMLFormatterTests.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import XCTest
1212
@testable import Markdown
1313

14-
final class HtmlFormatterTests: XCTestCase {
14+
final class HTMLFormatterTests: XCTestCase {
1515
func testFormatEverything() {
1616
let expectedDump = """
1717
<h1>Header</h1>
@@ -67,7 +67,7 @@ final class HtmlFormatterTests: XCTestCase {
6767
6868
""" // The rendered output contains a trailing newline
6969

70-
XCTAssertEqual(HtmlFormatter.format(everythingDocument), expectedDump)
70+
XCTAssertEqual(HTMLFormatter.format(everythingDocument), expectedDump)
7171
}
7272

7373
func testFormatAsides() {
@@ -87,7 +87,7 @@ final class HtmlFormatterTests: XCTestCase {
8787
8888
"""
8989

90-
XCTAssertEqual(HtmlFormatter.format(inputText, options: [.parseAsides]), expectedOutput)
90+
XCTAssertEqual(HTMLFormatter.format(inputText, options: [.parseAsides]), expectedOutput)
9191
}
9292

9393
// JSON5 parsing (which allows property names without quotes) is only available in Apple Foundation
@@ -107,10 +107,10 @@ final class HtmlFormatterTests: XCTestCase {
107107
108108
"""
109109

110-
var visitor = HtmlFormatter()
110+
var visitor = HTMLFormatter()
111111
visitor.visit(document)
112112

113-
XCTAssertEqual(HtmlFormatter.format(inputText), expectedOutput)
113+
XCTAssertEqual(HTMLFormatter.format(inputText), expectedOutput)
114114
}
115115

116116
do {
@@ -120,7 +120,7 @@ final class HtmlFormatterTests: XCTestCase {
120120
"""
121121

122122
XCTAssertEqual(
123-
HtmlFormatter.format(inputText, options: [.parseInlineAttributeClass]),
123+
HTMLFormatter.format(inputText, options: [.parseInlineAttributeClass]),
124124
expectedOutput
125125
)
126126
}
@@ -139,10 +139,10 @@ final class HtmlFormatterTests: XCTestCase {
139139
140140
"""
141141

142-
var visitor = HtmlFormatter()
142+
var visitor = HTMLFormatter()
143143
visitor.visit(document)
144144

145-
XCTAssertEqual(HtmlFormatter.format(inputText), expectedOutput)
145+
XCTAssertEqual(HTMLFormatter.format(inputText), expectedOutput)
146146
}
147147

148148
do {
@@ -152,7 +152,7 @@ final class HtmlFormatterTests: XCTestCase {
152152
"""
153153

154154
XCTAssertEqual(
155-
HtmlFormatter.format(inputText, options: [.parseInlineAttributeClass]),
155+
HTMLFormatter.format(inputText, options: [.parseInlineAttributeClass]),
156156
expectedOutput
157157
)
158158
}
@@ -184,7 +184,7 @@ final class HtmlFormatterTests: XCTestCase {
184184
185185
"""
186186

187-
XCTAssertEqual(HtmlFormatter.format(inputText), expectedOutput)
187+
XCTAssertEqual(HTMLFormatter.format(inputText), expectedOutput)
188188
}
189189

190190
do {
@@ -212,7 +212,7 @@ final class HtmlFormatterTests: XCTestCase {
212212
213213
"""
214214

215-
XCTAssertEqual(HtmlFormatter.format(inputText), expectedOutput)
215+
XCTAssertEqual(HTMLFormatter.format(inputText), expectedOutput)
216216
}
217217

218218
do {
@@ -239,7 +239,7 @@ final class HtmlFormatterTests: XCTestCase {
239239
240240
"""
241241

242-
XCTAssertEqual(HtmlFormatter.format(inputText), expectedOutput)
242+
XCTAssertEqual(HTMLFormatter.format(inputText), expectedOutput)
243243
}
244244

245245
do {
@@ -271,7 +271,7 @@ final class HtmlFormatterTests: XCTestCase {
271271
272272
"""
273273

274-
XCTAssertEqual(HtmlFormatter.format(inputText), expectedOutput)
274+
XCTAssertEqual(HTMLFormatter.format(inputText), expectedOutput)
275275
}
276276

277277
do {
@@ -304,7 +304,7 @@ final class HtmlFormatterTests: XCTestCase {
304304
305305
"""
306306

307-
XCTAssertEqual(HtmlFormatter.format(inputText), expectedOutput)
307+
XCTAssertEqual(HTMLFormatter.format(inputText), expectedOutput)
308308
}
309309
}
310310
}

0 commit comments

Comments
 (0)