inkblot 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e46ca89bfcf220e489ea3063be9236d694d647ebb1361ffa26b1a02a6836ad3
4
- data.tar.gz: 4b1ee88e2e2d838b774090957dd98244707180e59d74e1f9fa45c985151c3a4f
3
+ metadata.gz: ef19b45336c7174cad3412dc52d59f47452511f55ab5af05ed789e7a867cdc58
4
+ data.tar.gz: cebcdc588d7ad2cee92fc6b4f985ed27832c6e265c7d0184234de7b0ac4b368f
5
5
  SHA512:
6
- metadata.gz: dfa7b2b1c6301cc3e34ca3c4e774adf21c76632039957ef6ab79425651685496f7cace767e8f26c9a636265d8f1539b4da5579d1439aec52e7410b6fee874a63
7
- data.tar.gz: 451276507b487fcdcc9127a56da09105c7d34424f5858fe6a9b9f3b5c1d1cadd8aecd0835a8fa6d1932d53369a6d79fbeeefc7712c3dc5a720f2ac57476158cf
6
+ metadata.gz: 42f956ed1b6f3ac8e7be061a581a7854da276f2b09f5550d5389c446cf9ca4bee960637c266960500540a6d29a1d053492cf8fd19e9ec92a3aaf790076f80fe9
7
+ data.tar.gz: ae6d6e445e77e5aca6d6e00c3c1183599979290c736570b496fed96c85efb94423a28ee50a459f1958b5830601fb47f2b8ce0eac73d57bf00db5da039a2e146f
data/.build.yml ADDED
@@ -0,0 +1,29 @@
1
+ image: alpine/latest
2
+ packages:
3
+ - hut
4
+ - nodejs
5
+ - npm
6
+ - musl-dev
7
+ - libffi-dev
8
+ - yaml-dev
9
+ - ruby
10
+ - ruby-dev
11
+ - ruby-bundler
12
+ oauth: "pages.sr.ht/PAGES:RW"
13
+ environment:
14
+ site: farthergate.com
15
+ TAILWINDCSS_INSTALL_DIR: node_modules/.bin
16
+ tasks:
17
+ - test: |
18
+ cd inkblot
19
+ npm i tailwindcss @tailwindcss/cli @tailwindcss/typography
20
+ bundle install --path vendor/bundle
21
+ bundle exec rake || true
22
+ - site: |
23
+ cd inkblot/docs
24
+ bundle exec ../exe/inkblot build
25
+ - package: |
26
+ cd inkblot/docs/_build
27
+ tar -cvz . > ../../../site.tar.gz
28
+ - upload: |
29
+ hut pages publish -d $site site.tar.gz
data/.rspec_status ADDED
@@ -0,0 +1,3 @@
1
+ example_id | status | run_time |
2
+ --------------------------- | ------ | --------------- |
3
+ ./spec/inkblot_spec.rb[1:1] | passed | 0.00037 seconds |
data/Rakefile CHANGED
@@ -9,4 +9,8 @@ require "rubocop/rake_task"
9
9
 
10
10
  RuboCop::RakeTask.new
11
11
 
12
- task default: %i[spec rubocop]
12
+ task :css do
13
+ system("tailwindcss -i tailwind.css --minify -o lib/inkblot.min.css")
14
+ end
15
+
16
+ task default: %i[spec rubocop css]
data/docs/inkblot.yml CHANGED
@@ -1,7 +1,12 @@
1
1
  title: Inkblot
2
+
2
3
  nav:
3
- Inkblot:
4
- Home: /
4
+ - Inkblot:
5
+ - index
6
+ - Documentation:
7
+ - install
8
+ - getting-started
9
+ - tailwind
5
10
 
6
11
  nav-end:
7
12
  Aleks Rutins: https://farthergate.com
@@ -0,0 +1,55 @@
1
+ ---
2
+ id: getting-started
3
+ title: Getting Started
4
+ ---
5
+
6
+ # Getting Started
7
+
8
+ Start by initializing a new project:
9
+
10
+ ~~~ sh
11
+ inkblot init
12
+ ~~~
13
+
14
+ From that, you'll find an `inkblot.yml`, a `.gitignore`, and a `pages/index.md` file.
15
+
16
+ Run the development server:
17
+
18
+ ~~~ sh
19
+ inkblot dev
20
+ ~~~
21
+
22
+ And visit <http://localhost:3000> to see your documentation.
23
+
24
+ ## General Structure
25
+
26
+ Let's take a look around your project.
27
+
28
+ First of all, the `inkblot.yml` file describes general information about your site, along with navigation. The default looks like this:
29
+
30
+ ~~~ yaml
31
+ ---
32
+ title: Documentation
33
+ nav:
34
+ - :Documentation:
35
+ - index
36
+ ~~~
37
+
38
+ _If this looks a little strange for YAML, it's the default dump output from Ruby's Psych &mdash; you can just write normal YAML._
39
+
40
+ You're going to want to change the site title. When you want to add a page, add its `id` frontmatter property to a section in the `nav` key.
41
+
42
+ `pages/index.md` should look something like this:
43
+
44
+ ~~~ markdown
45
+ ---
46
+ id: index
47
+ title: Home
48
+ ---
49
+
50
+ # Home
51
+ ~~~
52
+
53
+ Again, the `id` is what you'll reference it by in the navigation, and the `title` will show up in the navigation and in the page title.
54
+
55
+ Just write Markdown (Kramdown-flavored) as you usually would anywhere under `pages/`, and use `inkblot build` to build the site to `_build/`.
@@ -0,0 +1,14 @@
1
+ ---
2
+ id: install
3
+ title: Installation
4
+ ---
5
+
6
+ # Installation
7
+
8
+ Install Inkblot from RubyGems:
9
+
10
+ ~~~ sh
11
+ gem install inkblot
12
+ ~~~
13
+
14
+ And move on to getting started.
@@ -0,0 +1,8 @@
1
+ ---
2
+ id: tailwind
3
+ title: TailwindCSS
4
+ ---
5
+
6
+ # TailwindCSS
7
+
8
+ Inkblot comes with prebuilt Tailwind-based styles for its own UI, but if you want to style your own content as well, you can add a `tailwind.css` file, which will be automatically picked up and automatically built.
data/docs/pages/index.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ---
2
+ id: index
2
3
  title: Home
3
4
  ---
4
5
 
5
- # Home
6
+ # Inkblot
7
+ Inkblot is a simple static documentation generator designed for minimal configuration, based on [Phlexite](https://phlexite.farthergate.com).
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: Test
3
+ section: Hello World
4
+ ---
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: Test 2
3
+ section: Hello World
4
+ ---
data/lib/inkblot/cli.rb CHANGED
@@ -8,11 +8,12 @@ require "psych"
8
8
  require "fileutils"
9
9
  require "rouge"
10
10
 
11
+ require_relative "pages"
11
12
  require_relative "markdown_page"
12
13
 
13
14
  module Inkblot
14
15
  class << self
15
- attr_accessor :config
16
+ attr_accessor :config, :navigation
16
17
  end
17
18
 
18
19
  class Cli < Phlexite::Cli::Cli
@@ -20,44 +21,50 @@ module Inkblot
20
21
  def init(path = ".")
21
22
  FileUtils.mkdir_p path
22
23
  write_tmpl(path, ".gitignore", "_build")
23
- write_tmpl(path, "tailwind.css", "@import 'tailwindcss';\n@plugin '@tailwindcss/typography';")
24
+
25
+ write_tmpl(path, "inkblot.yml", Psych.dump({
26
+ "title" => "Documentation",
27
+ "nav" => [
28
+ { "Documentation": ["index"] }
29
+ ]
30
+ }))
24
31
 
25
32
  FileUtils.mkdir_p File.join(path, "pages")
26
- write_tmpl(path, "pages/index.md", '---\ntitle: Home\n---\n\n# Home')
33
+ write_tmpl(path, "pages/index.md", "---\nid: index\ntitle: Home\n---\n\n# Home")
27
34
  end
28
35
 
29
36
  def build
30
- Phlexite::Site.new do |s|
31
- puts "\e[1m==> Building site"
32
-
33
- Inkblot.config = Psych.load_file "inkblot.yml" if File.file? "inkblot.yml"
34
-
35
- Inkblot.config ||= {
36
- "title" => "Documentation",
37
- "nav" => {
38
- "Home" => {
39
- "Home" => "/"
40
- }
37
+ spin do
38
+ Phlexite::Site.new do |s|
39
+ Inkblot.config = Psych.load_file "inkblot.yml" if File.file? "inkblot.yml"
40
+
41
+ Inkblot.config ||= {
42
+ "title" => "Documentation",
43
+ "nav" => [
44
+ { "Documentation": ["index"] }
45
+ ]
41
46
  }
42
- }
43
47
 
44
- Tailwindcss::Phlexite.build s, "tailwind.css", "tailwind.css" if File.file? "tailwind.css"
48
+ Inkblot.navigation = Inkblot.config["nav"] || {}
45
49
 
46
- s.mount "assets", on: "/" if File.file? "assets"
50
+ content = Phlexite::Content::Collection.new("pages/**/*.md", Inkblot::MarkdownPage, prefix: "pages")
51
+ Pages.populate content
52
+ content.build(s)
47
53
 
48
- s.page "syntax.css", proc {
49
- Rouge::Themes::Base16.make_dark!
50
- Rouge::Themes::Base16.style(Rouge::Token::Tokens::Text, bg: "#00000000")
51
- Rouge::Themes::Base16.new(scope: "pre > code").render
52
- }
54
+ Tailwindcss::Phlexite.build s, "tailwind.css", "tailwind.css" if File.file? "tailwind.css"
53
55
 
54
- s.page "inkblot.min.css", proc {
55
- File.read(File.join(File.expand_path(File.dirname(File.dirname(__FILE__))), "inkblot.min.css"))
56
- }
56
+ s.mount "assets", on: "/" if File.file? "assets"
57
57
 
58
- Phlexite::Content::Collection.new("pages/**/*.md", Inkblot::MarkdownPage, prefix: "pages").build(s)
58
+ s.page "syntax.css", proc {
59
+ Rouge::Themes::Base16.make_dark!
60
+ Rouge::Themes::Base16.style(Rouge::Token::Tokens::Text, bg: "#00000000")
61
+ Rouge::Themes::Base16.new(scope: "pre > code").render
62
+ }
59
63
 
60
- puts "\e[1m==> Build finished"
64
+ s.page "inkblot.min.css", proc {
65
+ File.read(File.join(File.expand_path(File.dirname(File.dirname(__FILE__))), "inkblot.min.css"))
66
+ }
67
+ end
61
68
  end
62
69
  end
63
70
 
@@ -4,8 +4,9 @@ require "phlex"
4
4
 
5
5
  module Inkblot
6
6
  class Layout < ::Phlex::HTML
7
- def initialize(title)
7
+ def initialize(title, id)
8
8
  @title = title
9
+ @id = id
9
10
  end
10
11
 
11
12
  def nav_link(url, klass = "", &block)
@@ -14,7 +15,7 @@ module Inkblot
14
15
  end
15
16
  end
16
17
 
17
- def pages = Inkblot.config["nav"] || {}
18
+ def pages = Inkblot.navigation || {}
18
19
  def nav_end = Inkblot.config["nav-end"] || {}
19
20
 
20
21
  def view_template(&block)
@@ -34,10 +35,14 @@ module Inkblot
34
35
  aside(class: "p-5 min-w-[15%] border-r border-gray-200 bg-gray-100 dark:bg-[#131314] dark:border-stone-700 fixed top-0 left-0 h-screen") do
35
36
  nav(style: "display: flex; flex-direction: column; justify-content: space-between; height: 100%;") do
36
37
  ul do
37
- pages.each do |section, pgs|
38
- li(class: "font-bold text-gray-500 dark:text-gray-400 py-2 text-sm") { section }
39
- pgs.each do |title, path|
40
- nav_link(path, @title == title ? "text-gray-900" : "") { title }
38
+ pages.each do |section|
39
+ li(class: "font-bold text-gray-500 dark:text-gray-400 py-2 text-sm") { section.keys[0] }
40
+ section.values[0].each do |page|
41
+ title = Pages.pages[page][:fm]["title"]
42
+ cur_page = (@id ? @id == page : @title == title)
43
+ nav_link(Pages.pages[page][:out], cur_page ? "text-gray-900" : "") do
44
+ Pages.pages[page][:fm]["title"]
45
+ end
41
46
  end
42
47
  end
43
48
  end
@@ -4,11 +4,10 @@ require "kramdown"
4
4
  require_relative "layout"
5
5
 
6
6
  module Inkblot
7
+ ###
7
8
  class MarkdownPage < ::Phlex::HTML
8
- def initialize; end
9
-
10
9
  def view_template
11
- render Layout.new(@front_matter["title"]) do
10
+ render Layout.new(@front_matter["title"], @front_matter["id"]) do
12
11
  div(class: "prose dark:prose-invert mx-auto pb-10") do
13
12
  raw safe Kramdown::Document.new(@content, { syntax_highlighter: :rouge }).to_html
14
13
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Inkblot
4
+ ###
5
+ module Pages
6
+ class << self
7
+ attr_accessor :pages
8
+
9
+ def populate(content)
10
+ self.pages = {}
11
+ content.entries.each do |f|
12
+ fm = f.read.front_matter
13
+ pages[fm["id"] || f.out_path] = {
14
+ fm: fm,
15
+ out: f.out_path
16
+ }
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Inkblot
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/tailwind.css ADDED
@@ -0,0 +1,2 @@
1
+ @import "tailwindcss" source("./lib");
2
+ @plugin '@tailwindcss/typography';
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inkblot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleks Rutins
@@ -114,23 +114,31 @@ executables:
114
114
  extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
+ - ".build.yml"
117
118
  - ".rspec"
119
+ - ".rspec_status"
118
120
  - ".rubocop.yml"
119
121
  - LICENSE.txt
120
122
  - README.md
121
123
  - Rakefile
122
124
  - docs/.gitignore
123
125
  - docs/inkblot.yml
126
+ - docs/pages/docs/getting-started.md
127
+ - docs/pages/docs/install.md
128
+ - docs/pages/docs/tailwind.md
124
129
  - docs/pages/index.md
125
- - docs/tailwind.css
130
+ - docs/pages/test.md
131
+ - docs/pages/test2.md
126
132
  - exe/inkblot
127
133
  - lib/inkblot.min.css
128
134
  - lib/inkblot.rb
129
135
  - lib/inkblot/cli.rb
130
136
  - lib/inkblot/layout.rb
131
137
  - lib/inkblot/markdown_page.rb
138
+ - lib/inkblot/pages.rb
132
139
  - lib/inkblot/version.rb
133
140
  - sig/inkblot.rbs
141
+ - tailwind.css
134
142
  homepage: https://inkblot.farthergate.com
135
143
  licenses:
136
144
  - MIT
@@ -152,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
160
  - !ruby/object:Gem::Version
153
161
  version: '0'
154
162
  requirements: []
155
- rubygems_version: 3.6.9
163
+ rubygems_version: 4.0.3
156
164
  specification_version: 4
157
165
  summary: A documentation generator for Phlexite
158
166
  test_files: []
data/docs/tailwind.css DELETED
@@ -1,2 +0,0 @@
1
- @import "tailwindcss";
2
- @plugin "@tailwindcss/typography";