Skip to content

Commit ff4aecf

Browse files
Release 0.2.0.0
2 parents b6da05c + 78efa32 commit ff4aecf

11 files changed

+148
-53
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ following conventions:
2424

2525
[KaC]: <https://keepachangelog.com/en/1.0.0/>
2626

27+
## 0.2.0.0 (2020-08-11)
28+
29+
### Breaking
30+
31+
* Add URL support
32+
2733
## 0.1.0.0 (2020-07-25)
2834

2935
### Breaking

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515

1616
## Overview
1717

18-
Queue Sheet is a utility that builds PDFs of lists. The printed PDFs can be
19-
used to track progress through the queues when offline.
18+
Queue Sheet is a utility that builds PDFs of lists. Printed PDFs can be used
19+
to track progress when offline. Optionally include URLs when sharing a PDF
20+
with others so that they can easily access the media.
2021

21-
Use Queue Sheet to track progress through:
22+
Use Queue Sheet to track:
2223

2324
* podcasts
2425
* research papers

doc/queue-sheet.1.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ properties:
5151
*name*
5252
: name of the queue (string, required)
5353

54+
*url*
55+
: queue URL (string, optional)
56+
5457
*section*
5558
: name of the section (string, required)
5659

@@ -64,13 +67,22 @@ properties:
6467
: date of last update (string, optional)
6568

6669
*prev*
67-
: previous (complete) item (string, optional)
70+
: previous (complete) item (item, optional)
6871

6972
*next*
70-
: list of next items (list of string, optional)
73+
: list of next items (list of items, optional)
7174

7275
If both *prev* and *next* are specified, then *prev* is ignored.
7376

77+
An item name may be specified using a string. To associate a URL with an
78+
item, use an object with the following properties:
79+
80+
*name*
81+
: name of the item (string, required)
82+
83+
*url*
84+
: item URL (string, optional)
85+
7486
The following tags are supported:
7587

7688
*complete*
@@ -113,6 +125,9 @@ A queue is an object with the following properties:
113125
*name*
114126
: name of the queue (string)
115127

128+
*url*
129+
: queue URL or empty string if no URL (string)
130+
116131
*isSplit*
117132
: *true* to display items on separate lines (boolean)
118133

@@ -126,10 +141,18 @@ A queue is an object with the following properties:
126141
: date or empty string if no date (string)
127142

128143
*prevItem*
129-
: previous item or empty string if not set (string)
144+
: previous item or empty string if not set (item)
130145

131146
*nextItems*
132-
: list of next items (list of strings)
147+
: list of next items (list of items)
148+
149+
An item is an object with the following properties:
150+
151+
*name*
152+
: name of the item (string)
153+
154+
*url*
155+
: item URL or empty string if no URL (string)
133156

134157
## `QUEUES.pdf`
135158

example/podcasts.pdf

541 Bytes
Binary file not shown.

example/podcasts.yaml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,63 @@ sections:
88
queues:
99

1010
- name: AI Podcast
11+
url: https://lexfridman.com/ai/
1112
section: Other
12-
date: 2020-01-17
13-
prev: 72
13+
date: 2020-08-09
14+
next:
15+
- name: 114
16+
url: https://lexfridman.com/russ-tedrake/
1417

1518
- name: Changelog
19+
url: https://changelog.com/podcast
1620
section: Programming
1721
tags:
1822
- partial
19-
date: 2020-01-20
20-
prev: 377
23+
date: 2020-08-07
24+
next:
25+
- 407
2126

2227
- name: Co-Recursive
28+
url: https://corecursive.com/
2329
section: Functional
24-
date: 2020-01-16
25-
prev: 44
30+
date: 2020-08-03
31+
prev: 55
2632

2733
- name: Functional Geekery
34+
url: https://www.functionalgeekery.com/
2835
section: Functional
29-
date: 2019-12-24
30-
prev: 129
36+
date: 2020-05-19
37+
prev: 131
3138

3239
- name: Haskell Weekly
40+
url: https://haskellweekly.news/podcast.html
3341
section: Functional
3442
date: 2019-11-08
3543
prev: 24
3644

3745
- name: LambdaCast
46+
url: https://soundcloud.com/lambda-cast
3847
section: Functional
3948
date: 2019-06-14
4049
prev: 22
4150

4251
- name: Mindscape
52+
url: https://www.preposterousuniverse.com/podcast/
4353
section: Other
44-
date: 2020-01-20
54+
date: 2020-08-10
4555
next:
46-
- 78
47-
- 79
48-
- 80
56+
- 108
57+
- 109
4958

5059
- name: Quanta
60+
url: https://www.quantamagazine.org/tag/podcast/
5161
section: Other
52-
prev: 128
62+
prev: 142
5363

5464
- name: Software Engineering Radio
65+
url: https://www.se-radio.net/
5566
section: Programming
5667
tags:
5768
- partial
58-
date: 2020-01-10
59-
prev: 395
69+
date: 2020-08-06
70+
prev: 420

example/template.tex

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
% use titlesec package for custom sections
1818
\usepackage{titlesec}
1919

20+
% use hyperref for URLs
21+
\usepackage[hidelinks]{hyperref}
22+
2023
% do not indent paragraphs
2124
\setlength{\parindent}{0pt}
2225

@@ -48,22 +51,6 @@
4851
\fontdimen3\font=\origiwstr
4952
}
5053

51-
% create queue environment
52-
\newenvironment{queue}[2]
53-
{
54-
\begin{minipage}{1.0\textwidth}
55-
\textbf{#1}\hfill #2\\
56-
\vspace{-1em}
57-
\hrule
58-
\vspace{0.2em}
59-
\begin{fontspace}{1.5}{2}
60-
}
61-
{
62-
\end{fontspace}
63-
\end{minipage}
64-
\vspace{2em}
65-
}
66-
6754
% define partial mark
6855
\newcommand*{\partialMark}{☯}
6956

@@ -79,15 +66,36 @@
7966
\section*{<< section.name >>}
8067

8168
<! for queue in section.queues !>
82-
\begin{queue}{<< queue.name >>}{<< queue.date >><! if queue.isPartial !> \partialMark<! endif !><! if queue.isComplete !> \completeMark<! endif !>}
69+
\begin{minipage}{1.0\textwidth}
70+
<! if queue.url !>
71+
\href{<< queue.url >>}{\bfseries <<queue.name>>}\hfill
72+
<! else !>
73+
\textbf{<< queue.name >>}\hfill
74+
<! endif !>
75+
<< queue.date >><! if queue.isPartial !> \partialMark<! endif !><! if queue.isComplete !> \completeMark<! endif !>\\
76+
\vspace{-1em}
77+
\hrule
78+
\vspace{0.2em}
79+
\begin{fontspace}{1.5}{2}
8380
<! if queue.prevItem !>
84-
\previous{<< queue.prevItem >>}
81+
<! if queue.prevItem.url !>
82+
\href{<< queue.prevItem.url >>}{\previous{<< queue.previtem.name >>}}
83+
<! else !>
84+
\previous{<< queue.prevItem.name >>}
85+
<! endif !>
8586
<! else !>
8687
<! for item in queue.nextItems !>
87-
<< item >> <! if queue.isSplit !>\\<! endif !>
88+
<! if item.url !>
89+
\href{<< item.url >>}{<< item.name >>}
90+
<! else !>
91+
<< item.name >>
92+
<! endif !>
93+
<! if queue.isSplit !>\\<! endif !>
8894
<! endfor !>
8995
<! endif !>
90-
\end{queue}
96+
\end{fontspace}
97+
\end{minipage}
98+
\vspace{2em}
9199

92100
<! endfor !>
93101
<! endfor !>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# `queue-sheet-haskell` `0.2.0.0` Release Notes
2+
3+
Date
4+
: 2020-08-11
5+
6+
## Overview
7+
8+
This release of Queue Sheet adds support for associating URLs with queues as
9+
well as queue items. This allows others to easily access the media when a
10+
Queue Sheet PDF is shared. See the updated man page and example for details.
11+
12+
YAML files used with version `0.1.0.0` work with version `0.2.0.0` without
13+
change, but YAML files that include URLs will not work with version `0.1.0.0`.

queue-sheet.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: queue-sheet
2-
version: 0.1.0.0
2+
version: 0.2.0.0
33
category: Utils
44
synopsis: queue sheet utility
55
description:

queue-sheet.hs

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ defaultTemplate = "template.tex"
9292
------------------------------------------------------------------------------
9393
-- $Types
9494

95-
-- | Name of a queue
95+
-- | Name of a queue or queue item
9696
newtype Name = Name Text
9797
deriving newtype Show
9898

@@ -105,6 +105,19 @@ instance Ginger.ToGVal m Name where
105105
instance TTC.Render Name where
106106
render (Name t) = TTC.fromT t
107107

108+
-- | URL of queue or queue item
109+
newtype Url = Url Text
110+
deriving newtype Show
111+
112+
instance FromJSON Url where
113+
parseJSON = fmap Url . parseToString
114+
115+
instance Ginger.ToGVal m Url where
116+
toGVal (Url t) = Ginger.toGVal $ escapeTeX t
117+
118+
instance TTC.Render Url where
119+
render (Url t) = TTC.fromT t
120+
108121
-- | Section used to organize queues
109122
newtype Section = Section Text
110123
deriving newtype (Eq, Show)
@@ -144,22 +157,38 @@ instance TTC.Render Date where
144157
render (Date t) = TTC.fromT t
145158

146159
-- | Queue item
147-
newtype Item = Item Text
148-
deriving newtype Show
160+
data Item
161+
= Item
162+
{ itemName :: !Name
163+
, itemUrl :: !(Maybe Url)
164+
}
165+
deriving Show
149166

150167
instance FromJSON Item where
151-
parseJSON = fmap Item . parseToString
168+
parseJSON = \case
169+
(A.Object o) ->
170+
Item
171+
<$> o .: "name"
172+
<*> o .:? "url"
173+
value ->
174+
Item
175+
<$> fmap Name (parseToString value)
176+
<*> pure Nothing
152177

153178
instance Ginger.ToGVal m Item where
154-
toGVal (Item t) = Ginger.toGVal $ escapeTeX t
179+
toGVal Item{..} = Ginger.dict
180+
[ "name" ~> itemName
181+
, "url" ~> itemUrl
182+
]
155183

156-
instance TTC.Render Item where
157-
render (Item t) = TTC.fromT t
184+
--instance TTC.Render Item where
185+
-- render (Item t) = TTC.fromT t
158186

159187
-- | Queue information
160188
data Queue
161189
= Queue
162190
{ queueName :: !Name
191+
, queueUrl :: !(Maybe Url)
163192
, queueSection :: !Section
164193
, queueSplit :: !Bool
165194
, queueTags :: ![Tag]
@@ -171,6 +200,7 @@ data Queue
171200
instance FromJSON Queue where
172201
parseJSON = A.withObject "Queue" $ \o -> do
173202
queueName <- o .: "name"
203+
queueUrl <- o .:? "url"
174204
queueSection <- o .: "section"
175205
queueSplit <- o .:? "split" .!= False
176206
queueTags <- o .:? "tags" .!= []
@@ -262,6 +292,7 @@ loadQueuesYaml path = do
262292
data QueueCtx
263293
= QueueCtx
264294
{ name :: !Name
295+
, url :: !(Maybe Url)
265296
, isSplit :: !Bool
266297
, isPartial :: !Bool
267298
, isComplete :: !Bool
@@ -273,6 +304,7 @@ data QueueCtx
273304
instance Ginger.ToGVal m QueueCtx where
274305
toGVal QueueCtx{..} = Ginger.dict
275306
[ "name" ~> name
307+
, "url" ~> url
276308
, "isSplit" ~> isSplit
277309
, "isPartial" ~> isPartial
278310
, "isComplete" ~> isComplete
@@ -285,6 +317,7 @@ instance Ginger.ToGVal m QueueCtx where
285317
queueCtx :: Queue -> QueueCtx
286318
queueCtx Queue{..} = QueueCtx
287319
{ name = queueName
320+
, url = queueUrl
288321
, isSplit = queueSplit
289322
, isPartial = TagPartial `elem` queueTags
290323
, isComplete = TagComplete `elem` queueTags
@@ -384,7 +417,7 @@ data Options
384417
}
385418
deriving Show
386419

387-
-- Parse program options
420+
-- | Parse program options
388421
parseOptions :: IO Options
389422
parseOptions = OA.execParser
390423
$ OA.info (LibOA.helper <*> LibOA.versioner version <*> options)

queue-sheet.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
}:
55
mkDerivation {
66
pname = "queue-sheet";
7-
version = "0.1.0.0";
7+
version = "0.2.0.0";
88
src = ./.;
99
isLibrary = false;
1010
isExecutable = true;

stack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
resolver: lts-16.6
1+
resolver: lts-16.8
22

33
packages:
44
- .

0 commit comments

Comments
 (0)