mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-18 17:57:11 +03:00
site: drop references to the github wiki
[ci skip]
This commit is contained in:
parent
c47a98e55d
commit
ece3d67ebf
12
Makefile
12
Makefile
@ -179,7 +179,6 @@ DOCSOURCEFILES:= \
|
|||||||
$(MANUALSOURCEFILES) \
|
$(MANUALSOURCEFILES) \
|
||||||
$(COMMANDHELPFILES) \
|
$(COMMANDHELPFILES) \
|
||||||
site/*.md \
|
site/*.md \
|
||||||
wiki/*.md \
|
|
||||||
|
|
||||||
# # file(s) which require recompilation for a build to have an up-to-date version string
|
# # file(s) which require recompilation for a build to have an up-to-date version string
|
||||||
# VERSIONSOURCEFILE=hledger/Hledger/Cli/Version.hs
|
# VERSIONSOURCEFILE=hledger/Hledger/Cli/Version.hs
|
||||||
@ -748,21 +747,16 @@ haddock: \
|
|||||||
# # cd site/api && \
|
# # cd site/api && \
|
||||||
# # hoogle --convert=main.txt --output=default.hoo
|
# # hoogle --convert=main.txt --output=default.hoo
|
||||||
|
|
||||||
site-liverender: Shake \
|
site-live: Shake \
|
||||||
$(call def-help,site-liverender, update the local website html when source files are saved )
|
$(call def-help,site-live, update the local website html when source files are saved )
|
||||||
ls $(DOCSOURCEFILES) | entr ./Shake website
|
ls $(DOCSOURCEFILES) | entr ./Shake website
|
||||||
|
|
||||||
LIVERELOAD=livereloadx -p $(LIVERELOADPORT)
|
LIVERELOAD=livereloadx -p $(LIVERELOADPORT)
|
||||||
LIVERELOADPORT=8001
|
LIVERELOADPORT=8001
|
||||||
|
|
||||||
site-livereload: \
|
|
||||||
$(call def-help,site-livereload, open a browser on the local website html and reload the page when it updates )
|
|
||||||
(sleep 1; open http://localhost:$(LIVERELOADPORT)) &
|
|
||||||
$(LIVERELOAD) -s site/_site
|
|
||||||
|
|
||||||
site-watch:
|
site-watch:
|
||||||
$(call def-help,site-livereload, open a browser on the local website html and rerender & reload the page on file change )
|
$(call def-help,site-livereload, open a browser on the local website html and rerender & reload the page on file change )
|
||||||
make site-liverender &
|
make site-live &
|
||||||
(sleep 1; $(BROWSE) http://localhost:$(LIVERELOADPORT)/) &
|
(sleep 1; $(BROWSE) http://localhost:$(LIVERELOADPORT)/) &
|
||||||
$(LIVERELOAD) -s site/_site/
|
$(LIVERELOAD) -s site/_site/
|
||||||
|
|
||||||
|
47
Shake.hs
47
Shake.hs
@ -82,7 +82,6 @@ usage = unlines
|
|||||||
,"./Shake hledgerorg update the hledger.org website (when run on prod)"
|
,"./Shake hledgerorg update the hledger.org website (when run on prod)"
|
||||||
,""
|
,""
|
||||||
,"./Shake mainpages build the web pages from the main repo"
|
,"./Shake mainpages build the web pages from the main repo"
|
||||||
,"./Shake wikipages build the web pages from the wiki repo"
|
|
||||||
-- ,"./Shake site/index.md update wiki links on the website home page"
|
-- ,"./Shake site/index.md update wiki links on the website home page"
|
||||||
,"./Shake FILE build any individual file"
|
,"./Shake FILE build any individual file"
|
||||||
,"./Shake setversion update all packages from PKG/.version"
|
,"./Shake setversion update all packages from PKG/.version"
|
||||||
@ -125,8 +124,6 @@ main = do
|
|||||||
filter (not . ("README." `isPrefixOf`) . takeFileName) . filter (".md" `isSuffixOf`) . map (commandsdir </>)
|
filter (not . ("README." `isPrefixOf`) . takeFileName) . filter (".md" `isSuffixOf`) . map (commandsdir </>)
|
||||||
<$> S.getDirectoryContents commandsdir
|
<$> S.getDirectoryContents commandsdir
|
||||||
let commandtxts = map (-<.> "txt") commandmds
|
let commandtxts = map (-<.> "txt") commandmds
|
||||||
let wikidir = "wiki"
|
|
||||||
wikipagefilenames <- map dropExtension . filter (".md" `isSuffixOf`) <$> S.getDirectoryContents wikidir
|
|
||||||
|
|
||||||
shakeArgs
|
shakeArgs
|
||||||
shakeOptions
|
shakeOptions
|
||||||
@ -228,9 +225,6 @@ main = do
|
|||||||
,"CONTRIBUTING"
|
,"CONTRIBUTING"
|
||||||
]
|
]
|
||||||
|
|
||||||
-- the html for website pages kept in the wiki repo (cookbook content)
|
|
||||||
wikipageshtml = map (normalise . ("site/_site" </>) . (<.> ".html")) wikipagefilenames
|
|
||||||
|
|
||||||
-- TODO: make website URIs lower-case ?
|
-- TODO: make website URIs lower-case ?
|
||||||
|
|
||||||
-- manuals rendered to markdown and combined, ready for web rendering
|
-- manuals rendered to markdown and combined, ready for web rendering
|
||||||
@ -373,7 +367,6 @@ main = do
|
|||||||
phony "website" $ need [
|
phony "website" $ need [
|
||||||
"webassets"
|
"webassets"
|
||||||
,"mainpages"
|
,"mainpages"
|
||||||
,"wikipages"
|
|
||||||
,"htmlmanuals"
|
,"htmlmanuals"
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -397,45 +390,27 @@ main = do
|
|||||||
"site/_site/files/README" : [ "site/_site//*" <.> ext | ext <- webassetexts ] |%> \out -> do
|
"site/_site/files/README" : [ "site/_site//*" <.> ext | ext <- webassetexts ] |%> \out -> do
|
||||||
copyFile' ("site" </> dropDirectory2 out) out
|
copyFile' ("site" </> dropDirectory2 out) out
|
||||||
|
|
||||||
-- embed the wiki's latest table of contents into the main site's home page
|
|
||||||
"site/index.md" %> \out -> do
|
|
||||||
wikicontent <- dropWhile (not . ("#" `isPrefixOf`)) . lines <$> readFile' "wiki/Home.md"
|
|
||||||
old <- liftIO $ readFileStrictly "site/index.md"
|
|
||||||
let (startmarker, endmarker) = ("<!-- WIKICONTENT -->", "<!-- ENDWIKICONTENT -->")
|
|
||||||
(before, after') = break (startmarker `isPrefixOf`) $ lines old
|
|
||||||
(_, after) = break (endmarker `isPrefixOf`) $ after'
|
|
||||||
new = unlines $ concat [before, [startmarker], wikicontent, after]
|
|
||||||
liftIO $ writeFile out new
|
|
||||||
|
|
||||||
-- render all web pages from the main repo (manuals, home, download, relnotes etc) as html, saved in site/_site/
|
-- render all web pages from the main repo (manuals, home, download, relnotes etc) as html, saved in site/_site/
|
||||||
phony "mainpages" $ need mainpageshtml
|
phony "mainpages" $ need mainpageshtml
|
||||||
|
|
||||||
-- render all pages from the wiki as html, saved in site/_site/.
|
|
||||||
-- We assume there are no filename collisions with mainpages.
|
|
||||||
phony "wikipages" $ need wikipageshtml
|
|
||||||
|
|
||||||
phony "htmlmanuals" $ need htmlmanuals
|
phony "htmlmanuals" $ need htmlmanuals
|
||||||
|
|
||||||
phony "oldmanuals" $ need oldhtmlmanuals
|
phony "oldmanuals" $ need oldhtmlmanuals
|
||||||
|
|
||||||
-- Render one website page (main or wiki) as html, saved in sites/_site/.
|
-- Render one website page as html, saved in sites/_site/.
|
||||||
-- Wiki pages will have a heading and TOC placeholder prepended.
|
-- Github-style wiki links will be hyperlinked.
|
||||||
-- The download page will have a TOC placeholder prepended.
|
-- The download page will have a TOC placeholder prepended.
|
||||||
-- All pages will have github-style wiki links hyperlinked.
|
|
||||||
"site/_site//*.html" %> \out -> do
|
"site/_site//*.html" %> \out -> do
|
||||||
let filename = takeBaseName out
|
let filename = takeBaseName out
|
||||||
pagename = fileNameToPageName filename
|
pagename = fileNameToPageName filename
|
||||||
iswikipage = filename `elem` wikipagefilenames
|
|
||||||
isdownloadpage = filename == "download"
|
isdownloadpage = filename == "download"
|
||||||
isoldmanual = "site/_site/doc/" `isPrefixOf` out
|
isoldmanual = "site/_site/doc/" `isPrefixOf` out
|
||||||
source
|
source
|
||||||
| iswikipage = "wiki" </> filename <.> "md"
|
|
||||||
| isoldmanual = "site" </> (drop 11 $ dropExtension out) <.> "md"
|
| isoldmanual = "site" </> (drop 11 $ dropExtension out) <.> "md"
|
||||||
| otherwise = "site" </> filename <.> "md"
|
| otherwise = "site" </> filename <.> "md"
|
||||||
template = "site/site.tmpl"
|
template = "site/site.tmpl"
|
||||||
siteRoot = if "site/_site/doc//*" ?== out then "../.." else "."
|
siteRoot = if "site/_site/doc//*" ?== out then "../.." else "."
|
||||||
maybeAddToc | iswikipage = addHeading pagename . addToc
|
maybeAddToc | isdownloadpage = addToc
|
||||||
| isdownloadpage = addToc
|
|
||||||
| otherwise = id
|
| otherwise = id
|
||||||
need [source, template]
|
need [source, template]
|
||||||
-- read markdown source, link any wikilinks, maybe add a heading and TOC, pipe it to pandoc, write html out
|
-- read markdown source, link any wikilinks, maybe add a heading and TOC, pipe it to pandoc, write html out
|
||||||
@ -449,7 +424,7 @@ main = do
|
|||||||
|
|
||||||
-- This rule, for updating the live hledger.org site, gets called by:
|
-- This rule, for updating the live hledger.org site, gets called by:
|
||||||
-- 1. github-post-receive (github webhook handler), when something is pushed
|
-- 1. github-post-receive (github webhook handler), when something is pushed
|
||||||
-- to the main or wiki repos on Github. Config:
|
-- to the main repo on Github. Config:
|
||||||
-- /etc/supervisord.conf -> [program:github-post-receive]
|
-- /etc/supervisord.conf -> [program:github-post-receive]
|
||||||
-- /etc/github-post-receive.conf
|
-- /etc/github-post-receive.conf
|
||||||
-- 2. cron, nightly. Config: /etc/crontab
|
-- 2. cron, nightly. Config: /etc/crontab
|
||||||
@ -462,26 +437,12 @@ main = do
|
|||||||
|
|
||||||
-- print timestamp. On mac, use brew-installed GNU date.
|
-- print timestamp. On mac, use brew-installed GNU date.
|
||||||
"PATH=\"/usr/local/opt/coreutils/libexec/gnubin:$PATH\" date --rfc-3339=seconds"
|
"PATH=\"/usr/local/opt/coreutils/libexec/gnubin:$PATH\" date --rfc-3339=seconds"
|
||||||
-- pull latest wiki repo
|
|
||||||
"&& printf 'wiki repo: ' && git -C wiki pull"
|
|
||||||
-- pull latest main repo - sometimes already done by webhook, not always
|
-- pull latest main repo - sometimes already done by webhook, not always
|
||||||
"&& printf 'main repo: ' && git pull"
|
"&& printf 'main repo: ' && git pull"
|
||||||
|
|
||||||
-- Shake.hs might have been updated, but we won't execute the
|
-- Shake.hs might have been updated, but we won't execute the
|
||||||
-- new one, too insecure. Continue with this one.
|
-- new one, too insecure. Continue with this one.
|
||||||
|
|
||||||
-- update wiki links on website front page
|
|
||||||
need [ "site/index.md" ]
|
|
||||||
|
|
||||||
-- if it changed, commit (and push) it.
|
|
||||||
-- XXX the push will cause another webhook invocation of this script, try to avoid
|
|
||||||
cmd_ Shell
|
|
||||||
"git diff --quiet -- site/index.md"
|
|
||||||
"|| ("
|
|
||||||
"git commit -m ';site: update cookbook links' -m '[ci skip]' site/index.md"
|
|
||||||
"&& git push"
|
|
||||||
")"
|
|
||||||
|
|
||||||
-- update the live site based on all latest content
|
-- update the live site based on all latest content
|
||||||
need [ "website-all" ]
|
need [ "website-all" ]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user