runeblog 0.2.94 → 0.3.01

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/bin/blog +16 -12
  3. data/data/features.txt +18 -0
  4. data/data/global.lt3 +6 -21
  5. data/data/universal.lt3 +2 -5
  6. data/{lib → empty_view/config}/exper/2svg.lt3 +0 -0
  7. data/{lib → empty_view/config}/exper/gen_svg.rb +0 -0
  8. data/empty_view/config/exper/meta.html +10 -0
  9. data/{lib → empty_view/config}/exper/s2.html +0 -0
  10. data/{lib → empty_view/config}/exper/varmint.rb +0 -0
  11. data/empty_view/config/facebook/credentials.txt +7 -0
  12. data/empty_view/config/facebook/facebook.rb +42 -0
  13. data/empty_view/config/facebook/fb.html +10 -0
  14. data/empty_view/config/facebook/fb.js.lt3 +15 -0
  15. data/empty_view/config/reddit/credentials.txt +6 -0
  16. data/empty_view/config/reddit/notes.txt +4 -0
  17. data/empty_view/config/reddit/reddit_post_url.py +34 -0
  18. data/empty_view/config/reddit/redpost.rb +43 -0
  19. data/empty_view/config/reddit/the-graffiti-wall.html +91 -0
  20. data/empty_view/config/twitter/credentials.txt +3 -0
  21. data/empty_view/config/twitter/tw.html +12 -0
  22. data/empty_view/config/twitter/tw.js +5 -0
  23. data/{lib/exper/fbtw.rb → empty_view/config/twitter/twitter.rb} +4 -26
  24. data/empty_view/settings/features.txt +18 -0
  25. data/empty_view/settings/publish.txt +5 -0
  26. data/empty_view/settings/recent.txt +6 -0
  27. data/empty_view/settings/view.txt +4 -0
  28. data/empty_view/themes/standard/banner/top.lt3 +2 -2
  29. data/empty_view/themes/standard/blog/post_entry.lt3 +1 -1
  30. data/empty_view/themes/standard/etc/blog.css.lt3 +12 -12
  31. data/empty_view/themes/standard/post/generate.lt3 +3 -3
  32. data/empty_view/themes/standard/post/permalink.lt3 +1 -1
  33. data/lib/helpers-blog.rb +25 -16
  34. data/lib/liveblog.rb +57 -14
  35. data/lib/processing.rb +12 -2
  36. data/lib/publish.rb +11 -10
  37. data/lib/repl.rb +66 -4
  38. data/lib/runeblog.rb +106 -51
  39. data/lib/runeblog_version.rb +1 -1
  40. data/lib/view.rb +2 -0
  41. data/test/austin.rb +9 -11
  42. metadata +25 -10
  43. data/empty_view/themes/standard/global.lt3 +0 -35
  44. data/lib/exper/callout.js +0 -10
  45. data/lib/exper/fbtw-js +0 -48
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ed9580d074b2ce228aff385bbe22e907a9ae0c330f625aa2d42ee58464a1d3b
4
- data.tar.gz: 0ce0642e8b2f0026cca4133916ff0dd3f992bb1ae8cb89e3304d90221d8195a8
3
+ metadata.gz: ec29df304d77421321cba06f651b2f9111815d2d8c4db26a82c83de2e19a3b3b
4
+ data.tar.gz: 24e7358402b1f4709d04da4fea0f6fbcbf53a94aa5b8ef3ebf0b2ac21a8418cd
5
5
  SHA512:
6
- metadata.gz: 84d30bada582bd3393e075a1cba653ec11e719941c675d1a9753d6dbf921643137e6096205b5120c91f385e6d9cb4a1e823440607b1db5ee23232c87885128bc
7
- data.tar.gz: 0b0207066da6493400d66e9473c00659bef4b4169fb26cdbe554d220a59778579bd06207643516a409df39247fa8b263ae77229c16344912e81a8befb0237c6b
6
+ metadata.gz: 696f296668f2246f381caf84fa82366edc73a890ac86b558bd02a008b0c9d1f34a96ac69735b71981b266032fc9e713c26f5b497ac030d1aa35cdd2884967f9a
7
+ data.tar.gz: a66ce19884a600b1071463c4c3a344f84a2a9e9edc4f15cf2b3384d81163c550ca173cb0279d09f8a8b0b0685e1ceb55427d7a7d8b63d9256cb30843ea175f75
data/bin/blog CHANGED
@@ -25,12 +25,14 @@ end
25
25
  def get_universal
26
26
  univ = "#{@blog.root}/data/universal.lt3"
27
27
  if yesno("Faster initial setup? (no: edit universal.lt3)")
28
- author = ask!("Author name: ")
29
- site = ask!("Site/domain: ")
28
+ author = ask!(" Author name: ")
29
+ site = ask!(" Site/domain: ")
30
30
  # Now stash it...
31
31
  str = File.read(univ)
32
32
  str = str.gsub(/AUTHOR/, author)
33
33
  str = str.gsub(/SITE_DOMAIN/, site)
34
+ File.write(univ, str)
35
+ # STDERR.puts "------ universal ------\n#{`cat #{univ}`}\n------------------------"
34
36
  else
35
37
  vim_params = '-c ":set hlsearch" -c ":hi Search ctermfg=2 ctermbg=6" +/"\(AUTHOR.*\|SITE.*\)"'
36
38
  edit_file(univ, vim: vim_params)
@@ -39,18 +41,20 @@ end
39
41
 
40
42
  def get_global
41
43
  if yesno("Faster view setup? (no: edit global.lt3)")
42
- view_name = ask("\nFilename: ")
44
+ view_name = ask!("\n Filename: ")
43
45
  @blog.create_view(view_name) # call change_view??
44
- title = ask!("View title: ")
45
- subtitle = ask!("Subtitle : ")
46
- gname = "#{@blog.root}/views/#{view_name}/themes/standard/global.lt3"
47
- text = File.read(gname)
48
- text = text.gsub(/VIEW_NAME/, view_name)
49
- text = text.gsub(/VIEW_TITLE/, title)
50
- text = text.gsub(/VIEW_SUBTITLE/, subtitle)
51
- File.write(gname, text)
46
+ title = ask!(" View title: ")
47
+ subtitle = ask!(" Subtitle : ")
48
+ domain = ask!(" Domain : ")
49
+
50
+ vfile = "#{@blog.root}/views/#{view_name}/settings/view.txt"
51
+ hash = {/VIEW_NAME/ => view_name,
52
+ /VIEW_TITLE/ => title,
53
+ /VIEW_SUBTITLE/ => subtitle,
54
+ /VIEW_DOMAIN/ => domain}
55
+ @blog.complete_file(vfile, nil, hash)
52
56
  else
53
- view_name = ask!("\nFilename: ")
57
+ view_name = ask!("\n Filename: ")
54
58
  @blog.create_view(view_name) # call change_view??
55
59
  vim_params = '-c ":set hlsearch" -c ":hi Search ctermfg=2 ctermbg=6" +/"\(VIEW_.*\|SITE.*\)"'
56
60
  edit_file(@blog.view.dir/"themes/standard/global.lt3", vim: vim_params)
@@ -0,0 +1,18 @@
1
+ # 0 = disabled (installed but disabled)
2
+ # 1 = enabled (implies installed)
3
+ # x = excluded (not installed; does it even exist?)
4
+
5
+ reddit 1 # autopost, embed thread after blog post
6
+ facebook 0 # reader-like, reader post, autopost?
7
+ twitter 0 # reader-tweet, reader-follow, autotweet?
8
+
9
+ links 1 # widget: external links
10
+ news 1 # widget: news (external)
11
+ pages 1 # widget: internal pages
12
+ pinned 1 # widget: pinned posts
13
+
14
+ ad x # widget: embed advertising
15
+ bydates x # widget: browse posts by date
16
+ search x # widget: search posts
17
+ sitemap x # widget: site map
18
+ tag_cloud x # widget: tag cloud (clickable)
@@ -3,33 +3,18 @@
3
3
  . <variable> <value>
4
4
  . --------------------------------------------------
5
5
 
6
- .variables
7
- author AUTHOR
8
- blog VIEW_TITLE
9
- blog.desc VIEW_SUBTITLE
10
- site SITE
6
+ .variables view ../../settings/view.txt
7
+
8
+ .variables recent ../../settings/recent.txt
9
+
10
+ .variables publish ../../settings/publish.txt
11
11
 
12
+ .variables
12
13
  host http://SITE
13
14
  charset utf-8
14
15
  url http://SITE
15
16
  locale en_US
16
17
 
17
18
  font.family verdana
18
-
19
- post.title.color #010101
20
- post.title.size 28px
21
-
22
- post.text.color #0101a1
23
- post.text.size 22px
24
-
25
- post.date.color #9a9a9a
26
- post.date.size 15px
27
-
28
-
29
- publish.user root
30
- publish.server SITE
31
- publish.docroot /var/www/
32
- publish.path VIEW_NAME
33
- publish.proto http
34
19
  .end
35
20
 
@@ -8,14 +8,11 @@
8
8
  .nopara
9
9
 
10
10
  .variables
11
- . Identity
12
- author AUTHOR
13
- site SITE_DOMAIN
11
+ univ.author AUTHOR
12
+ univ.site SITE_DOMAIN
14
13
 
15
- . Style
16
14
  font.family verdana
17
15
 
18
- . Details
19
16
  charset utf-8
20
17
  locale en_US
21
18
  .end
@@ -0,0 +1,10 @@
1
+
2
+ <!-- meta tags: separate out? -->
3
+
4
+ <!-- meta property='fb:admins' content='767352779' /> -->
5
+ <meta property='og:url' content='http://rubyhacker.com/blog2/#{slug}.html'/>
6
+ <meta property='og:type' content='article'/>
7
+ <meta property='og:title' content='#{title}'/>
8
+ <meta property='og:image' content='http://rubyhacker.com/blog2/blog3b.gif'/>
9
+ <meta property='og:description' content='#{teaser}'/>
10
+
File without changes
@@ -0,0 +1,7 @@
1
+ admins 767352779
2
+ appid 1176481582378716
3
+ version v2.4
4
+ xfbml true
5
+ share true
6
+ width 450
7
+ faces true
@@ -0,0 +1,42 @@
1
+ class Livetext::Functions
2
+
3
+ def facebook_init
4
+ fb_appid = _var("facebook.appid")
5
+ xfbml = _var("facebook.xfbml")
6
+ ver = _var("facebook.version")
7
+ width = _var("facebook.width")
8
+ share = _var("facebook.share")
9
+ faces = _var("facebook.faces")
10
+ <<~HTML
11
+ window.fbAsyncInit = function() {
12
+ FB.init({
13
+ appId : '#{fb_appid}',
14
+ xfbml : #{xfbml},
15
+ version : '#{ver}'
16
+ });
17
+ };
18
+ HTML
19
+ end
20
+
21
+ =begin
22
+ <!-- Needed:
23
+ <meta property='fb:admins' content='$facebook.admins'/>
24
+ <meta property='og:url' content='http://rubyhacker.com/blog2/#{slug}.html'/>
25
+ <meta property='og:type' content='article'/>
26
+ <meta property='og:title' content='#{title}'/>
27
+ <meta property='og:image' content='http://rubyhacker.com/blog2/blog3b.gif'/>
28
+ <meta property='og:description' content='#{teaser}'/>
29
+ -->
30
+ =end
31
+
32
+ def facebook_likes
33
+ <<~HTML
34
+ <div class='fb-like'
35
+ data-share='#{share}'
36
+ data-width='#{width}'
37
+ data-show-faces='#{faces}'>
38
+ </div>
39
+ HTML
40
+ end
41
+
42
+ end
@@ -0,0 +1,10 @@
1
+
2
+ <!-- facebook -->
3
+
4
+ <div
5
+ class='fb-like'
6
+ data-share='true'
7
+ data-width='450'
8
+ data-show-faces='true'>
9
+ </div>
10
+
@@ -0,0 +1,15 @@
1
+ .variables facebook credentials.txt
2
+
3
+ <script>
4
+ window.fbAsyncInit = function() {
5
+ FB.init({
6
+ appId : '$facebook.appid',
7
+ xfbml : $facebook.xfbml,
8
+ version : '$facebook.ver'
9
+ });
10
+ };
11
+
12
+ callout(document, 'facebook-jssdk',
13
+ '//connect.facebook.net/en_US/sdk.js');
14
+ </script>
15
+
@@ -0,0 +1,6 @@
1
+ subreddit RubyElixirEtc
2
+ user_agent RuneBlog comments
3
+ client_id rAyZILgqGB7uHQ
4
+ client_secret 0CqLXyFu6ABb1MrErWRsB7Bo-i8
5
+ username hal_fulton
6
+ password adnar1m1
@@ -0,0 +1,4 @@
1
+ When a post is generated:
2
+ - check for reddit.id under VIEW/posts/nnnn-title/
3
+ - if it doesn't exist, post to reddit
4
+ - create the reddit.id
@@ -0,0 +1,34 @@
1
+
2
+ import re
3
+ import praw
4
+
5
+ f = open("reddit/credentials.txt", "r")
6
+ lines = f.readlines()
7
+ f.close()
8
+
9
+ dict = {}
10
+ for line in lines:
11
+ data = re.split(" +", line)
12
+ dict[data[0]] = data[1].rstrip()
13
+
14
+
15
+ reddit = praw.Reddit(user_agent = dict['user_agent'],
16
+ client_id = dict['client_id'],
17
+ client_secret = dict['client_secret'],
18
+ username = dict['username'],
19
+ password = dict['password'])
20
+
21
+ file = open("/tmp/reddit-post-url.txt", "r") # gaahhh
22
+ lines = file.readlines()
23
+ title = lines[0].rstrip()
24
+ url = lines[1].rstrip()
25
+
26
+ subred = reddit.subreddit(dict['subreddit'])
27
+ rid = subred.submit(title = title, url = url)
28
+
29
+ print(rid)
30
+
31
+ # submission = reddit.submission(id='edmcwf')
32
+ # print(submission.title)
33
+ # print(submission.url)
34
+
@@ -0,0 +1,43 @@
1
+ app_name = "raido1"
2
+ app_client = "rAyZILgqGB7uHQ"
3
+ secret = "0CqLXyFu6ABb1MrErWRsB7Bo-i8"
4
+
5
+ https://www.reddit.com/api/v1/authorize?client_id=rAyZILgqGB7uHQ&response_type=code&state=abc237def&redirect_uri=http%3A%2F%2Frubyhacker.com&duration=permanent&scope=identity%20edit%20flair%20history%20modconfig%20modflair%20modlog%20modposts%20modwiki%20mysubreddits%20privatemessages%20read%20report%20save%20submit%20subscribe%20vote%20wikiedit%20wikiread
6
+
7
+
8
+
9
+ require 'net/http'
10
+ require 'uri'
11
+ require 'json'
12
+
13
+
14
+ =begin
15
+ get_token = URI.parse("https://www.reddit.com/api/v1/access_token")
16
+ data = {
17
+ grant_type: authorization_code
18
+ code=CODE
19
+ redirect_uri=URI
20
+ }
21
+ =end
22
+
23
+
24
+
25
+ uri = URI.parse("http://reddit.com/api/submit")
26
+
27
+ header = {'Content-Type': 'text/json'}
28
+ data = {
29
+ sr: "RubyElixirEtc",
30
+ kind: "link",
31
+ title: "[Post] This is my title",
32
+ url: "http://rubyhacker.com/around_austin/permalink/the-graffiti-wall.html"
33
+ }
34
+
35
+ # Create the HTTP objects
36
+ http = Net::HTTP.new(uri.host, uri.port)
37
+ request = Net::HTTP::Post.new(uri.request_uri, header)
38
+ request.body = user.to_json
39
+
40
+ # Send the request
41
+ response = http.request(request)
42
+
43
+
@@ -0,0 +1,91 @@
1
+
2
+ <html>
3
+ <!-- Generated from /Users/Hal/Dropbox/files/runeblog/.blogs/views/around_austin/themes/standard/global.lt3 on 2019-12-19; editing not recommended. -->
4
+
5
+
6
+
7
+
8
+ <meta charset="utf-8">
9
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
10
+ <title>
11
+ Around Austin | The view from downtown...
12
+ </title>
13
+ <meta name="generator" content="Runeblog v 0.2.91">
14
+ <meta property="og:title" content="The graffiti wall ">
15
+ <meta property="og:locale" content="en_US">
16
+ <meta property="description" content="RIP, Hope Gallery">
17
+ <meta property="og:description" content="The view from downtown...">
18
+ <link rel="canonical" href="http://SITE">
19
+ <meta property="og:url" content="http://SITE">
20
+ <meta property="og:site_name" content="Around Austin">
21
+ <link type="application/atom+xml" rel="alternate" href="http://SITE/feed.xml" title="Around Austin">
22
+ <link rel="shortcut icon" type="image/x-icon" href="etc/favicon.ico">
23
+ <link rel="apple-touch-icon" href="etc/favicon.ico">
24
+ <link rel="stylesheet" href="etc/blog.css">
25
+ <body>
26
+
27
+ <section class="post">
28
+ <div class="recent-content">
29
+ <table border=0 width=100%><tr>
30
+ <td align=left valign=bottom><h2 class="recent-title">The graffiti wall</h2></td>
31
+ <td align=right valign=top><font size=-5><br></font>December 2, 2019</td>
32
+ </tr></table><hr>
33
+ <!-- Post number 3 -->
34
+
35
+
36
+ RIP, Hope Gallery
37
+
38
+
39
+ <div class='mydrop'>I</div>
40
+ <div style="padding-top: 1px">t's been a while since I was there. They say it was torn down
41
+ while I wasn't looking. Never tagged anything there, of course, nor
42
+ anywhere else. Spraypainting public places isn't my thing, but in this
43
+ case I condoned it because it was sort of there for that purpose.
44
+
45
+ <p>
46
+ This fake entry is a long one so as to demonstrate both drop-caps
47
+ (above) and an inset quote. Blah blah blah. Lorem ipsum dolor and
48
+ a partridge in a pear tree.
49
+
50
+ <p>
51
+ </p>
52
+ Wherever you go, there you are. Last night I saw upon the stair
53
+ a little man who was not there. He wasn't there again today; I
54
+ wish, I wish he'd go away. As far as we know, our computer has
55
+ <div style='float:left; width: 20%; padding:8px; padding-right:12px'><b><i> On a clean disk, you can seek forever.</i></b></div>
56
+ never had an undetected error.
57
+ On a clean disk, you can seek forever.
58
+ And never let it be denied that
59
+ pobbles are happier without their toes. And may your snark never
60
+ be a boojum. How do you know you aren't dreaming right now? When
61
+ you see a butterfly, think of Chuang Tzu.
62
+ <p>
63
+ Contact light. Houston, this is Tranquility Base. The Eagle has
64
+ landed. That's one small step for (a) man, one giant leap for
65
+ mankind.
66
+
67
+ <p>
68
+ Here's the PDF of <a style='text-decoration: none' href='http://rubyhacker.com/blog2/rubydino.pdf'>"Ruby for the Old-Time C Programmer"</a>
69
+
70
+ <p>
71
+ Pity this busy monster, manunkind, not. Pity rather... Listen:
72
+ There's a hell of a universe next door; let's go.
73
+
74
+ <p>
75
+ </div>
76
+ </section>
77
+
78
+ <br>
79
+ <!-- <script src='https://redditjs.com/subreddit.js' data-subreddit='RubyElixirEtc' data-width=600></script> -->
80
+ <!-- https://www.reddit.com/r/RubyElixirEtc/comments/ed48ra/post_this_is_only_a_test/ -->
81
+
82
+ <hr>
83
+ <table width=100%><tr>
84
+ <td width=10%><a style="text-decoration: none" href="javascript:history.go(-1)">[Back]</a></td>
85
+ <td width=10%><a style="text-decoration: none" href="http://SITE/VIEW_NAME/permalink/the-graffiti-wall.html"> [permalink] </a></td>
86
+ <td width=80% align=right><font size=-3></font></td></tr></table>
87
+ <hr>
88
+ <script src='https://redditjs.com/post.js' data-url="ed48ra" data-width=800 ></script>
89
+
90
+ </body>
91
+ </html>
@@ -0,0 +1,3 @@
1
+ user hal_fulton # via
2
+ related hal_fulton
3
+ count false
@@ -0,0 +1,12 @@
1
+
2
+ <!-- Twitter: share, follow -->
3
+
4
+ <a href='https://twitter.com/share'
5
+ class='twitter-share-button'
6
+ data-text='#{title}'
7
+ data-url='#{'url'}'
8
+ data-via='hal_fulton'
9
+ data-related='hal_fulton'>Tweet</a>
10
+
11
+ <a href='https://twitter.com/hal_fulton' class='twitter-follow-button' data-show-count='false'>Follow @hal_fulton</a>
12
+
@@ -0,0 +1,5 @@
1
+ <script>
2
+ callout(document, 'script', 'twitter-wjs',
3
+ '//platform.twitter.com/widgets.js';
4
+ </script>
5
+