-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rewrite to export into universal folder + support linking
This commit rewrites logseq-export to be more opinionated with the idea that you'll dedicate a whole folder to all your interlinked notes instead of trying to transform logseq notes into customised blog articles. New features - supports interlinking - If you link between pages with [[title]], this will be transformed into [title](/logseq-pages/slug) in your pages - more opinionated about where the files will go - the idea is that each CMS system will require a small bash script that will move the files in the right place. I tried to decouple this tool from Hugo, but I haven't tried any other static site generators - better Windows support BREAKING CHANGE: complete rewrite, use version `0.0.3` for the old functionality.
- Loading branch information
Showing
29 changed files
with
835 additions
and
538 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
logseq-export | ||
export-* | ||
export-* | ||
test/test-output |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
APP=logseq-export | ||
|
||
.PHONY: build | ||
build: | ||
go build ./... | ||
# go build -o ${APP} main.go | ||
|
||
.PHONY: test | ||
test: | ||
go test ./... | ||
|
||
.PHONY: watch | ||
watch: | ||
fswatch --exclude 'test/test-output' -o ./ | xargs -n1 -I{} go test ./... | ||
|
||
.PHONY: clean | ||
clean: | ||
go clean |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
##!/bin/bash | ||
|
||
set -e | ||
|
||
# Check if the correct number of arguments is provided | ||
if [ "$#" -ne 2 ]; then | ||
echo "Usage: move_logseq_content.sh <export_folder> <blog_folder>" | ||
exit 1 | ||
fi | ||
|
||
# Extract arguments | ||
export_folder="$1" | ||
blog_folder="$2" | ||
|
||
# Check if the export folder exists | ||
if [ ! -d "$export_folder" ]; then | ||
echo "Error: The export folder does not exist." | ||
exit 1 | ||
fi | ||
|
||
# Check if the blog folder exists | ||
if [ ! -d "$blog_folder" ]; then | ||
echo "Error: The blog folder does not exist." | ||
exit 1 | ||
fi | ||
|
||
blog_content_folder="${BLOG_CONTENT_FODLER:-/graph}" | ||
images_folder="${BLOG_IMAGES_FOLDER:-/assets/graph}" | ||
|
||
# by default the files get copied as follows | ||
# - /logseq-pages -> /content/graph | ||
# - /logseq-assets -> /static/assets/graph | ||
pages_destination="$blog_folder/content$blog_content_folder" | ||
assets_destination="$blog_folder/static$images_folder" | ||
|
||
# delete existing pages and assets | ||
rm -rf "$pages_destination" | ||
rm -rf "$assets_destination" | ||
|
||
# prepare the directories | ||
mkdir -p "$pages_destination" | ||
mkdir -p "$assets_destination" | ||
|
||
# Move the content of logseq-pages to the new destination | ||
cp -R "$export_folder/logseq-pages"/* "$pages_destination/" | ||
|
||
# Move the content of logseq-assets to the new destination | ||
cp -R "$export_folder/logseq-assets"/* "$assets_destination/" | ||
|
||
# replace the /logseq-asstes/ paths with the hugo image folder | ||
find "$pages_destination" -type f -exec sed -i '' -e "s@/logseq-assets/@$images_folder/@g" {} \; | ||
find "$pages_destination" -type f -exec sed -i '' -e "s@/logseq-pages/@$blog_content_folder/@g" {} \; | ||
|
||
echo "Content moved successfully." |
Oops, something went wrong.