|
|
@@ -390,16 +390,22 @@
|
|
|
;;; export fns
|
|
|
(defn- export-helper
|
|
|
[content format options]
|
|
|
- (let [remove-options (set (:remove-options options))]
|
|
|
+ (let [remove-options (set (:remove-options options))
|
|
|
+ other-options (:other-options options)]
|
|
|
(binding [*state* (merge *state*
|
|
|
{:export-options
|
|
|
{:remove-emphasis? (contains? remove-options :emphasis)
|
|
|
:remove-page-ref-brackets? (contains? remove-options :page-ref)
|
|
|
- :remove-tags? (contains? remove-options :tag)}})
|
|
|
+ :remove-tags? (contains? remove-options :tag)
|
|
|
+ :keep-only-level<=N (:keep-only-level<=N other-options)}})
|
|
|
*opml-state* *opml-state*]
|
|
|
(let [ast (gp-mldoc/->edn content (gp-mldoc/default-config format))
|
|
|
ast (mapv common/remove-block-ast-pos ast)
|
|
|
ast (removev common/Properties-block-ast? ast)
|
|
|
+ keep-level<=n (get-in *state* [:export-options :keep-only-level<=N])
|
|
|
+ ast (if (pos? keep-level<=n)
|
|
|
+ (common/keep-only-level<=n ast keep-level<=n)
|
|
|
+ ast)
|
|
|
ast* (common/replace-block&page-reference&embed ast)
|
|
|
ast** (if (= "no-indent" (get-in *state* [:export-options :indent-style]))
|
|
|
(mapv common/replace-Heading-with-Paragraph ast*)
|