summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/nginx/site.conf3
-rw-r--r--web/input/development.md2
-rw-r--r--web/input/doc/index.md2
-rw-r--r--web/input/download.md2
-rw-r--r--web/input/index.md2
-rw-r--r--web/input/news/release-1-5.md (renamed from web/input/doc/release-notes/1-5.md)10
-rw-r--r--web/input/resources/plugins.css6
-rw-r--r--web/input/support.md2
-rw-r--r--web/macros.py107
9 files changed, 107 insertions, 29 deletions
diff --git a/etc/nginx/site.conf b/etc/nginx/site.conf
index 90ceaea..eb8c5e8 100644
--- a/etc/nginx/site.conf
+++ b/etc/nginx/site.conf
@@ -68,6 +68,9 @@ server {
68 location ^~ /taxonomy/term/2 { 68 location ^~ /taxonomy/term/2 {
69 return 301 /doc/presentation.html; 69 return 301 /doc/presentation.html;
70 } 70 }
71 location ~ ^/doc/release-notes/(.*)$ {
72 return 301 /news/release-$1;
73 }
71 location ~ ^/(?:man.*|guidelines|extra-opts)$ { 74 location ~ ^/(?:man.*|guidelines|extra-opts)$ {
72 return 301 /doc$request_uri.html; 75 return 301 /doc$request_uri.html;
73 } 76 }
diff --git a/web/input/development.md b/web/input/development.md
index ddff634..9a1a72f 100644
--- a/web/input/development.md
+++ b/web/input/development.md
@@ -1,6 +1,6 @@
1title: Development 1title: Development
2parent: Home 2parent: Home
3menu-position: 5 3menu: 6
4--- 4---
5 5
6# Development 6# Development
diff --git a/web/input/doc/index.md b/web/input/doc/index.md
index 7b2d098..8f22011 100644
--- a/web/input/doc/index.md
+++ b/web/input/doc/index.md
@@ -1,6 +1,6 @@
1title: Documentation 1title: Documentation
2parent: Home 2parent: Home
3menu-position: 3 3menu: 4
4--- 4---
5 5
6# Documentation 6# Documentation
diff --git a/web/input/download.md b/web/input/download.md
index 4d46cf5..9c3d65b 100644
--- a/web/input/download.md
+++ b/web/input/download.md
@@ -1,6 +1,6 @@
1title: Download 1title: Download
2parent: Home 2parent: Home
3menu-position: 2 3menu: 3
4--- 4---
5 5
6# Download 6# Download
diff --git a/web/input/index.md b/web/input/index.md
index 8ab186c..b860177 100644
--- a/web/input/index.md
+++ b/web/input/index.md
@@ -1,5 +1,5 @@
1title: Home 1title: Home
2menu-position: 1 2menu: 1
3--- 3---
4 4
5# The Nagios Plugins Project 5# The Nagios Plugins Project
diff --git a/web/input/doc/release-notes/1-5.md b/web/input/news/release-1-5.md
index f68222f..58d0822 100644
--- a/web/input/doc/release-notes/1-5.md
+++ b/web/input/news/release-1-5.md
@@ -1,18 +1,14 @@
1title: Version 1.5 1title: Version 1.5 Released
2parent: Download
3post: Version 1.5 Released
4date: 2013-10-02 2date: 2013-10-02
5--- 3---
6 4
7# Version 1.5 Released
8
9*Wednesday, October 2, 2013*
10
11The Nagios Plugins Development Team is proud to announce version 1.5 of the 5The Nagios Plugins Development Team is proud to announce version 1.5 of the
12Nagios Plugins! This release comes with the new `check_dbi` plugin written by 6Nagios Plugins! This release comes with the new `check_dbi` plugin written by
13Sebastian Harl, and includes lots of enhancements and fixes provided by more 7Sebastian Harl, and includes lots of enhancements and fixes provided by more
14than forty contributors. Many thanks to all of you! 8than forty contributors. Many thanks to all of you!
15 9
10<end-of-abstract>
11
16Special kudos go to Sven Nierlein for fixing numerous bugs, reviewing many 12Special kudos go to Sven Nierlein for fixing numerous bugs, reviewing many
17pull requests, bringing our test suite back into shape, and setting up 13pull requests, bringing our test suite back into shape, and setting up
18automated tests on a variety of platforms. This helped us spotting lots of 14automated tests on a variety of platforms. This helped us spotting lots of
diff --git a/web/input/resources/plugins.css b/web/input/resources/plugins.css
index 552284f..7b44e7a 100644
--- a/web/input/resources/plugins.css
+++ b/web/input/resources/plugins.css
@@ -132,3 +132,9 @@ div#breadcrumb a:hover,
132div#footer a:hover { 132div#footer a:hover {
133 border-bottom: 1px solid #696969; 133 border-bottom: 1px solid #696969;
134} 134}
135
136p#news-footer {
137 color: #696969;
138 text-align: center;
139 font-size: small;
140}
diff --git a/web/input/support.md b/web/input/support.md
index c6d8b3d..538f320 100644
--- a/web/input/support.md
+++ b/web/input/support.md
@@ -1,6 +1,6 @@
1title: Support 1title: Support
2parent: Home 2parent: Home
3menu-position: 4 3menu: 5
4--- 4---
5 5
6# Support 6# Support
diff --git a/web/macros.py b/web/macros.py
index f3b6ec6..5918195 100644
--- a/web/macros.py
+++ b/web/macros.py
@@ -8,9 +8,13 @@ page = {
8 "description": "Standard monitoring plugins for Nagios and compatible monitoring solutions.", 8 "description": "Standard monitoring plugins for Nagios and compatible monitoring solutions.",
9 "keywords": "Nagios, Icinga, Shinken, Monitoring, Official, Plugins, Open, Source, Free, Software" 9 "keywords": "Nagios, Icinga, Shinken, Monitoring, Official, Plugins, Open, Source, Free, Software"
10} 10}
11release_notes = 'doc/release-notes/' + plugins_release.replace('.', '-') + '.html' 11release_notes = 'news/release-%s.html' % plugins_release.replace('.', '-')
12site_url = 'https://www.nagios-plugins.org/' 12site_url = 'https://www.nagios-plugins.org/'
13 13
14#
15# RSS Feed
16#
17
14_RSS = """<?xml version="1.0" encoding="UTF-8"?> 18_RSS = """<?xml version="1.0" encoding="UTF-8"?>
15<rss version="2.0"> 19<rss version="2.0">
16 <channel> 20 <channel>
@@ -40,15 +44,14 @@ _RSS_ITEM = """
40 44
41def hook_postconvert_rss(): 45def hook_postconvert_rss():
42 items = [] 46 items = []
43 posts = [p for p in pages if 'post' in p] 47 posts = [p for p in pages if 'date' in p]
44 posts.sort(key=lambda p: p.date, reverse=True) 48 posts.sort(key=lambda p: p.date, reverse=True)
45 for p in posts: 49 for p in posts:
46 title = p.post
47 link = '%s/%s' % (site_url.rstrip('/'), p.url) 50 link = '%s/%s' % (site_url.rstrip('/'), p.url)
48 desc = hx(p.html) 51 desc = hx(p.html)
49 date = time.mktime(time.strptime('%s 12' % p.date, '%Y-%m-%d %H')) 52 date = time.mktime(time.strptime('%s 12' % p.date, '%Y-%m-%d %H'))
50 date = email.utils.formatdate(date) 53 date = email.utils.formatdate(date)
51 items.append(_RSS_ITEM % (title, link, desc, link, date)) 54 items.append(_RSS_ITEM % (p.title, link, desc, date, link))
52 items = ''.join(items) 55 items = ''.join(items)
53 title = 'Nagios Plugins' 56 title = 'Nagios Plugins'
54 link = '%s/news/index.html' % site_url.rstrip('/') 57 link = '%s/news/index.html' % site_url.rstrip('/')
@@ -59,23 +62,84 @@ def hook_postconvert_rss():
59 fp.write(rss) 62 fp.write(rss)
60 fp.close() 63 fp.close()
61 64
62def list_posts(max_posts=-1): 65#
63 posts = [p for p in pages if 'post' in p] 66# News
67#
68
69def hook_preconvert_news():
70 posts_per_page = 10
71 posts = [p for p in pages if 'date' in p]
64 posts.sort(key=lambda p: p.date, reverse=True) 72 posts.sort(key=lambda p: p.date, reverse=True)
65 if max_posts == -1: 73 n_news_pages = len(posts) / posts_per_page
66 max_posts = len(posts) 74 if len(posts) % posts_per_page > 0:
67 for p in posts[:max_posts]: 75 n_news_pages += 1
68 date = time.strftime('%B %d, %Y', time.strptime(p['date'], '%Y-%m-%d')) 76 for i, chunk in enumerate(next_news_chunk(posts, posts_per_page)):
69 print '* **[%s](%s)** (%s)' % (p.post, p.url, date) 77 content = make_news_page(chunk, i) + make_news_footer(n_news_pages, i)
78 if i == 0:
79 p = Page('news/index.md',
80 virtual=content,
81 menu=2,
82 title='News',
83 parent='Home')
84 else:
85 p = Page('news/%d.md' % (i + 1),
86 virtual=content,
87 title='News Page %d' % (i + 1),
88 parent='News')
89 pages.append(p)
70 90
71def list_kids(): 91def make_news_page(posts, current_index):
72 kids = [(p.url, p.title) for p in pages if p.get('parent') == page.title] 92 marker = '<end-of-abstract>'
73 for kid in sorted(kids): 93 source = list()
74 print('* [%s](%s)' % (kid[1], kid[0])) 94 if current_index == 0:
95 title = 'News'
96 else:
97 title = 'News Page %d' % (current_index + 1)
98 abstract = ['# ' + title]
99 for p in posts:
100 timestamp = time.strptime(p.date, '%Y-%m-%d')
101 date = time.strftime('%A, %B %-e, %Y', timestamp)
102 abstract.append('## %s' % p.title)
103 abstract.append('*%s*' % date)
104 abstract.append('%s' % p.source.split(marker, 1)[0])
105 abstract.append('[<a href="%s">Read more</a>]' % p.url)
106 source.append('# %s' % p.title)
107 source.append('*%s*' % date)
108 source.append(p.source.replace(marker, '', 1))
109 p.source = '\n'.join(source)
110 p['parent'] = title
111 return '\n'.join(abstract) + '\n\n'
112
113def make_news_footer(n_news_pages, current_index):
114 footer = list()
115 if current_index != 0:
116 previous = 'index' if current_index == 1 else str(current_index)
117 footer.append('[First](news/index.html)')
118 footer.append('[Previous](news/%s.html)' % previous)
119 if n_news_pages <= 20:
120 for i in range(n_news_pages):
121 if i == current_index:
122 footer.append('%d' % (i + 1))
123 else:
124 footer.append('[%d](news/%d.html)' % (i + 1, i + 1))
125 if current_index != n_news_pages - 1:
126 footer.append('[Next](news/%d.html)' % (current_index + 2))
127 footer.append('[Last](news/%d.html)' % n_news_pages)
128 return '&emsp;'.join(footer) + '\n{: #news-footer }\n'
129
130def next_news_chunk(posts, posts_per_page):
131 index = 0
132 while len(posts[index:]) > 0:
133 yield posts[index:index + posts_per_page]
134 index += posts_per_page
135
136#
137# Menu and Breadcrumb Navigation
138#
75 139
76def menu(): 140def menu():
77 menu_pages = [p for p in pages if 'menu-position' in p] 141 menu_pages = [p for p in pages if 'menu' in p]
78 menu_pages.sort(key=lambda p: int(p['menu-position'])) 142 menu_pages.sort(key=lambda p: int(p['menu']))
79 for p in menu_pages: 143 for p in menu_pages:
80 if p.title == page.title: 144 if p.title == page.title:
81 print('<span id="current">%s</span>' % hx(p.title)) 145 print('<span id="current">%s</span>' % hx(p.title))
@@ -96,6 +160,15 @@ def breadcrumb():
96 crumbs = '&nbsp;' + stable 160 crumbs = '&nbsp;' + stable
97 return crumbs 161 return crumbs
98 162
163#
164# Miscellaneous
165#
166
167def list_kids():
168 kids = [(p.url, p.title) for p in pages if p.get('parent') == page.title]
169 for kid in sorted(kids):
170 print('* [%s](%s)' % (kid[1], kid[0]))
171
99def copyright_years(since=None): 172def copyright_years(since=None):
100 this_year = time.gmtime().tm_year 173 this_year = time.gmtime().tm_year
101 if since is not None and int(since) != this_year: 174 if since is not None and int(since) != this_year: