forked from logseq/logseq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish migration of publishing to deps
* Frontend and cmdline version use the same fns! * Add docstrings and db tests * Fix bug with intermittently failing asset copies * Move publish cli to scripts since publish-spa shouldn't have graph-parser dependency * Fix parse-graph bug noticed while testing publishing
- Loading branch information
1 parent
9ac17d4
commit 5186070
Showing
24 changed files
with
731 additions
and
709 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
{:paths ["src"] | ||
:deps | ||
{logseq/graph-parser | ||
;; Nbb bug. Should just be "../graph-parser" | ||
{:local/root "../../../../graph-parser"} | ||
;; Nbb bug. Should just be "../db" | ||
{:local/root "../../../../db"} | ||
io.github.nextjournal/nbb-test-runner | ||
{:git/sha "60ed57aa04bca8d604f5ba6b28848bd887109347" | ||
#_#_:local/root "../../../../../../nbb-test-runner"}}} | ||
{:git/sha "60ed57aa04bca8d604f5ba6b28848bd887109347"}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,18 @@ | ||
(ns logseq.publish-spa | ||
(:require [datascript.transit :as dt] | ||
[logseq.publish-spa.html :as html] | ||
[logseq.publish-spa.export :as export] | ||
[logseq.publish-spa.db :as db])) | ||
"This node only ns provides api fns for exporting a publishing app" | ||
(:require [logseq.publish-spa.html :as publish-html] | ||
[logseq.publish-spa.export :as publish-export])) | ||
|
||
(defn prep-for-export [db {:keys [app-state repo-config html-options]}] | ||
(let [[db asset-filenames'] | ||
(if (:publishing/all-pages-public? repo-config) | ||
(db/clean-export! db) | ||
(db/filter-only-public-pages-and-blocks db)) | ||
asset-filenames (remove nil? asset-filenames') | ||
db-str (dt/write-transit-str db) | ||
state (assoc (select-keys app-state | ||
[:ui/theme | ||
:ui/sidebar-collapsed-blocks]) | ||
:config {"local" repo-config}) | ||
raw-html-str (html/publishing-html db-str state html-options)] | ||
{:html raw-html-str | ||
:asset-filenames asset-filenames})) | ||
|
||
(defn publish [db static-dir graph-dir output-path options] | ||
(let [{:keys [html asset-filenames]} (prep-for-export db options)] | ||
(export/export html static-dir graph-dir output-path {:asset-filenames asset-filenames}))) | ||
(defn export | ||
"Exports the given graph-dir and db to the specific output-dir. Most of the graph | ||
configuration is done through logseq/config.edn. There are a few explicit options that | ||
can be passed: | ||
* :ui/theme - Theme mode that can either be 'light' or 'dark'. | ||
* :html-options - A map of values that are inserted into index.html. Map keys | ||
can be icon, name, alias, title, description and url" | ||
[db static-dir graph-dir output-dir options] | ||
(let [options' (cond-> options | ||
(:ui/theme options) | ||
(assoc :app-state {:ui/theme (:ui/theme options)})) | ||
{:keys [html asset-filenames]} (publish-html/build-html db options')] | ||
(publish-export/create-export html static-dir graph-dir output-dir {:asset-filenames asset-filenames}))) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.