diff --git a/docs/index.html b/docs/index.html index d96cf70..f34f75a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -33,90 +33,90 @@

Welcome to my digital library!

Theology and non-resistance -

The Everlasting Man by G. K. Chesterton in 1927 (100k words)

+

1927: The Everlasting Man by G. K. Chesterton (100k words)

-

William Lloyd Garrison on Non-Resistance by Fanny Garrison Villard in 1924 (16k words)

+

1924: William Lloyd Garrison on Non-Resistance by Fanny Garrison Villard (16k words)

-

Atonement and Non-Resistance by William Wilson in 1923 (13k words)

+

1923: Atonement and Non-Resistance by William Wilson (13k words)

-

Orthodoxy by G. K. Chesterton in 1908 (60k words)

+

1908: Orthodoxy by G. K. Chesterton (63k words)

-

Patriotism or Peace: Letter to Manson by Leo Tolstoy in 1896 (3200 words)

+

1896: Patriotism or Peace: Letter to Manson by Leo Tolstoy (3.2k words)

-

On Non-Resistance: Letter to Ernest Howard Crosby by Leo Tolstoy in 1896 (4k words)

+

1896: On Non-Resistance: Letter to Ernest Howard Crosby by Leo Tolstoy (4.1k words)

-

The Kingdom of God is Within You by Leo Tolstoy in 1894 (120k words)

+

1894: The Kingdom of God is Within You by Leo Tolstoy (120k words)

-

Christianity and Patriotism by Leo Tolstoy in 1894 (21k words)

+

1894: Christianity and Patriotism by Leo Tolstoy (21k words)

-

Civil Disobedience by Henry David Thoreau in 1888 (9k words)

+

1888: Civil Disobedience by Henry David Thoreau (9.4k words)

-

What a Christian May Do, and What Not by Leo Tolstoy in 1887 (1000 words)

+

1887: What a Christian May Do, and What Not by Leo Tolstoy (1.0k words)

-

Non-Resistance in relation to Human Governments by Adin Ballou in 1839 (6k words)

+

1839: Non-Resistance in relation to Human Governments by Adin Ballou (6.8k words)

Political economy and political science -

Flight from the City by Ralph Borsodi in 1933 (40k words)

+

1933: Flight from the City by Ralph Borsodi (42k words)

-

Outline of Sanity by G. K. Chesterton in 1926 (60k words)

+

1926: Outline of Sanity by G. K. Chesterton (62k words)

-

Economics for Helen by Hilaire Belloc in 1924 (50k words)

+

1924: Economics for Helen by Hilaire Belloc (54k words)

-

Towards a Christian Sociology by Arthur J. Penty in 1923 (50k words)

+

1923: Towards a Christian Sociology by Arthur J. Penty (59k words)

-

The Control and Distribution of Production by C. H. Douglas in 1922 (30k words)

+

1922: The Control and Distribution of Production by C. H. Douglas (30k words)

-

Eugenics and Other Evils by G. K. Chesterton in 1922 (40k words)

+

1922: Eugenics and Other Evils by G. K. Chesterton (47k words)

-

What I Saw in America by G. K. Chesterton in 1922 (90k words)

+

1922: What I Saw in America by G. K. Chesterton (90k words)

-

The Acquisitive Society by R. H. Tawney in 1921 (60k words)

+

1921: The Acquisitive Society by R. H. Tawney (63k words)

-

Guilds, Trade, and Agriculture by Arthur Penty in 1921 (30k words)

+

1921: Guilds, Trade, and Agriculture by Arthur Penty (30k words)

-

Economic Democracy by C. H. Douglas in 1920 (23k words)

+

1920: Economic Democracy by C. H. Douglas (23k words)

-

The Superstition of Divorce by G. K. Chesterton in 1920 (24k words)

+

1920: The Superstition of Divorce by G. K. Chesterton (24k words)

-

Mutual Banking by William B. Greene in 1919 (28k words)

+

1919: Mutual Banking by William B. Greene (28k words)

-

Guilds and the Social Crisis by Arthur Penty in 1919 (21k words)

+

1919: Guilds and the Social Crisis by Arthur Penty (21k words)

-

The Free Press by Hilaire Belloc in 1918 (18k words)

+

1918: The Free Press by Hilaire Belloc (18k words)

-

Utopia of Usurers by G. K. Chesterton in 1917 (10k words)

+

1917: Utopia of Usurers by G. K. Chesterton (10k words)

-

The Servile State by Hilaire Belloc in 1912 (36k words)

+

1912: The Servile State by Hilaire Belloc (36k words)

-

What's Wrong with the World by G. K. Chesterton in 1910 (50k words)

+

1910: What's Wrong with the World by G. K. Chesterton (59k words)

-

The Restoration of the Guild System by Arthur Penty in 1906 (18k words)

+

1906: The Restoration of the Guild System by Arthur Penty (18k words)

-

The Condition of Labor by Henry George in 1891 (40k words)

+

1891: The Condition of Labor by Henry George (46k words)

-

Social Problems by Henry George in 1883 (70k words)

+

1883: Social Problems by Henry George (75k words)

-

Agrarian Justice by Thomas Paine in 1797 (6k words)

+

1797: Agrarian Justice by Thomas Paine (6.1k words)

History and biography -

St. Francis of Assisi by G. K. Chesterton in 1923 (40k words)

+

1923: St. Francis of Assisi by G. K. Chesterton (43k words)

-

A Guildsman's Interpretation of History by Arthur Penty in 1920 (100k words)

+

1920: A Guildsman's Interpretation of History by Arthur Penty (100k words)

-

Count Tolstoy and His Philosophy of Life by Ernest Howard Crosby in 1900 (12k words)

+

1900: Count Tolstoy and His Philosophy of Life by Ernest Howard Crosby (12k words)

Fiction and parable -

The Man who was Thursday by G. K. Chesterton in 1908 (50k words)

+

1908: The Man who was Thursday by G. K. Chesterton (57k words)

-

The Napoleon of Notting Hill by G. K. Chesterton in 1904 (50k words)

+

1904: The Napoleon of Notting Hill by G. K. Chesterton (54k words)

-

Where love is there God is also by Leo Tolstoy in 1887 (5k words)

+

1887: Where love is there God is also by Leo Tolstoy (5.1k words)

diff --git a/site.hs b/site.hs index ffbd2d0..39d88c2 100644 --- a/site.hs +++ b/site.hs @@ -15,6 +15,7 @@ import System.FilePath (takeBaseName, takeDirectory, ()) import Text.HTML.TagSoup (Tag (..)) import Prelude hiding (words) import Control.Arrow (second) +import GHC.Float -------------------------------------------------------------------------------- main :: IO () @@ -144,22 +145,18 @@ instance FromJSON Book prettyWords :: Book -> String prettyWords book = - let ws = words book in - if ws > 400000 - then show (ws `div` 100000) <> "00k" - else - if ws > 40000 - then show (ws `div` 10000) <> "0k" - else - if ws > 4000 - then show (ws `div` 1000) <> "k" - else - if ws > 400 - then show (ws `div` 100) <> "00" - else - if ws > 40 - then show (ws `div` 10) <> "0" - else show ws + let wds = fromIntegral $ words book in + let order = double2Int (logBase 10 wds) - 1 in + let [c1, c2] = show $ double2Int $ wds / (10 ** (fromIntegral order)) in + case order of + 1 -> c1:c2:"0" + 2 -> c1:'.':c2:"k" + 3 -> c1:c2:"k" + 4 -> c1:c2:"0k" + 5 -> c1:'.':c2:"m" + 6 -> c1:c2:"m" + 7 -> c1:c2:"0m" + _ -> error $ show order compareBooks :: Book -> Book -> Ordering compareBooks a b = compare (year b) (year a) diff --git a/templates/hakyll.html b/templates/hakyll.html index 693eb24..cfc3fab 100644 --- a/templates/hakyll.html +++ b/templates/hakyll.html @@ -31,7 +31,7 @@

$title$

$for(categories)$ $category$ $for(books)$ -

$title$ by $author$ in $year$ ($words$ words)

+

$year$: $title$ by $author$ ($words$ words)

$endfor$ $endfor$ $endif$