atproto-based blog in ruby

add more formatting options

+2
Gemfile
··· 11 gem "kramdown", "~> 2.5" 12 13 gem "sinatra-contrib", "~> 4.1"
··· 11 gem "kramdown", "~> 2.5" 12 13 gem "sinatra-contrib", "~> 4.1" 14 + 15 + gem "markaby", "~> 0.9.4"
+4
Gemfile.lock
··· 2 remote: https://rubygems.org/ 3 specs: 4 base64 (0.2.0) 5 ffi (1.17.1-arm64-darwin) 6 haml (6.3.0) 7 temple (>= 0.8.2) ··· 10 kramdown (2.5.1) 11 rexml (>= 3.3.9) 12 logger (1.7.0) 13 minisky (0.5.0) 14 base64 (~> 0.1) 15 multi_json (1.15.0) ··· 56 DEPENDENCIES 57 haml 58 kramdown (~> 2.5) 59 minisky 60 puma (~> 6.6) 61 rackup (~> 2.2)
··· 2 remote: https://rubygems.org/ 3 specs: 4 base64 (0.2.0) 5 + builder (3.3.0) 6 ffi (1.17.1-arm64-darwin) 7 haml (6.3.0) 8 temple (>= 0.8.2) ··· 11 kramdown (2.5.1) 12 rexml (>= 3.3.9) 13 logger (1.7.0) 14 + markaby (0.9.4) 15 + builder 16 minisky (0.5.0) 17 base64 (~> 0.1) 18 multi_json (1.15.0) ··· 59 DEPENDENCIES 60 haml 61 kramdown (~> 2.5) 62 + markaby (~> 0.9.4) 63 minisky 64 puma (~> 6.6) 65 rackup (~> 2.2)
+3
main.rb
··· 2 require "sinatra/contrib" 3 4 require "haml" 5 require "kramdown" 6 require_relative "extra/helpers" 7 ENV["LUA_LIB"] = abs_path("./liblua.dylib") ··· 16 data = MainBlog.post_list(page) 17 cursor = data[:cursor] 18 posts = data[:records] 19 haml :index, locals: { cursor: cursor, posts: posts, backbutton: backbutton } 20 end 21 22 get "/post/:post_id" do 23 post = MainBlog.get_post(params[:post_id]) 24 haml :post, locals: { post_content: post["value"] } 25 end 26
··· 2 require "sinatra/contrib" 3 4 require "haml" 5 + require "markaby/kernel_method" 6 require "kramdown" 7 require_relative "extra/helpers" 8 ENV["LUA_LIB"] = abs_path("./liblua.dylib") ··· 17 data = MainBlog.post_list(page) 18 cursor = data[:cursor] 19 posts = data[:records] 20 + @title = MainBlog.home_rec["title"] 21 haml :index, locals: { cursor: cursor, posts: posts, backbutton: backbutton } 22 end 23 24 get "/post/:post_id" do 25 post = MainBlog.get_post(params[:post_id]) 26 + @title = post["value"]["title"] + " | " + MainBlog.home_rec["title"] 27 haml :post, locals: { post_content: post["value"] } 28 end 29
+9 -1
views/block.haml
··· 4 - @text = section["text"] 5 - if @text.empty? 6 - else 7 - != haml :paragraph 8 - when "heading" 9 %h3>= section["text"] 10 - when "subheading"
··· 4 - @text = section["text"] 5 - if @text.empty? 6 - else 7 + %p<>!= haml :paragraph 8 + - when "list" 9 + %ol 10 + - section["text"].each do |elem| 11 + - @text = elem 12 + %li<>!= haml :paragraph 13 + - when "code" 14 + %pre 15 + %code<>= section["text"] 16 - when "heading" 17 %h3>= section["text"] 18 - when "subheading"
-5
views/index.haml
··· 1 - %html 2 - %head 3 - %link{ :rel => "stylesheet", :href => "/style.css" } 4 - %title= MainBlog.home_rec["title"] 5 - 6 %h2= MainBlog.home_rec["title"] 7 8 - @content = MainBlog.home_rec["content"]
··· 1 %h2= MainBlog.home_rec["title"] 2 3 - @content = MainBlog.home_rec["content"]
+5
views/layout.haml
··· 1 != yield 2 3 %br
··· 1 + %html 2 + %head 3 + %link{ :rel => "stylesheet", :href => "/style.css" } 4 + %title= @title 5 + 6 != yield 7 8 %br
-5
views/post.haml
··· 1 - %html 2 - %head 3 - %link{ :rel => "stylesheet", :href => "/style.css" } 4 - %title= post_content["title"] + " | " + MainBlog.home_rec["title"] 5 - 6 %h1= post_content["title"] 7 %strong= post_content["createdAt"] 8 - @content = post_content["content"]
··· 1 %h1= post_content["title"] 2 %strong= post_content["createdAt"] 3 - @content = post_content["content"]