Skip to content

Commit

Permalink
Add ability to override relative positioning.
Browse files Browse the repository at this point in the history
  • Loading branch information
kristaps committed Feb 9, 2016
1 parent 7963853 commit f7d7f21
Show file tree
Hide file tree
Showing 18 changed files with 135 additions and 43 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ VERSIONS = version_0_0_13.xml \
version_0_2_7.xml \
version_0_2_8.xml \
version_0_2_9.xml \
version_0_2_10.xml
version_0_2_10.xml \
version_0_2_11.xml
XMLS = $(ARTICLEXMLS) \
$(VERSIONS)
ATOM = atom.xml
Expand Down
52 changes: 37 additions & 15 deletions article.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
html, body { margin: 0;
padding: 0; }
body { color: #333;
font-size: 12pt; }
body { color: #333; }
a { text-decoration: none; }
p { line-height: 120%; }
aside { display: none; }
Expand Down Expand Up @@ -31,11 +30,11 @@ body > section > div[data-sblg-permlink] > a:hover
body > section > p:last-child
{ margin-bottom: 0;
padding-bottom: 1.12em; }
body > footer { padding: 2em 0;
body > footer { padding: 1em 0;
text-align: center;
color: #999999; }
body > footer a { color: #999999; }
body > footer a:hover { color: #666666; }
body > footer a { color: #444; }
body > footer a:hover { color: #000; }
p.code { background-color: #eeeeee;
border-radius: 0.5ex;
padding: 0.5ex;
Expand All @@ -48,17 +47,10 @@ body > header { padding: 2em 0;
color: #dddddd;
text-align: center;
background-color: #336699; }
body > header h1 { font-size: 28pt;
font-weight: normal;
margin: 0;
body > header h1 { margin: 0;
display: inline-block; }
body > header h1 a { color: #eeeeee; }
body > header div { font-size: 24pt;
display: inline; }
body > section > article[data-sblg-article] h1,
body > section > article[data-sblg-article] h2,
body > section > article[data-sblg-article] h3
{ font-size: large; }
body > header div { display: inline; }
body > section > article[data-sblg-article] header h1
{ margin-bottom: 0; }
body > section > article[data-sblg-article] header div
Expand All @@ -73,7 +65,6 @@ body > section > article[data-sblg-article] header time
div.version { color: #333333;
background-color: #dddddd;
border-bottom: thin solid #aaaaaa;
font-size: 14pt;
padding: 1.5ex;
padding-left: 1.5ex; }
div.version > span { border-right: thin solid #aaaaaa;
Expand All @@ -82,3 +73,34 @@ div.version > span { border-right: thin solid #aaaaaa;
div.version > a { color: #333;
padding: 0 0.5ex; }
div.version > a:hover { color: #000; }


body > header div, h1 {
font-family: Garamond,Baskerville,Baskerville Old Face,Hoefler Text,Times New Roman,serif;
font-size: 24px;
font-style: normal;
font-variant: normal;
font-weight: 500;
line-height: 26.4px; }
h2 {
font-family: Garamond,Baskerville,Baskerville Old Face,Hoefler Text,Times New Roman,serif;
font-size: 18px;
margin-bottom: 0;
font-style: normal;
font-variant: normal;
font-weight: 500;
line-height: 20.4px; }
footer, p {
font-family: Garamond,Baskerville,Baskerville Old Face,Hoefler Text,Times New Roman,serif;
font-size: 14px;
font-style: normal;
font-variant: normal;
font-weight: 400;
line-height: 20px; }

code {
font-size: 13px;
font-style: normal;
font-variant: normal;
font-weight: 400;
line-height: 18.5667px; }
2 changes: 1 addition & 1 deletion article.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</article>
</section>
<footer>
&#169; 2013&#8211;2015, <a rel="author" href="http://kristaps.bsd.lv">Kristaps Dzonsons</a>
&#169; 2013&#8211;2016, <a rel="author" href="http://kristaps.bsd.lv">Kristaps Dzonsons</a>
</footer>
</body>
</html>
2 changes: 1 addition & 1 deletion article1.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<article data-sblg-article="1" data-sblg-tags="howto">
<header>
<h1>How should one write articles?</h1>
<h2>How should one write articles?</h2>
<div>Posted by <address>Kristaps Dzonsons</address> on <time datetime="2013-06-30">30 June, 2013</time></div>
</header>
<aside>How to write blog article mark-up for sblg.</aside>
Expand Down
2 changes: 1 addition & 1 deletion article2.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<article data-sblg-article="1" data-sblg-tags="howto">
<header>
<h1>How does it work?</h1>
<h2>How does it work?</h2>
<div>Posted by <address>Kristaps Dzonsons</address> on <time datetime="2013-07-01">01 July, 2013</time></div>
</header>
<aside>How sblg merges blog articles into amalgamations.</aside>
Expand Down
2 changes: 1 addition & 1 deletion article4.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<article data-sblg-article="1" data-sblg-tags="howto">
<header>
<h1>What about feeds?</h1>
<h2>What about feeds?</h2>
<div>Posted by <address>Kristaps Dzonsons</address> on <time datetime="2013-06-29">29 June, 2013</time></div>
</header>
<aside>How to use the Atom feed amalgamation feature.</aside>
Expand Down
2 changes: 1 addition & 1 deletion article5.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<article data-sblg-article="1" data-sblg-tags="howto">
<header>
<h1>Tips and Tricks: System Release Notes</h1>
<h2>Tips and Tricks: System Release Notes</h2>
<div>Posted by <address>Kristaps Dzonsons</address> on <time datetime="2014-08-14">14 August, 2014</time></div>
</header>
<aside>Tips and tricks for using sblg: articles inlined into blogs and atom feeds.</aside>
Expand Down
2 changes: 1 addition & 1 deletion article6.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<article data-sblg-article="1" data-sblg-tags="howto">
<header>
<h1>Tips and Tricks: Tag Indexes</h1>
<h2>Tips and Tricks: Tag Indexes</h2>
<div>Posted by <address>Kristaps Dzonsons</address> on <time datetime="2014-08-02">02 August, 2014</time></div>
</header>
<aside>How to make tag indexes and clouds. (Don't use clouds: they're ridiculous.)</aside>
Expand Down
2 changes: 1 addition & 1 deletion article7.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<article data-sblg-article="1" data-sblg-tags="howto">
<header>
<h1>Tips and Tricks: Fancy Navigation</h1>
<h2>Tips and Tricks: Fancy Navigation</h2>
<div>Posted by <address>Kristaps Dzonsons</address> on <time datetime="2014-08-15">15 August, 2014</time></div>
</header>
<aside>Tips and tricks for using sblg: custom navigation.</aside>
Expand Down
2 changes: 1 addition & 1 deletion article8.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<article data-sblg-article="1" data-sblg-tags="howto">
<header>
<h1>Tips and Tricks: Open Graph</h1>
<h2>Tips and Tricks: Open Graph</h2>
<div>Posted by <address>Kristaps Dzonsons</address> on <time datetime="2014-08-16">16 August, 2014</time></div>
</header>
<aside>Tips and tricks for using sblg: adding Open Graph meta tags.</aside>
Expand Down
2 changes: 1 addition & 1 deletion article9.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<article data-sblg-article="1" data-sblg-tags="howto">
<header>
<h1>Tips and Tricks: Tag Symbols</h1>
<h2>Tips and Tricks: Tag Symbols</h2>
<div>Posted by <address>Kristaps Dzonsons</address> on <time datetime="2015-05-23">23 May, 2015</time></div>
</header>
<aside>Tips and tricks for using sblg: using tag symbols.</aside>
Expand Down
7 changes: 7 additions & 0 deletions extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@

__BEGIN_DECLS

enum sort {
SORT_DEFAULT = 0,
SORT_FIRST,
SORT_LAST
};

struct article {
const char *src; /* source filename */
char *base; /* nil-terminated src w/o suffix */
Expand All @@ -41,6 +47,7 @@ struct article {
size_t articlesz; /* length of article */
char *tags; /* any article tags */
size_t tagsz;
enum sort sort;
};

int atom(XML_Parser p, const char *templ,
Expand Down
8 changes: 7 additions & 1 deletion grok.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,16 @@ input_begin(void *dat, const XML_Char *s, const XML_Char **atts)
memmove(loc - 1, loc + strlen(tok), sz);
}
free(tofree);
} else if (0 == strcasecmp(*attp, "data-sblg-sort")) {
if (0 == strcasecmp(attp[1], "first"))
arg->article->sort = SORT_FIRST;
else if (0 == strcasecmp(attp[1], "last"))
arg->article->sort = SORT_LAST;
}

arg->gstack = 1;
xmlstropen(&arg->article->article, &arg->article->articlesz, s, atts);
xmlstropen(&arg->article->article,
&arg->article->articlesz, s, atts);
XML_SetElementHandler(arg->p, article_begin, article_end);
XML_SetDefaultHandlerExpand(arg->p, article_text);
tsearch(arg, s, atts);
Expand Down
48 changes: 36 additions & 12 deletions index.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
body, html { height: 100%;
margin: 0;
width: 100%; }
a { text-decoration: none; }
a { text-decoration: none;
color: blue; }
body { display: table; }
body > section > footer { position: absolute;
width: 100%;
padding-bottom: 1ex;
bottom: 0;
font-size: 13pt;
text-align: center;
color: #aaa; }
body > section > footer a { color: #bbb; }
body > section > footer a:hover { color: #fff; }
body > section > footer div { display: inline-block;
margin-left: 1ex;
font-size: 16pt; }
margin-left: 1ex; }
body > section { background-color: #336699;
position: relative;
padding-bottom: 4em;
Expand All @@ -38,18 +37,14 @@ section.mi a.close { left: 0.5ex;
position: absolute;
color: #000; }
section.mo { color: #000;
text-shadow: 1px 1px 1px #aaa;
font-size: 20pt; }
text-shadow: 1px 1px 1px #aaa; }
section.mi > section:target { max-height: 100em; }
section.mi > h2 { font-size: 30pt;
color: #ddd;
font-weight: normal;
section.mi > h2 { color: #ddd;
text-shadow: 1px 1px 1px #666;
margin: 0; }
section.mi > h2:hover { text-shadow: 1px 1px 2px #999;
color: #fff; }
section.mi > h2 a { color: inherit; }
section.mi > section > *:not(a) { font-size: 13pt; }
section.mi p { line-height: 120%; }
nav[data-sblg-nav] ul { list-style-type: none;
padding: 0;
Expand All @@ -66,12 +61,41 @@ p.code code a { border-bottom: thin dashed #336699; }
p.code code.indent { padding-left: 4ex; }
p.code code.dindent { padding-left: 8ex; }
@media only screen and (max-width: 768px), only screen and (max-device-width: 768px) {
p.code code { font-size: 11pt; }
p.code code.indent { padding-left: 2ex; }
p.code code.dindent { padding-left: 4ex; }
body > section > footer div { display: block;
margin: 0; }
}
@media only screen and (max-width: 480px), only screen and (max-device-width: 480px) {
p.code code { font-size: 9pt; }
}

h2 {
font-family: Garamond,Baskerville,Baskerville Old Face,Hoefler Text,Times New Roman,serif;
font-size: 48px;
z-index: 3;
position: relative;
font-style: normal;
font-variant: normal;
font-weight: 500;
line-height: 50.4px; }
.mo, h3 {
font-family: Garamond,Baskerville,Baskerville Old Face,Hoefler Text,Times New Roman,serif;
font-size: 32px;
font-style: normal;
font-variant: normal;
font-weight: 500;
line-height: 34.4px; }
footer, p {
font-family: Garamond,Baskerville,Baskerville Old Face,Hoefler Text,Times New Roman,serif;
font-size: 14px;
font-style: normal;
font-variant: normal;
font-weight: 400;
line-height: 20px; }

code {
font-size: 13px;
font-style: normal;
font-variant: normal;
font-weight: 400;
line-height: 18.5667px; }
2 changes: 1 addition & 1 deletion index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
</section>
</section>
<footer>
&#169; 2013&#8211;2015, <a rel="author" href="http://kristaps.bsd.lv">Kristaps Dzonsons</a>
&#169; 2013&#8211;2016, <a rel="author" href="http://kristaps.bsd.lv">Kristaps Dzonsons</a>
<div>
<a href="snapshots/sblg.tar.gz"><i class="fa fa-gears"></i></a>
<a href="snapshots/sblg.tar.gz.sha512"><i class="fa fa-lock"></i></a>
Expand Down
9 changes: 9 additions & 0 deletions linkall.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,15 @@ scmp(const void *p1, const void *p2)
{
const struct article *s1 = p1, *s2 = p2;

if (s1->sort != s2->sort) {
if (SORT_FIRST == s1->sort ||
SORT_LAST == s2->sort)
return(-1);
else if (SORT_LAST == s1->sort ||
SORT_FIRST == s2->sort)
return(1);
}

return(difftime(s2->time, s1->time));
}

Expand Down
16 changes: 12 additions & 4 deletions sblg.1
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,25 @@ Boolean value is used in an Atom feed.
.Pp
There are a number of special attributes that are recognised.
.Bl -tag -width Ds
.It Li data-sblg-tags
This tag may be specified on any element within the article and consists
of space-separated tag names.
These tags are extracted for navigation tag operation.
.It Li data-sblg-lang
This tag may only be specified on the article element and specifies one
or more space-separated languages for the document.
These languages are removed in the
.Dq stripping
operations for the
.Sx Tag Symbols .
.It Li data-sblg-sort
Override the article's position relative to other articles.
This can be either
.Li first
or
.Li last .
If multiple articles have the same sort override, they are ordered in
the natural way.
.It Li data-sblg-tags
This tag may be specified on any element within the article and consists
of space-separated tag names.
These tags are extracted for navigation tag operation.
.El
.Ss Standalone Template
The standalone template file must be a well-formed XML file where the
Expand Down
15 changes: 15 additions & 0 deletions version_0_2_11.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<article data-sblg-article="1" data-sblg-tags="version">
<header>
<h1>0.2.11</h1>
<address>Kristaps Dzonsons</address>
<time datetime="2016-01-15">2016-01-15</time>
</header>
<aside>
<p>
Fix <code>${sblg-prev-stripbase}</code>, which was accidentally behaving the same as <code>${sblg-prev-base}</code>.
Change all the <q>strip</q> tags to refer only to directory and suffix stripping, then add the <q>lang</q> addition
(e.g., <code>${sblg-striplangbase}</code> to remove both.
Add the <code>data-sblg-sort</code> attribute to articles that allows them to override their relative positioning.
</p>
</aside>
</article>

0 comments on commit f7d7f21

Please sign in to comment.