diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/clarktown/correctors.clj | 6 | ||||
| -rw-r--r-- | src/clarktown/engine.clj | 20 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/clarktown/correctors.clj b/src/clarktown/correctors.clj index 14d82ca..e251595 100644 --- a/src/clarktown/correctors.clj +++ b/src/clarktown/correctors.clj @@ -7,10 +7,10 @@ (def ^{:doc "The default block separation correctors."} default-block-separation-correctors - {:empty-line-above? + {:newline-above [code-block/empty-line-above? atx-heading-block/empty-line-above?] - :empty-line-below? + :newline-below [code-block/empty-line-below? atx-heading-block/empty-line-below?]}) @@ -18,4 +18,4 @@ (def ^{:doc "The default correctors."} default-correctors - {:block-separations default-block-separation-correctors})
\ No newline at end of file + {:block-separations default-block-separation-correctors}) diff --git a/src/clarktown/engine.clj b/src/clarktown/engine.clj index 2dc9089..deca176 100644 --- a/src/clarktown/engine.clj +++ b/src/clarktown/engine.clj @@ -39,29 +39,29 @@ "Corrects block separations and adds newlines above or below a block where needed." [correctors lines] - (let [above-correctors (:empty-line-above? correctors) - below-correctors (:empty-line-below? correctors)] + (let [above-correctors (:newline-above correctors) + below-correctors (:newline-below correctors)] (map-indexed (fn [index line] - (let [add-line-above? (some #(true? (% lines line index)) above-correctors) - add-line-below? (some #(true? (% lines line index)) below-correctors)] + (let [add-newline-above? (some #(true? (% lines line index)) above-correctors) + add-newline-below? (some #(true? (% lines line index)) below-correctors)] (cond ; If code block starts but there is no empty newline ; above, let's fix that - (and add-line-above? - (not add-line-below?)) + (and add-newline-above? + (not add-newline-below?)) (str \newline line) ; If the code block ends, but there is no empty newline ; below, let's fix that. - (and add-line-below? - (not add-line-above?)) + (and add-newline-below? + (not add-newline-above?)) (str line \newline) ; If the code block needs a newline both above and below, ; let's fix that. - (and add-line-above? - add-line-below?) + (and add-newline-above? + add-newline-below?) (str \newline line \newline) ; otherwise is what it is |
