From 0c8fd4b0e21b37b110d75d2b1f45e78eb8bdcb5b Mon Sep 17 00:00:00 2001 From: Ilya Puchka Date: Mon, 9 Nov 2020 16:09:20 +0000 Subject: [PATCH] allow mutating line and character rules --- Sources/SwiftyMarkdown/CharacterRule.swift | 2 +- Sources/SwiftyMarkdown/SwiftyLineProcessor.swift | 10 +++++----- Sources/SwiftyMarkdown/SwiftyMarkdown.swift | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Sources/SwiftyMarkdown/CharacterRule.swift b/Sources/SwiftyMarkdown/CharacterRule.swift index ab02fbc..81d2485 100644 --- a/Sources/SwiftyMarkdown/CharacterRule.swift +++ b/Sources/SwiftyMarkdown/CharacterRule.swift @@ -45,7 +45,7 @@ public struct CharacterRule : CustomStringConvertible { public let primaryTag : CharacterRuleTag public let tags : [CharacterRuleTag] public let escapeCharacters : [Character] - public let styles : [Int : CharacterStyling] + public var styles : [Int : CharacterStyling] public let minTags : Int public let maxTags : Int public var metadataLookup : Bool = false diff --git a/Sources/SwiftyMarkdown/SwiftyLineProcessor.swift b/Sources/SwiftyMarkdown/SwiftyLineProcessor.swift index b6acadd..40ef525 100644 --- a/Sources/SwiftyMarkdown/SwiftyLineProcessor.swift +++ b/Sources/SwiftyMarkdown/SwiftyLineProcessor.swift @@ -54,11 +54,11 @@ public struct FrontMatterRule { } public struct LineRule { - let token : String - let removeFrom : Remove - let type : LineStyling - let shouldTrim : Bool - let changeAppliesTo : ChangeApplication + public let token : String + public let removeFrom : Remove + public var type : LineStyling + public let shouldTrim : Bool + public let changeAppliesTo : ChangeApplication public init(token : String, type : LineStyling, removeFrom : Remove = .leading, shouldTrim : Bool = true, changeAppliesTo : ChangeApplication = .current ) { self.token = token diff --git a/Sources/SwiftyMarkdown/SwiftyMarkdown.swift b/Sources/SwiftyMarkdown/SwiftyMarkdown.swift index 1e9ef16..311acc3 100644 --- a/Sources/SwiftyMarkdown/SwiftyMarkdown.swift +++ b/Sources/SwiftyMarkdown/SwiftyMarkdown.swift @@ -36,8 +36,8 @@ public enum CharacterStyle : CharacterStyling { } } -enum MarkdownLineStyle : LineStyling { - var shouldTokeniseLine: Bool { +public enum MarkdownLineStyle : LineStyling { + public var shouldTokeniseLine: Bool { switch self { case .codeblock: return false @@ -66,7 +66,7 @@ enum MarkdownLineStyle : LineStyling { case orderedListIndentSecondOrder case referencedLink - func styleIfFoundStyleAffectsPreviousLine() -> LineStyling? { + public func styleIfFoundStyleAffectsPreviousLine() -> LineStyling? { switch self { case .previousH1: return MarkdownLineStyle.h1