Pagination working but still needs to be cleaned up

- pagination of posts now works (they are output to pages/blog<n>.html
  where <n> is a number from 1 to some natural x)
- pages in pages/* are weighted 1 to some natural y for the purposes of
  generating the menu; but now items that are weighted 0 will not show
  up in the menu and instead will be hidden. This allows for the
  paginated pages to be generated to _site/pages/blog<n>.html as above
  but also avoids showing them in the generated menu.

Now there still is the issue of showing the pages. js/default.js has
been slightly modified to allow the new format of the paginated blog
pages along with the original blog page.

Things yet to complete for pagination:
- the original blog page still needs to be removed as it will be
  replaced by the paginated pages
- need to modify templates/partials/post-teaser-list.haml to show the
  forward/backward buttons from the paginate context.
- paginate tag pages
- find a clean way for the paginated pages (blgo and tags) can be
  viewed/selected

Signed-off-by: Collin J. Doering <rekahsoft@gmail.com>
This commit is contained in:
Collin J. Doering 2014-09-13 02:19:44 -04:00 committed by Collin J. Doering
parent 696fcd2759
commit a0aed31d54
3 changed files with 65 additions and 36 deletions

View File

@ -74,6 +74,7 @@
function loadPageContent(page_href) {
var post_regexp = /posts\/.*/;
var tag_regexp = /tags\/.*/;
var blog_page_regexp = /blog\d*.html/;
// Check whether the requested url is a post
if (post_regexp.test(page_href)) {
@ -88,6 +89,10 @@
// Check if the page_href is empty or / and if so goto home
if (page_href === '/' || page_href === '') {
page_href = '/home.html';
} else if (blog_page_regexp.test(page_href)) {
// If page_href refers to a blog page set the
$('a.menuitem[rel="address:/blog.html"]').closest('ul').find('li.active').removeClass('active');
$('a.menuitem[rel="address:/blog.html"]').closest('li').addClass('active');
}
// Initially set the active menuitem in the nav

View File

@ -7,22 +7,51 @@ updated: 2013-11-26
tags: general
---
[This](/) website is almost done. Well..the content and theming still need to be completed,
but for the most part things are complete.
[This](/) website is almost done. Well..the content and theming still need to be completed, but
for the most part things are complete.
Run a manual sweep of anomalous airborne or electromagnetic readings. Radiation levels in our atmosphere have increased by 3,000 percent. Electromagnetic and subspace wave fronts approaching synchronization. What is the strength of the ship's deflector shields at maximum output? The wormhole's size and short period would make this a local phenomenon. Do you have sufficient data to compile a holographic simulation?
Run a manual sweep of anomalous airborne or electromagnetic readings. Radiation levels in our
atmosphere have increased by 3,000 percent. Electromagnetic and subspace wave fronts
approaching synchronization. What is the strength of the ship's deflector shields at maximum
output? The wormhole's size and short period would make this a local phenomenon. Do you have
sufficient data to compile a holographic simulation?
<!--more-->
These are the voyages of the Starship Enterprise. Its continuing mission, to explore strange new worlds, to seek out new life and new civilizations, to boldly go where no one has gone before. We need to neutralize the homing signal. Each unit has total environmental control, gravity, temperature, atmosphere, light, in a protective field. Sensors show energy readings in your area. We had a forced chamber explosion in the resonator coil. Field strength has increased by 3,000 percent.
These are the voyages of the Starship Enterprise. Its continuing mission, to explore strange
new worlds, to seek out new life and new civilizations, to boldly go where no one has gone
before. We need to neutralize the homing signal. Each unit has total environmental control,
gravity, temperature, atmosphere, light, in a protective field. Sensors show energy readings in
your area. We had a forced chamber explosion in the resonator coil. Field strength has
increased by 3,000 percent.
I have reset the sensors to scan for frequencies outside the usual range. By emitting harmonic vibrations to shatter the lattices. We will monitor and adjust the frequency of the resonators. He has this ability of instantly interpreting and extrapolating any verbal communication he hears. It may be due to the envelope over the structure, causing hydrogen-carbon helix patterns throughout. I'm comparing the molecular integrity of that bubble against our phasers.
I have reset the sensors to scan for frequencies outside the usual range. By emitting harmonic
vibrations to shatter the lattices. We will monitor and adjust the frequency of the resonators.
He has this ability of instantly interpreting and extrapolating any verbal communication he
hears. It may be due to the envelope over the structure, causing hydrogen-carbon helix patterns
throughout. I'm comparing the molecular integrity of that bubble against our phasers.
Sensors indicate no shuttle or other ships in this sector. According to coordinates, we have travelled 7,000 light years and are located near the system J-25. Tractor beam released, sir. Force field maintaining our hull integrity. Damage report? Sections 27, 28 and 29 on decks four, five and six destroyed. Without our shields, at this range it is probable a photon detonation could destroy the Enterprise.
Sensors indicate no shuttle or other ships in this sector. According to coordinates, we have
travelled 7,000 light years and are located near the system J-25. Tractor beam released, sir.
Force field maintaining our hull integrity. Damage report? Sections 27, 28 and 29 on decks
four, five and six destroyed. Without our shields, at this range it is probable a photon
detonation could destroy the Enterprise.
Exceeding reaction chamber thermal limit. We have begun power-supply calibration. Force fields have been established on all turbo lifts and crawlways. Computer, run a level-two diagnostic on warp-drive systems. Antimatter containment positive. Warp drive within normal parameters. I read an ion trail characteristic of a freighter escape pod. The bomb had a molecular-decay detonator. Detecting some unusual fluctuations in subspace frequencies.
Exceeding reaction chamber thermal limit. We have begun power-supply calibration. Force fields
have been established on all turbo lifts and crawlways. Computer, run a level-two diagnostic on
warp-drive systems. Antimatter containment positive. Warp drive within normal parameters. I
read an ion trail characteristic of a freighter escape pod. The bomb had a molecular-decay
detonator. Detecting some unusual fluctuations in subspace frequencies.
Unidentified vessel travelling at sub warp speed, bearing 235.7. Fluctuations in energy readings from it, Captain. All transporters off. A strange set-up, but I'd say the graviton generator is depolarized. The dark colourings of the scrapes are the leavings of natural rubber, a type of non-conductive sole used by researchers experimenting with electricity. The molecules must have been partly de-phased by the anyon beam.
Unidentified vessel travelling at sub warp speed, bearing 235.7. Fluctuations in energy
readings from it, Captain. All transporters off. A strange set-up, but I'd say the graviton
generator is depolarized. The dark colourings of the scrapes are the leavings of natural
rubber, a type of non-conductive sole used by researchers experimenting with electricity. The
molecules must have been partly de-phased by the anyon beam.
Now what are the possibilities of warp drive? Cmdr Riker's nervous system has been invaded by an unknown microorganism. The organisms fuse to the nerve, intertwining at the molecular level. That's why the transporter's biofilters couldn't extract it. The vertex waves show a K-complex corresponding to an REM state. The engineering section's critical. Destruction is imminent. Their robes contain ultritium, highly explosive, virtually undetectable by your transporter.
Now what are the possibilities of warp drive? Cmdr Riker's nervous system has been invaded by
an unknown microorganism. The organisms fuse to the nerve, intertwining at the molecular level.
That's why the transporter's biofilters couldn't extract it. The vertex waves show a K-complex
corresponding to an REM state. The engineering section's critical. Destruction is imminent.
Their robes contain ultritium, highly explosive, virtually undetectable by your transporter.

View File

@ -24,19 +24,15 @@
import Hakyll
import Control.Monad
import Data.Char (chr)
import Data.Monoid (mappend,mconcat,(<>))
import Data.Maybe (maybeToList)
import Data.Monoid (mconcat,(<>))
import Data.List (sortBy,intercalate)
import qualified Data.Set as S
import Data.Ord (comparing)
import Data.Functor ((<$>))
import Data.Time.Format (parseTime)
import System.Locale (defaultTimeLocale)
import Data.Time.Clock (UTCTime)
import System.Random
import System.FilePath (takeBaseName,takeFileName,(</>))
import System.FilePath.Posix (takeBaseName)
import System.FilePath (takeBaseName,takeFileName)
import Text.Parsec
import Text.Pandoc.Options
@ -187,21 +183,21 @@ main = do
-- Generate tag pages
tagsRules tags $ genTagRules tags
-- paginatedPosts <- buildPaginateWith 3 (\n -> fromFilePath $ "blog/page" ++ show n ++ ".html") ("posts/**" .&&. hasNoVersion)
-- paginatedPosts <- buildPaginate ("posts/**" .&&. hasNoVersion)
-- paginateRules paginatedPosts (genPaginateRules tags paginatedPosts)
paginatedPosts <- buildPaginateWith
(fmap (paginateEvery 8) . sortRecentFirst)
("posts/**" .&&. hasNoVersion)
(\n -> fromCapture "pages/blog*.html" (show n))
-- paginate 3 $ \index maxIndex itemsForPage -> do
-- let id = fromFilePath $ "blog/page" ++ show index ++ ".html"
-- create [id] $ do
-- route idRoute
-- compile $ do
-- -- items <- sequence $ map loadTeaser itemsForPage
-- -- let itemBodies = map itemBody items
-- -- postCtx = defaultContext -- TODO
-- makeItem ""
-- >>= saveSnapshot "content"
-- >>= loadAndApplyTemplate "templates/pages/blog.haml" (taggedPostCtx tags)
paginateRules paginatedPosts $ \pageNum pattern -> do
route $ idRoute
compile $ do
posts <- recentFirst =<< loadAllSnapshots pattern "content"
let ctx = taggedPostCtx tags <>
paginateContext paginatedPosts pageNum <>
constField "weight" "0" <>
listField "posts" (taggedPostCtx tags) (return posts)
makeItem ""
>>= loadAndApplyTemplate "templates/pages/blog.haml" ctx
match "pages/*" $ do
route $ setExtension "html"
@ -215,7 +211,6 @@ main = do
pageTemplate = "templates/pages/" ++ pageName ++ ".haml"
masterCtx = listField "recentPosts" (taggedPostCtx tags) (return recentPosts) <>
listField "posts" (taggedPostCtx tags) (return posts) <>
-- paginateContext paginatedPosts <>
tagCloudField "tagCloud" 65 135 tags <>
defaultContext
@ -253,7 +248,7 @@ main = do
route idRoute
compile $ do
-- Generate nav-bar from pages/* ordered by metadata 'weight'
pages <- sortByM pageWeight =<< loadAll ("pages/*" .&&. hasNoVersion)
pages <- sortByM pageWeight =<< filterM (\i -> pageWeight i >>= return . (> 0)) =<< loadAll ("pages/*" .&&. hasNoVersion)
let indexCtx = listField "pages" pagesCtx (return pages) <> defaultContext
@ -390,11 +385,11 @@ genTagRules tags tag pattern = do
>>= fmap (take 10) . recentFirst
>>= renderAtom (feedConfiguration $ Just tag) (bodyField "description" <> defaultContext)
genPaginateRules :: Tags -> Paginate -> PageNumber -> Pattern -> Rules ()
genPaginateRules tags paginate n pattern = do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/partials/post.haml" (taggedPostCtx tags <> paginateContext paginate)
-- genPaginateRules :: Tags -> Paginate -> PageNumber -> Pattern -> Rules ()
-- genPaginateRules tags paginate n pattern = do
-- route idRoute
-- compile $ pandocCompiler
-- >>= loadAndApplyTemplate "templates/partials/post.haml" (taggedPostCtx tags <> paginateContext paginate)
-- >>= loadAndApplyTemplate "templates/page.haml" defaultContext
-- >>= relativizeUrls