Skip to content

Commit ec84795

Browse files
committed
Tiny code cleanup.
1 parent 4b37f5b commit ec84795

File tree

4 files changed

+11
-19
lines changed

4 files changed

+11
-19
lines changed

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,10 @@ is derived from `MarkdownParser` simply by overriding
100100
```swift
101101
open class ExtendedMarkdownParser: MarkdownParser {
102102
override open class var defaultBlockParsers: [BlockParser.Type] {
103-
return Self.blockParsers
103+
return self.blockParsers
104104
}
105-
private static let blockParsers: [BlockParser.Type] = {
106-
var parsers = MarkdownParser.defaultBlockParsers
107-
parsers.append(TableParser.self)
108-
return parsers
109-
}()
105+
private static let blockParsers: [BlockParser.Type] =
106+
MarkdownParser.defaultBlockParsers + [TableParser.self]
110107
override open class var standard: ExtendedMarkdownParser {
111108
return self.singleton
112109
}

Sources/MarkdownKit/Parser/ExtendedMarkdownParser.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,11 @@ open class ExtendedMarkdownParser: MarkdownParser {
4545

4646
/// The default list of block parsers. The order of this list matters.
4747
override open class var defaultBlockParsers: [BlockParser.Type] {
48-
return Self.blockParsers
48+
return self.blockParsers
4949
}
5050

51-
private static let blockParsers: [BlockParser.Type] = {
52-
var parsers = MarkdownParser.defaultBlockParsers
53-
parsers.append(TableParser.self)
54-
return parsers
55-
}()
51+
private static let blockParsers: [BlockParser.Type] =
52+
MarkdownParser.defaultBlockParsers + [TableParser.self]
5653

5754
/// Defines a default implementation
5855
override open class var standard: ExtendedMarkdownParser {

Sources/MarkdownKit/Parser/ListItemParser.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,20 +148,18 @@ public final class ListItemParser: BlockParser {
148148
}
149149
indent += self.lineIndent + listMarkerIndent
150150
self.docParser.resetLineStart(i)
151+
let tight = !self.prevLineEmpty
151152
if let number = number {
152153
return .container { encl in
153154
OrderedListItemContainer(number: number,
154155
delimiter: marker,
155-
tight: !self.prevLineEmpty,
156+
tight: tight,
156157
indent: indent,
157158
outer: encl)
158159
}
159160
} else {
160161
return .container { encl in
161-
BulletListItemContainer(bullet: marker,
162-
tight: !self.prevLineEmpty,
163-
indent: indent,
164-
outer: encl)
162+
BulletListItemContainer(bullet: marker, tight: tight, indent: indent, outer: encl)
165163
}
166164
}
167165
}

Sources/MarkdownKit/Parser/MarkdownParser.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ open class MarkdownParser {
4343

4444
/// The default list of block parsers. The order of this list matters.
4545
open class var defaultBlockParsers: [BlockParser.Type] {
46-
return Self.blockParsers
46+
return self.blockParsers
4747
}
4848

4949
private static let blockParsers: [BlockParser.Type] = [
@@ -60,7 +60,7 @@ open class MarkdownParser {
6060

6161
/// The default list of inline transformers. The order of this list matters.
6262
open class var defaultInlineTransformers: [InlineTransformer.Type] {
63-
return Self.inlineTransformers
63+
return self.inlineTransformers
6464
}
6565

6666
private static let inlineTransformers: [InlineTransformer.Type] = [

0 commit comments

Comments
 (0)