mirror of
https://github.com/balkian/balkian.github.com.git
synced 2024-12-26 02:08:13 +00:00
New post/page in makefile
This commit is contained in:
parent
c7a1caecec
commit
0a90da2eb5
49
Makefile
49
Makefile
@ -8,6 +8,12 @@ OUTPUTDIR=$(BASEDIR)/output
|
|||||||
CONFFILE=$(BASEDIR)/pelicanconf.py
|
CONFFILE=$(BASEDIR)/pelicanconf.py
|
||||||
PUBLISHCONF=$(BASEDIR)/publishconf.py
|
PUBLISHCONF=$(BASEDIR)/publishconf.py
|
||||||
|
|
||||||
|
PAGESDIR=$(INPUTDIR)/pages
|
||||||
|
DATE := $(shell date +'%Y-%m-%d %H:%M:%S')
|
||||||
|
SLUG := $(shell echo '${NAME}' | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z)
|
||||||
|
EXT ?= md
|
||||||
|
|
||||||
|
|
||||||
FTP_HOST=localhost
|
FTP_HOST=localhost
|
||||||
FTP_USER=anonymous
|
FTP_USER=anonymous
|
||||||
FTP_TARGET_DIR=/
|
FTP_TARGET_DIR=/
|
||||||
@ -50,6 +56,8 @@ help:
|
|||||||
@echo ' make s3_upload upload the web site via S3 '
|
@echo ' make s3_upload upload the web site via S3 '
|
||||||
@echo ' make cf_upload upload the web site via Cloud Files'
|
@echo ' make cf_upload upload the web site via Cloud Files'
|
||||||
@echo ' make github upload the web site via gh-pages '
|
@echo ' make github upload the web site via gh-pages '
|
||||||
|
@echo ' make newpost Add a new post '
|
||||||
|
@echo ' make newpage Add a new page '
|
||||||
@echo ' '
|
@echo ' '
|
||||||
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
|
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
@ -107,4 +115,45 @@ github: publish
|
|||||||
ghp-import -m "Generate Pelican site" -b $(GITHUB_PAGES_BRANCH) $(OUTPUTDIR)
|
ghp-import -m "Generate Pelican site" -b $(GITHUB_PAGES_BRANCH) $(OUTPUTDIR)
|
||||||
git push origin $(GITHUB_PAGES_BRANCH)
|
git push origin $(GITHUB_PAGES_BRANCH)
|
||||||
|
|
||||||
|
newpost:
|
||||||
|
ifdef NAME
|
||||||
|
echo "Title: $(NAME)" > $(INPUTDIR)/$(SLUG).$(EXT)
|
||||||
|
echo "Slug: $(SLUG)" >> $(INPUTDIR)/$(SLUG).$(EXT)
|
||||||
|
echo "Date: $(DATE)" >> $(INPUTDIR)/$(SLUG).$(EXT)
|
||||||
|
echo "" >> $(INPUTDIR)/$(SLUG).$(EXT)
|
||||||
|
echo "" >> $(INPUTDIR)/$(SLUG).$(EXT)
|
||||||
|
${EDITOR} ${INPUTDIR}/${SLUG}.${EXT} &
|
||||||
|
else
|
||||||
|
@echo 'Variable NAME is not defined.'
|
||||||
|
@echo 'Do make newpost NAME='"'"'Post Name'"'"
|
||||||
|
endif
|
||||||
|
|
||||||
|
editpost:
|
||||||
|
ifdef NAME
|
||||||
|
${EDITOR} ${INPUTDIR}/${SLUG}.${EXT} &
|
||||||
|
else
|
||||||
|
@echo 'Variable NAME is not defined.'
|
||||||
|
@echo 'Do make editpost NAME='"'"'Post Name'"'"
|
||||||
|
endif
|
||||||
|
|
||||||
|
newpage:
|
||||||
|
ifdef NAME
|
||||||
|
echo "Title: $(NAME)" > $(PAGESDIR)/$(SLUG).$(EXT)
|
||||||
|
echo "Slug: $(SLUG)" >> $(PAGESDIR)/$(SLUG).$(EXT)
|
||||||
|
echo "" >> $(PAGESDIR)/$(SLUG).$(EXT)
|
||||||
|
echo "" >> $(PAGESDIR)/$(SLUG).$(EXT)
|
||||||
|
${EDITOR} ${PAGESDIR}/${SLUG}.$(EXT)
|
||||||
|
else
|
||||||
|
@echo 'Variable NAME is not defined.'
|
||||||
|
@echo 'Do make newpage NAME='"'"'Page Name'"'"
|
||||||
|
endif
|
||||||
|
|
||||||
|
editpage:
|
||||||
|
ifdef NAME
|
||||||
|
${EDITOR} ${PAGESDIR}/${SLUG}.$(EXT)
|
||||||
|
else
|
||||||
|
@echo 'Variable NAME is not defined.'
|
||||||
|
@echo 'Do make editpage NAME='"'"'Page Name'"'"
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github
|
.PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github
|
||||||
|
Loading…
Reference in New Issue
Block a user