newport 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cde9ad6247ebf9abbfd0e1b6039567784b7a69f995bbe36f435a3cd15a4a6f30
4
- data.tar.gz: 5af60fc2e02d5fd95c0b679f4b356b0c776ebf592e25e85fd7068989b73f523a
3
+ metadata.gz: d812d5ec4ba1fe03c1755f96d5ded800af0c424dac23d8f0c4bc04a9d9424840
4
+ data.tar.gz: 7ff68730b4d239029c0f58077cc8370179ffebe4bddfcbc0ee8c90c646cc7d18
5
5
  SHA512:
6
- metadata.gz: 16e7c45707884e45a018a6144852880e39e8882fc3acc9cb9e0342a8a7d19c8bdd6f1c6096e34259e8a91bb4762bab97b74afff302909451740a1c6761517bb5
7
- data.tar.gz: 711c06ca630378be05a3776eddf85c0723b2992cea619cb429a367a97ed710e9b66dbdc5566f2c92371d3b31e8a029029fe8db8483e831bae72c8e7ca1e8b4f9
6
+ metadata.gz: 6ec91bcbaca6dc17e5af8dc12e37deeedb00e7bb5a00e26a7f734bba835d2d8c8c0a64ebd26ebc8964dde1b880e86bc7db8a09d792ea04cb0121cf0c56f5b3b9
7
+ data.tar.gz: 49cabe94441f6e2525d140eecf87025902e53f94d08b7f0adaf2738d5cc0122051dec802e25df8f14dddb89d504d5536d5900087975a594235b3b7325a8a98c0
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Newport
4
- VERSION = '1.0.4'
4
+ VERSION = '1.0.5'
5
5
  end
@@ -0,0 +1,7 @@
1
+ title: ""
2
+ email: ""
3
+ plugins:
4
+ - expander
5
+ - darkmode
6
+ - permalink
7
+ - pagination
@@ -0,0 +1,2 @@
1
+ /*! js-cookie v3.0.0-rc.1 | MIT */
2
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self,function(){var n=e.Cookies,r=e.Cookies=t();r.noConflict=function(){return e.Cookies=n,r}}())}(this,function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var t={read:function(e){return e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};return function n(r,o){function i(t,n,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),n=r.write(n,t);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+n+c}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],o={},i=0;i<n.length;i++){var c=n[i].split("="),u=c.slice(1).join("=");'"'===u[0]&&(u=u.slice(1,-1));try{var f=t.read(c[0]);if(o[f]=r.read(u,f),e===f)break}catch(e){}}return e?o[e]:o}},remove:function(t,n){i(t,"",e({},n,{expires:-1}))},withAttributes:function(t){return n(this.converter,e({},this.attributes,t))},withConverter:function(t){return n(e({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(r)}})}(t,{path:"/"})});
@@ -0,0 +1,10 @@
1
+ <footer>
2
+ <div class="container">
3
+ <p>
4
+ <!-- title -->
5
+ </p>
6
+ <p>Email: <a href="mailto: <!-- email -->" title="Email">
7
+ <!-- email -->
8
+ </a></p>
9
+ </div>
10
+ </footer>
@@ -0,0 +1,9 @@
1
+ <head>
2
+ <meta charset="utf-8">
3
+ <meta name="viewport" content="width=device-width, initial-scale=1">
4
+ <title>
5
+ <!-- title -->
6
+ </title>
7
+ <!-- javascript -->
8
+ <!-- style -->
9
+ </head>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <!-- head -->
4
+
5
+ <body>
6
+ <div class="container main">
7
+ <!-- nav -->
8
+ <section>
9
+ <!-- posts -->
10
+ </section>
11
+ </div>
12
+ <!-- footer -->
13
+ <!-- plugins -->
14
+ </body>
15
+
16
+ </html>
@@ -0,0 +1,5 @@
1
+ <nav>
2
+ <!-- <a href="/">home</a> &middot;
3
+ <a href="/feed.xml">feed</a> &middot; -->
4
+ <div id="darkmode"></div>
5
+ </nav>
@@ -0,0 +1,97 @@
1
+ html{height:100%}
2
+ body{margin:0;padding:0 0.5em;background-color: var(--background-color);color: var(--text-color);height:100%}
3
+ .container{max-width:768px;margin:auto;padding-left:5px;padding-right:5px}
4
+ body{font-family:monospace;font-size:1.1rem;line-height:1.2rem;}
5
+ a,a:active,a:visited{color:#1FC5FF;text-decoration:none}
6
+ article h1 {margin-bottom:3px}
7
+ article h2 {margin-top:-1em;color:#EA4D89;font-weight:normal;font-size:0.85rem;margin: 0}
8
+ pre{white-space: pre-wrap}
9
+ article{margin-bottom:3em}
10
+ nav{text-align:right;padding-top:0.5rem}
11
+ article img{margin: auto;display: block}
12
+ article blockquote{margin-left:25px;border-left:10px #ddd solid;padding-left:15px;white-space: pre-wrap}
13
+ img{max-width: 100%;}
14
+ h1 a,h1 a:active,h1 a:visited{color:#111;}
15
+ .title{float:left;padding-top:0.5rem}
16
+ section{margin-top:2rem}
17
+ #darkmode{display:inline}
18
+ .expander-arrow, .more-arrow, .more-arrow:active, .more-arrow:visited { color: var(--text-color); fill: var(--text-color) }
19
+ footer {border-top: 1px #ccc solid;min-height: 80px;padding-top: 10px;padding-bottom:15px}
20
+ .main {min-height: calc(100% - 40px)}
21
+ code{background:var(--code-background-color);padding-left:2px;padding-right:2px}
22
+
23
+ :root {
24
+ --background-color: #fafafa;
25
+ --text-color: #111;
26
+ --code-background-color: #ccc;
27
+ }
28
+
29
+ [data-theme="dark"] {
30
+ --background-color: #111;
31
+ --text-color: #fafafa;
32
+ --code-background-color: #888;
33
+ }
34
+
35
+ /* The switch - the box around the slider */
36
+ .switch {
37
+ position: relative;
38
+ display: inline-block;
39
+ width: 30px;
40
+ height: 17px;
41
+ }
42
+
43
+ /* Hide default HTML checkbox */
44
+ .switch input {
45
+ opacity: 0;
46
+ width: 0;
47
+ height: 0;
48
+ }
49
+
50
+ /* The slider */
51
+ .slider {
52
+ position: absolute;
53
+ cursor: pointer;
54
+ top: 0;
55
+ left: 0;
56
+ right: 0;
57
+ bottom: 0;
58
+ background-color: #ccc;
59
+ -webkit-transition: .4s;
60
+ transition: .4s;
61
+ }
62
+
63
+ .slider:before {
64
+ position: absolute;
65
+ content: "";
66
+ height: 13px;
67
+ width: 13px;
68
+ left: 2px;
69
+ bottom: 2px;
70
+ background-color: white;
71
+ -webkit-transition: .4s;
72
+ transition: .4s;
73
+ color: #000;
74
+ }
75
+
76
+ input:checked + .slider {
77
+ background-color: #333;
78
+ }
79
+
80
+ input:focus + .slider {
81
+ box-shadow: 0 0 1px #333;
82
+ }
83
+
84
+ input:checked + .slider:before {
85
+ -webkit-transform: translateX(13px);
86
+ -ms-transform: translateX(13px);
87
+ transform: translateX(13px);
88
+ }
89
+
90
+ /* Rounded sliders */
91
+ .slider.round {
92
+ border-radius: 17px;
93
+ }
94
+
95
+ .slider.round:before {
96
+ border-radius: 50%;
97
+ }
@@ -0,0 +1,35 @@
1
+ // Place an empty div with the id darkmode where you want to toggle to appear in your html
2
+ // ie. <div id="darkmode"></div>
3
+
4
+ (function() {
5
+
6
+ function showDark() {
7
+ document.documentElement.setAttribute("data-theme", "dark");
8
+ Cookies.set('appearance', 'dark');
9
+ }
10
+
11
+ function showLight() {
12
+ document.documentElement.setAttribute("data-theme", "light");
13
+ Cookies.set('appearance', 'light');
14
+ }
15
+
16
+ var appearance = Cookies.get('appearance')
17
+ document.getElementById("darkmode").innerHTML = '<span style="color: orangered">&#9788;</span>/<span style="color: #888">&#9789;</span><label class="switch"><input type="checkbox" name="darkmode" id="darkmode-checkbox"/><span class="slider round"></span></label>';
18
+
19
+ if (appearance == 'dark') {
20
+ document.getElementById('darkmode-checkbox').checked = true;
21
+ showDark();
22
+ } else if (appearance == 'light') {
23
+ document.getElementById('darkmode-checkbox').checked = false;
24
+ showLight();
25
+ }
26
+
27
+ document.getElementById("darkmode-checkbox").onchange = function(){
28
+ if (document.getElementById('darkmode-checkbox').checked) {
29
+ showDark();
30
+ } else {
31
+ showLight();
32
+ }
33
+ };
34
+
35
+ })();
@@ -0,0 +1,29 @@
1
+ (function() {
2
+ const show = 1; // The number of paragraphs to show for each article/post
3
+
4
+ var articles = document.getElementsByTagName("article");
5
+ for(var i = 0; i < articles.length; i++){
6
+ var paras = articles[i].getElementsByTagName("p");
7
+ if (paras.length > show) {
8
+ // We have more paragraphs than we want to show
9
+ var r = Math.random().toString(36).substring(7);
10
+ // Now loop through the paragraphs
11
+ for(var j = 0; j < paras.length; j++){
12
+ if (j >= show) {
13
+ paras[j].setAttribute("style", 'display:none');
14
+ paras[j].setAttribute("class", r);
15
+ }
16
+ }
17
+ let expander = document.createElement('a');
18
+ expander.innerHTML = '<svg style="height: 10px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg>';
19
+ var expand_function = 'var elms = document.getElementsByClassName("'+r+'"); for(var k = 0; k < elms.length; k++) { elms[k].setAttribute("style", "display:block") } document.getElementById("link_'+r+'").setAttribute("style", "display:none"); return false;';
20
+ expander.setAttribute('onclick', expand_function);
21
+ expander.setAttribute('href', "#");
22
+ expander.setAttribute("id", 'link_'+r);
23
+ expander.setAttribute("style", 'color: #000');
24
+ expander.setAttribute("class", 'expander-arrow');
25
+ expander.setAttribute("title", 'Click to expand text');
26
+ paras[show].parentNode.insertBefore(expander, paras[show]);
27
+ }
28
+ }
29
+ })();
@@ -0,0 +1,30 @@
1
+
2
+ const show = 10; // The number of posts to show per page
3
+
4
+ function showPage(offset) {
5
+ // Avoid conflicts with permalink plugin
6
+ const link = window.location.href.split('#')[1];
7
+ if (link !== undefined) {
8
+ return;
9
+ }
10
+ let articles = document.getElementsByTagName("article");
11
+ for(let i = 0; i < articles.length; i++){
12
+ if (i < show+offset) {
13
+ articles[i].setAttribute("style", 'display:block');
14
+ } else {
15
+ articles[i].setAttribute("style", 'display:none');
16
+ }
17
+ }
18
+ if (articles.length > show+offset) {
19
+ let more = document.createElement('a');
20
+ more.innerHTML = 'more <svg style="width: 10px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"/></svg>';
21
+ let more_function = 'var elms = document.getElementsByClassName("more-arrow"); for(var k = 0; k < elms.length; k++) { elms[k].remove() }; showPage('+(offset+show)+'); return false;';
22
+ more.setAttribute('onclick', more_function);
23
+ more.setAttribute('href', "#");
24
+ more.setAttribute("class", 'more-arrow');
25
+ more.setAttribute("title", 'Click to show more posts');
26
+ articles[show+offset-1].parentNode.insertBefore(more, articles[show+offset-1].nextSibling);
27
+ }
28
+ }
29
+
30
+ showPage(0);
@@ -0,0 +1,42 @@
1
+ (function () {
2
+ window.addEventListener('hashchange', function () {
3
+ window.location.reload(true);
4
+ }, false);
5
+ // Add id and permailink to every article
6
+ var articles = document.getElementsByTagName("article");
7
+ for (var i = 0; i < articles.length; i++) {
8
+ let id = articles[i].getElementsByTagName("h1")[0].id;
9
+ articles[i].id = id;
10
+ var paras = articles[i].getElementsByTagName("p");
11
+ var pos = paras.length - 1;
12
+ paras[pos].innerHTML = paras[pos].innerHTML + ' <a href="#' + id + '" title="Permanent link to post" onclick="window.location.reload(true);">#</a>';
13
+ }
14
+ // Check if url contains link to article
15
+ const link = window.location.href.split('#')[1];
16
+ if (link !== undefined) {
17
+ var articles = document.getElementsByTagName("article");
18
+ var found = false;
19
+ for (var i = 0; i < articles.length; i++) {
20
+ var id = articles[i].id;
21
+ if (link == id) {
22
+ found = true;
23
+ articles[i].setAttribute("style", 'display:block');
24
+ var paras = articles[i].getElementsByTagName("p");
25
+ for (var j = 0; j < paras.length; j++) {
26
+ paras[j].setAttribute("style", 'display:block');
27
+ }
28
+ var arrows = articles[i].getElementsByClassName("expander-arrow");
29
+ for (var k = 0; k < arrows.length; k++) {
30
+ arrows[k].setAttribute("style", 'display:none');
31
+ }
32
+ } else {
33
+ articles[i].setAttribute("style", 'display:none');
34
+ }
35
+ }
36
+ if (found == false) {
37
+ let p = document.createElement('p');
38
+ p.innerHTML = 'Post ' + link + ' not found :(';
39
+ document.getElementsByTagName("section")[0].appendChild(p);
40
+ }
41
+ }
42
+ })();
@@ -0,0 +1,14 @@
1
+ # Welcome to Newport
2
+
3
+ ## 21 Jul, 2021
4
+
5
+ Welcome to your new blog powered by Newport. Start writing your blog posts in this directory, using markdown, and then run `newport build`. Your static blog will be written to a folder called production and you just need to upload the contents of that folder somewhere that is capable of hosting a static site for you. Some free options are:
6
+
7
+ 1. [GitHub Pages](https://pages.github.com)
8
+ 2. [DigitalOcean App Platform](https://www.digitalocean.com/products/app-platform/)
9
+
10
+ Don't forget to update your email address and site title in the config.yml
11
+
12
+ You'll find plugins in the javascript directory. If you develop any useful plugins for your own use please consider submitting a pull request to the [Newport GitHub](https://github.com/richard-fisher/newport)
13
+
14
+ Happy blogging!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newport
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Fisher
@@ -103,6 +103,18 @@ files:
103
103
  - lib/newport/logger.rb
104
104
  - lib/newport/new.rb
105
105
  - lib/newport/version.rb
106
+ - lib/site_template/config.yml
107
+ - lib/site_template/javascript/js.cookie.min.js
108
+ - lib/site_template/layouts/footer.html
109
+ - lib/site_template/layouts/head.html
110
+ - lib/site_template/layouts/main.html
111
+ - lib/site_template/layouts/nav.html
112
+ - lib/site_template/layouts/style.css
113
+ - lib/site_template/plugins/darkmode.js
114
+ - lib/site_template/plugins/expander.js
115
+ - lib/site_template/plugins/pagination.js
116
+ - lib/site_template/plugins/permalink.js
117
+ - lib/site_template/posts/202107211703_digital-ocean-static-site-hosting.md
106
118
  homepage: https://github.com/richard-fisher/newport
107
119
  licenses:
108
120
  - MIT