bhook 0.1.6 → 0.2.2

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: 17b89ce589acd0d94792144dd145e2470612ebdd7ea566cba91e4174e9bc414c
4
- data.tar.gz: d819bec1768b629f94ef192f9053e35df93a9c966246d50c85dc3684bc4fa543
3
+ metadata.gz: 3fbf30bb96c81aaa4b89f0709d42b878c1a53a0c87fed519d42796f15502adcc
4
+ data.tar.gz: f191aa122210048ce00af81de973a5adce5821a84851e774fcc864a89a300d08
5
5
  SHA512:
6
- metadata.gz: b4c46ca4fd8820d9898bf5cefe79c8fd82bff9f2aebfa9aba41f75c1920d898441624be2740c528b357f1548e537f1651dc737df26a7f9c888278aa2aff91e79
7
- data.tar.gz: 9b8fbcfec88fc338ab13ec03cafe6cbe73752ed3b3cae23cb4f98117f0f8913756743e3d930f62d91d5b3c0ff71e3cbe864f99fab0db110539ecbcba9f767213
6
+ metadata.gz: 01afd14cbb7f1e607b8306399cbad5e3a1de627be32923c5107868e3c06fce031266c6222f4bcf466cd3a19fd2c8ceb9c5a52a7e4ab535abd287a8fb1b5dcc98
7
+ data.tar.gz: 208dd8b71184dff3c7ebcc1d16c5f631c03a725166ec9dc532ce06a1a59a0705804480ad322a4547276c31a8e0ac2fcda54cc6968c04a4b70ab4c796d25ec599
data/.rubocop.yml CHANGED
@@ -4,3 +4,32 @@ require:
4
4
 
5
5
  AllCops:
6
6
  NewCops: enable
7
+
8
+ Style/AccessorGrouping:
9
+ Enabled: false
10
+
11
+ Style/Documentation:
12
+ Enabled: false
13
+
14
+ Naming/MethodParameterName:
15
+ Enabled: false
16
+
17
+ RSpec/MessageSpies:
18
+ Enabled: false
19
+
20
+ RSpec/MultipleExpectations:
21
+ Exclude:
22
+ - spec/bhook/theme_generator_spec.rb
23
+
24
+ Metrics/MethodLength:
25
+ Exclude:
26
+ - lib/bhook/args_parser.rb
27
+
28
+ Metrics/BlockLength:
29
+ Exclude:
30
+ - lib/bhook/args_parser.rb
31
+
32
+ Metrics/AbcSize:
33
+ Exclude:
34
+ - lib/bhook/args_parser.rb
35
+
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bhook (0.1.6)
4
+ bhook (0.2.2)
5
5
  git (~> 1.10)
6
6
  kramdown (~> 2.3)
7
7
  listen (~> 3.7)
@@ -14,15 +14,15 @@ GEM
14
14
  diff-lcs (1.5.0)
15
15
  docile (1.4.0)
16
16
  ffi (1.15.5)
17
- git (1.10.2)
17
+ git (1.11.0)
18
18
  rchardet (~> 1.8)
19
- kramdown (2.3.2)
19
+ kramdown (2.4.0)
20
20
  rexml
21
21
  listen (3.7.1)
22
22
  rb-fsevent (~> 0.10, >= 0.10.3)
23
23
  rb-inotify (~> 0.9, >= 0.9.10)
24
- parallel (1.21.0)
25
- parser (3.1.1.0)
24
+ parallel (1.22.1)
25
+ parser (3.1.2.0)
26
26
  ast (~> 2.4.1)
27
27
  rainbow (3.1.1)
28
28
  rake (13.0.6)
@@ -30,7 +30,7 @@ GEM
30
30
  rb-inotify (0.10.1)
31
31
  ffi (~> 1.0)
32
32
  rchardet (1.8.0)
33
- regexp_parser (2.2.1)
33
+ regexp_parser (2.5.0)
34
34
  rexml (3.2.5)
35
35
  rspec (3.11.0)
36
36
  rspec-core (~> 3.11.0)
@@ -41,36 +41,39 @@ GEM
41
41
  rspec-expectations (3.11.0)
42
42
  diff-lcs (>= 1.2.0, < 2.0)
43
43
  rspec-support (~> 3.11.0)
44
- rspec-mocks (3.11.0)
44
+ rspec-mocks (3.11.1)
45
45
  diff-lcs (>= 1.2.0, < 2.0)
46
46
  rspec-support (~> 3.11.0)
47
47
  rspec-support (3.11.0)
48
- rubocop (1.26.0)
48
+ rubocop (1.30.0)
49
49
  parallel (~> 1.10)
50
50
  parser (>= 3.1.0.0)
51
51
  rainbow (>= 2.2.2, < 4.0)
52
52
  regexp_parser (>= 1.8, < 3.0)
53
- rexml
54
- rubocop-ast (>= 1.16.0, < 2.0)
53
+ rexml (>= 3.2.5, < 4.0)
54
+ rubocop-ast (>= 1.18.0, < 2.0)
55
55
  ruby-progressbar (~> 1.7)
56
56
  unicode-display_width (>= 1.4.0, < 3.0)
57
- rubocop-ast (1.16.0)
57
+ rubocop-ast (1.18.0)
58
58
  parser (>= 3.1.1.0)
59
59
  rubocop-rake (0.6.0)
60
60
  rubocop (~> 1.0)
61
- rubocop-rspec (2.9.0)
61
+ rubocop-rspec (2.11.1)
62
62
  rubocop (~> 1.19)
63
63
  ruby-progressbar (1.11.0)
64
64
  simplecov (0.21.2)
65
65
  docile (~> 1.1)
66
66
  simplecov-html (~> 0.11)
67
67
  simplecov_json_formatter (~> 0.1)
68
+ simplecov-cobertura (2.1.0)
69
+ rexml
70
+ simplecov (~> 0.19)
68
71
  simplecov-html (0.12.3)
69
72
  simplecov_json_formatter (0.1.4)
70
- sorbet (0.5.9775)
71
- sorbet-static (= 0.5.9775)
72
- sorbet-runtime (0.5.9775)
73
- sorbet-static (0.5.9775-universal-darwin-21)
73
+ sorbet (0.5.10042)
74
+ sorbet-static (= 0.5.10042)
75
+ sorbet-runtime (0.5.10042)
76
+ sorbet-static (0.5.10042-universal-darwin-21)
74
77
  unicode-display_width (2.1.0)
75
78
 
76
79
  PLATFORMS
@@ -84,6 +87,7 @@ DEPENDENCIES
84
87
  rubocop-rake (~> 0.6)
85
88
  rubocop-rspec (~> 2.8)
86
89
  simplecov (~> 0.21)
90
+ simplecov-cobertura (~> 2.1.0)
87
91
  sorbet (~> 0.5)
88
92
 
89
93
  BUNDLED WITH
data/README.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Bhook
2
2
 
3
+ [![Build Status](https://gitlab.com/kaiwren/bhook/badges/main/pipeline.svg)](https://gitlab.com/kaiwren/bhook/commits/main)
4
+ [![Coverage Report](https://gitlab.com/kaiwren/bhook/badges/main/coverage.svg)](https://gitlab.com/kaiwren/bhook/commits/main)
5
+ [![Gem Version](https://badge.fury.io/rb/bhook.svg)](https://rubygems.org/gems/bhook)
6
+ [![Downloads](http://ruby-gem-downloads-badge.herokuapp.com/bhook?type=total)](https://rubygems.org/gems/bhook)
7
+
8
+
9
+
3
10
  Bhook is a static website generator that works off a git repo containing a markdown file based wiki, like for example, the [India Startup Wiki](https://gitlab.com/india-startups/wiki).
4
11
 
5
12
  I use this to create [HTML versions of the wiki](https://sidu.in/wiki/startups) and of [my essays](https://sidu.in/essays/) that I can publish.
@@ -15,7 +22,7 @@ Install it yourself as:
15
22
  Getting help:
16
23
 
17
24
  $ bhook --help
18
- Bhook version 0.1.4
25
+ Bhook version 0.2.0
19
26
  Usage: bhook --source /source/path --output /output/path
20
27
  -s, --source=SOURCE Path to version controlled directory containing source md files
21
28
  -o, --output=OUTPUT Path to directory where output files are to be generated
@@ -30,6 +37,8 @@ How I use it:
30
37
 
31
38
  ➜ essays git:(main) ✗ bhook -s . -o /tmp/out -t /tmp/out/theme -w -v
32
39
 
40
+ Here's an example `.bhook.yml` [config file](https://gitlab.com/india-startups/wiki/-/blob/master/.bhook.yml).
41
+
33
42
  ## Development
34
43
 
35
44
  1. `git clone --recursive git@gitlab.com:kaiwren/bhook.git`
data/Rakefile CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
5
6
 
7
+ RuboCop::RakeTask.new
6
8
  RSpec::Core::RakeTask.new(:spec)
7
9
 
8
10
  desc 'Run Sorbet Typechecker'
@@ -10,15 +12,23 @@ task :sorbet do
10
12
  sh('bundle exec srb tc')
11
13
  end
12
14
 
13
- cops = %w[
15
+ basic_style_cops = %w[
14
16
  Layout/TrailingWhitespace
15
17
  Layout/SpaceInsideBlockBraces
16
18
  Style/StringLiterals
17
19
  ]
18
20
 
19
- desc "Apply #{cops.join(', ')}"
20
- task :lint_with_autocorrect do
21
- sh("bundle exec rubocop -a --only #{cops.join(',')}")
21
+ desc "Apply #{basic_style_cops.join(', ')}"
22
+ task :autocorrect_basic_style_issues do
23
+ sh("bundle exec rubocop -a --only #{basic_style_cops.join(',')}")
22
24
  end
23
25
 
24
- task default: %i[lint_with_autocorrect sorbet spec]
26
+ namespace :ci do
27
+ desc 'Tasks to run in Gitlab CI build stage'
28
+ task build: %i[sorbet rubocop]
29
+
30
+ desc 'Tasks to run in Gitlab CI spec stage'
31
+ task spec: %i[spec]
32
+ end
33
+
34
+ task default: %i[autocorrect_basic_style_issues rubocop sorbet spec]
@@ -16,10 +16,8 @@ module Bhook
16
16
  def parse
17
17
  begin
18
18
  @opt_parser.parse(@argv)
19
- if generate_theme_missing? && help_missing?
20
- if source_or_output_paths_missing?
21
- raise OptionParser::MissingArgument.new('See --help.')
22
- end
19
+ if generate_theme_missing? && help_missing? && source_or_output_paths_missing?
20
+ raise OptionParser::MissingArgument, 'See --help.'
23
21
  end
24
22
  rescue OptionParser::ParseError => e
25
23
  puts "\nError! #{e.message}\n"
@@ -91,7 +89,7 @@ module Bhook
91
89
  @args.benchmark = true
92
90
  end
93
91
 
94
- opts.on('-h', '--help', FalseClass, 'Prints this help') do |help|
92
+ opts.on('-h', '--help', FalseClass, 'Prints this help') do |_help|
95
93
  @args.help = true
96
94
  end
97
95
  end
data/lib/bhook/config.rb CHANGED
@@ -2,29 +2,58 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Bhook
5
+ #
6
+ # Valid keys:
7
+ # - website
8
+ # - link to place in the footer
9
+ # - exclude
10
+ # - list of .md file paths relative to config files
5
11
  class Config
6
12
  extend T::Sig
7
- BHOOK_CONFIG_FILE = T.let('.bhook', String)
13
+ BHOOK_CONFIG_FILE = T.let('.bhook.yml', String)
8
14
  WEBSITE_KEY = T.let('website', String)
15
+ EXCLUDE_KEY = T.let('exclude', String)
9
16
 
10
17
  sig { params(root_dir_path: Pathname, additional_options: T::Hash[String, String]).void }
11
18
  def initialize(root_dir_path, additional_options = {})
12
19
  config_file_path = root_dir_path.join(BHOOK_CONFIG_FILE)
13
- config = if File.exist?(config_file_path)
14
- YAML.load(File.read(config_file_path))
15
- else
16
- {}.merge(additional_options)
17
- end
20
+ config = load_config(config_file_path).merge(additional_options)
18
21
  @root_dir_path = root_dir_path
19
22
  @website_url = T.let(config[WEBSITE_KEY], T.nilable(String))
23
+ @excluded_files = T.let(parse_excluded_files(config[EXCLUDE_KEY] || []), T::Array[Pathname])
20
24
  end
21
25
 
22
26
  sig { params(src_file_path: Pathname, src_file_sha: T.nilable(String)).returns(T.nilable(String)) }
23
27
  def website_url_for(src_file_path, src_file_sha)
24
- if @website_url && src_file_sha
25
- relative_file_path = src_file_path.relative_path_from(@root_dir_path)
26
- File.join(@website_url, src_file_sha, relative_file_path)
28
+ return unless @website_url && src_file_sha
29
+
30
+ relative_file_path = src_file_path.relative_path_from(@root_dir_path)
31
+ File.join(@website_url, src_file_sha, relative_file_path)
32
+ end
33
+
34
+ sig { params(pathname: Pathname).returns(T::Boolean) }
35
+ def excluded?(pathname)
36
+ @excluded_files.include?(pathname)
37
+ end
38
+
39
+ private
40
+
41
+ sig { params(excluded_files: T::Array[String]).returns(T::Array[Pathname]) }
42
+ def parse_excluded_files(excluded_files)
43
+ excluded_files.map { |file_path| @root_dir_path.join(file_path) }
44
+ end
45
+
46
+ sig do
47
+ params(config_file_path: Pathname).returns(T::Hash[String, T.untyped])
48
+ end
49
+ def load_config(config_file_path)
50
+ if File.exist?(config_file_path)
51
+ L.debug("Config found: #{config_file_path}")
52
+ YAML.safe_load(File.read(config_file_path))
53
+ else
54
+ L.debug("Config not found: #{config_file_path}")
55
+ {}
27
56
  end
28
57
  end
29
58
  end
30
- end
59
+ end
@@ -24,23 +24,28 @@ module Bhook
24
24
 
25
25
  sig { params(el: Kramdown::Element, indent: Integer).returns(String) }
26
26
  def convert_header(el, indent)
27
- header = super(el, indent)
28
- after_h1_strategy = @options[:after_h1_strategy]
29
- h1_callback = @options[:h1_callback]
30
27
  src_title = el.options[:raw_text]
31
- after_h1_html = after_h1_strategy.call(binding)
28
+ after_h1_html = @options[:after_h1_strategy].call(binding)
32
29
 
33
30
  level = output_header_level(el.options[:level])
34
31
  if level == 1
35
- h1_callback.call(src_title)
36
- "#{header}#{' ' * indent}#{after_h1_html}"
32
+ @options[:h1_callback].call(src_title)
33
+ "#{super(el, indent)}#{' ' * indent}#{after_h1_html}"
37
34
  else
38
- header
35
+ insert_anchor_into_header!(el)
36
+ super(el, indent)
39
37
  end
40
38
  end
41
39
 
42
40
  private
43
41
 
42
+ sig { params(el: Kramdown::Element).void }
43
+ def insert_anchor_into_header!(el)
44
+ el.attr['id'] = generate_id(el.options[:raw_text]) if @options[:auto_ids] && !el.attr['id']
45
+ anchor = Kramdown::Element.new(:a, '', { 'href' => "##{el.attr['id']}", 'class' => 'header-anchor' })
46
+ el.children << anchor
47
+ end
48
+
44
49
  sig { params(href_path: String).returns(T::Boolean) }
45
50
  def valid_relative_md_link?(href_path)
46
51
  (href_path.end_with?('.md') || href_path.include?('.md#')) &&
@@ -10,10 +10,9 @@ module Bhook
10
10
 
11
11
  sig { params(src_path: Pathname, out_path: Pathname).returns(Bhook::Directory) }
12
12
  def self.new_root_directory(src_path, out_path)
13
- self.new(src_path, out_path, Git.open(src_path), Bhook::Config.new(src_path))
13
+ new(src_path, out_path, Git.open(src_path), Bhook::Config.new(src_path))
14
14
  end
15
15
 
16
-
17
16
  sig { params(src_path: Pathname, out_path: Pathname, git: Git::Base, config: Bhook::Config).void }
18
17
  def initialize(src_path, out_path, git, config)
19
18
  @src_path = src_path
@@ -32,9 +31,7 @@ module Bhook
32
31
  @sub_dirs.each { |dir| dir.write!(theme) }
33
32
  @md_files.map do |file|
34
33
  Thread.new { file.write!(theme) }
35
- end.each do |thread|
36
- thread.join
37
- end
34
+ end.each(&:join)
38
35
  end
39
36
 
40
37
  sig { returns(T::Array[MdFile]) }
@@ -53,12 +50,16 @@ module Bhook
53
50
  def build_next_level_nodes
54
51
  children = @src_path.children
55
52
  children.delete(@src_path.join(GIT_DIR))
53
+ build_nodes(children)
54
+ end
56
55
 
56
+ sig { params(children: T::Array[Pathname]).void }
57
+ def build_nodes(children)
57
58
  file_threads = []
58
59
  children.each do |child_path|
59
60
  if child_path.directory?
60
61
  @sub_dirs << Directory.new(child_path, @out_path, @git, @config)
61
- elsif child_path.extname == MD_EXT
62
+ elsif child_path.extname == MD_EXT && !@config.excluded?(child_path)
62
63
  file_threads << Thread.new { MdFile.new(child_path, @out_path, @git, @config) }
63
64
  end
64
65
  end
data/lib/bhook/logger.rb CHANGED
@@ -2,8 +2,8 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Bhook
5
- LOG_FORMATTER = proc { |severity, datetime, progname, msg|
5
+ LOG_FORMATTER = proc { |_severity, _datetime, _progname, msg|
6
6
  "#{Thread.current.object_id} #{msg}\n"
7
7
  }
8
- L = Logger.new(STDOUT, formatter: LOG_FORMATTER)
8
+ L = Logger.new($stdout, formatter: LOG_FORMATTER)
9
9
  end
data/lib/bhook/md_file.rb CHANGED
@@ -25,12 +25,8 @@ module Bhook
25
25
  @out_path = out_path
26
26
  @git = git
27
27
  @config = config
28
-
29
- file_date, file_sha = load_git_file_metadata
30
- @src_file_date = T.let(file_date, T.nilable(String))
31
- @src_file_sha = T.let(file_sha, T.nilable(String))
32
28
  @out_file_path = T.let(@out_path.join(out_file_name), Pathname)
33
- @src_file_url = T.let(file_url, T.nilable(String))
29
+ initialize_file_details
34
30
  end
35
31
 
36
32
  sig { params(theme: Bhook::Theme).void }
@@ -43,6 +39,7 @@ module Bhook
43
39
  end
44
40
 
45
41
  private
42
+
46
43
  sig { returns(Pathname) }
47
44
  def out_file_name
48
45
  @src_file_path.basename.sub(/\.md$/, '.html')
@@ -62,5 +59,13 @@ module Bhook
62
59
  '--',
63
60
  @src_file_path).split('|')
64
61
  end
62
+
63
+ sig { void }
64
+ def initialize_file_details
65
+ file_date, file_sha = load_git_file_metadata
66
+ @src_file_date = T.let(file_date, T.nilable(String))
67
+ @src_file_sha = T.let(file_sha, T.nilable(String))
68
+ @src_file_url = T.let(file_url, T.nilable(String))
69
+ end
65
70
  end
66
71
  end
@@ -1,82 +1,108 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
8
- <link href='https://fonts.googleapis.com/css?family=Fira+Sans' rel='stylesheet' type='text/css'>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
7
+ <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
8
+ <link href='https://fonts.googleapis.com/css?family=Fira+Sans' rel='stylesheet' type='text/css'>
9
9
 
10
- <!-- Bootstrap -->
11
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
12
- <style>
13
- body {
14
- font-family: 'Fira Sans', sans-serif;
15
- color: #000000;
16
- }
17
-
18
- h2, h5 {
19
- margin-bottom: 0.5em;
20
- }
21
-
22
- .after-h1 {
23
- border-bottom: 1px solid #bbbbbb;
24
- margin-bottom: 1.5em;
25
- }
26
-
27
- .footer {
28
- margin: 0.5em 0 1.5em 0;
29
- }
30
-
31
- table {
32
- margin: 0.5em 0 0.5em 0.5em;
33
- }
34
-
35
- table thead tr {
36
- background: #eeeeee;
37
- }
38
-
39
- table td, table th {
40
- padding: 0.1em 1em 0.1em 1em;
41
- border: 1px solid #bbbbbb;
42
- }
10
+ <!-- Bootstrap -->
11
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
12
+ <style>
13
+ body {
14
+ font-family: 'Fira Sans', sans-serif;
15
+ color: #000000;
16
+ }
43
17
 
44
- blockquote {
18
+ h2, h3, h4, h5 {
19
+ margin-bottom: 0.5em;
20
+ margin-top: 0.5em;
21
+ }
22
+
23
+ h2 {
24
+ border-bottom: 1px solid #eaeaea;
25
+ }
26
+
27
+ h2 a.header-anchor, h3 a.header-anchor,
28
+ h4 a.header-anchor, h5 a.header-anchor {
29
+ float: left;
30
+ margin-left: -20px;
31
+ text-decoration: none;
32
+ outline: none;
33
+ position: relative;
34
+ }
35
+
36
+ h2 a.header-anchor:after, h3 a.header-anchor:after,
37
+ h4 a.header-anchor:after, h5 a.header-anchor:after {
38
+ content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23333' fill-rule='evenodd' d='M9.683 6.676l-.047-.048C8.27 5.26 6.07 5.243 4.726 6.588l-2.29 2.29c-1.344 1.344-1.328 3.544.04 4.91 1.366 1.368 3.564 1.385 4.908.04l1.753-1.752c-.695.074-1.457-.078-2.176-.444L5.934 12.66c-.634.634-1.67.625-2.312-.017-.642-.643-.65-1.677-.017-2.312L6.035 7.9c.634-.634 1.67-.625 2.312.017.024.024.048.05.07.075l.003-.002c.36.36.943.366 1.3.01.355-.356.35-.938-.01-1.3l-.027-.024zM6.58 9.586l.048.05c1.367 1.366 3.565 1.384 4.91.04l2.29-2.292c1.344-1.343 1.328-3.542-.04-4.91-1.366-1.366-3.564-1.384-4.908-.04L7.127 4.187c.695-.074 1.457.078 2.176.444l1.028-1.027c.635-.634 1.67-.624 2.313.017.643.644.652 1.678.018 2.312l-2.43 2.432c-.635.634-1.67.624-2.313-.018-.024-.024-.048-.05-.07-.075l-.003.004c-.36-.362-.943-.367-1.3-.01-.355.355-.35.937.01 1.3.01.007.018.015.027.023z'/%3E%3C/svg%3E");
39
+ box-sizing: border-box;
40
+ font-size: medium;
41
+ visibility: hidden;
42
+ }
43
+
44
+ h2:hover a.header-anchor:after, h3:hover a.header-anchor:after,
45
+ h4:hover a.header-anchor:after, h5:hover a.header-anchor:after {
46
+ visibility: visible;
47
+ }
48
+
49
+ div.after-h1 {
50
+ border-bottom: 1px solid #bbbbbb;
51
+ margin-bottom: 1.5em;
52
+ }
53
+
54
+ div.footer {
55
+ margin: 0.5em 0 1.5em 0;
56
+ }
57
+
58
+ table {
59
+ margin: 0.5em 0 1em 0.5em;
60
+ }
61
+
62
+ table thead tr {
63
+ background: #eeeeee;
64
+ }
65
+
66
+ table td, table th {
67
+ padding: 0.1em 1em 0.1em 1em;
68
+ border: 1px solid #bbbbbb;
69
+ }
70
+
71
+ blockquote {
45
72
  border-left: 10px solid #cccccc;
46
73
  background: #eeeeee;
47
74
  display: inline-block;
48
75
  padding: 1em;
49
- }
50
- </style>
51
- <!-- Global site tag (gtag.js) - Google Analytics -->
52
- <script async src="https://www.googletagmanager.com/gtag/js?id=G-CT9TWBW0WR"></script>
53
- <script>
54
- window.dataLayer = window.dataLayer || [];
55
- function gtag(){dataLayer.push(arguments);}
56
- gtag('js', new Date());
57
-
58
- gtag('config', 'G-CT9TWBW0WR');
59
- </script>
60
- <title><%= src_title -%></title>
61
- </head>
62
- <body>
63
- <div class="body container">
64
- <div class="content row justify-content-center">
65
- <div class="col-10">
66
- <%= output %>
67
- </div>
68
- </div>
69
- <div class="footer d-flex justify-content-center">
70
- <div>
71
- <% short_sha = src_file_sha ? src_file_sha[0..7] : nil -%>
72
- <% if file_url && short_sha -%>
73
- v. <a href="<%= file_url -%>"><%= short_sha -%></a>,
74
- <% elsif short_sha -%>
75
- v. <%= short_sha -%>,
76
- <% end -%>
77
- <%= src_file_date -%> © <a href="https://sidu.in">Sidu Ponnappa</a>
78
- </div>
79
- </div>
80
- </div>
81
- </body>
76
+ }
77
+ </style>
78
+ <!-- Global site tag (gtag.js) - Google Analytics -->
79
+ <script async src="https://www.googletagmanager.com/gtag/js?id=G-CT9TWBW0WR"></script>
80
+ <script>
81
+ window.dataLayer = window.dataLayer || [];
82
+ function gtag() { dataLayer.push(arguments); }
83
+ gtag('js', new Date());
84
+ gtag('config', 'G-CT9TWBW0WR');
85
+ </script>
86
+ <title><%= src_title -%></title>
87
+ </head>
88
+ <body>
89
+ <div class="body container">
90
+ <div class="content row justify-content-center">
91
+ <div class="col-10">
92
+ <%= output %>
93
+ </div>
94
+ </div>
95
+ <div class="footer d-flex justify-content-center">
96
+ <div>
97
+ <% short_sha = src_file_sha ? src_file_sha[0..7] : nil -%>
98
+ <% if file_url && short_sha -%>
99
+ v. <a href="<%= file_url -%>"><%= short_sha -%></a>,
100
+ <% elsif short_sha -%>
101
+ v. <%= short_sha -%>,
102
+ <% end -%>
103
+ <%= src_file_date -%> © <a href="https://sidu.in">Sidu Ponnappa</a>
104
+ </div>
105
+ </div>
106
+ </div>
107
+ </body>
82
108
  </html>
data/lib/bhook/theme.rb CHANGED
@@ -13,8 +13,10 @@ module Bhook
13
13
  @after_h1_strategy = T.let(strategy, T.proc.params(binding_instance: Binding).returns(String))
14
14
  end
15
15
 
16
- sig { params(md: String, src_file_sha: T.nilable(String),
17
- src_file_date: T.nilable(String), file_url: T.nilable(String)).returns(String) }
16
+ sig do
17
+ params(md: String, src_file_sha: T.nilable(String),
18
+ src_file_date: T.nilable(String), file_url: T.nilable(String)).returns(String)
19
+ end
18
20
  def render_page(md, src_file_sha, src_file_date, file_url)
19
21
  src_title = T.let('', String)
20
22
 
@@ -9,7 +9,7 @@ module Bhook
9
9
  def initialize(output_path)
10
10
  @output_path = T.let(File.join(output_path, 'theme'), String)
11
11
  @template_files = T.let([Bhook::PAGE_TEMPLATE_PATH,
12
- Bhook::AFTER_H1_TEMPLATE_PATH], T::Array[String])
12
+ Bhook::AFTER_H1_TEMPLATE_PATH], T::Array[String])
13
13
  end
14
14
 
15
15
  sig { void }
data/lib/bhook/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Bhook
5
- VERSION = '0.1.6'
5
+ VERSION = '0.2.2'
6
6
  end
@@ -37,6 +37,7 @@ module Bhook
37
37
  end
38
38
 
39
39
  private
40
+
40
41
  sig { returns(Bhook::Directory) }
41
42
  def root_dir
42
43
  Directory.new_root_directory(@src_path, @out_path)
@@ -7,7 +7,7 @@
7
7
  #
8
8
  # https://github.com/sorbet/sorbet-typed/new/master?filename=lib/bhook/all/bhook.rbi
9
9
  #
10
- # bhook-0.1.4
10
+ # bhook-0.2.0
11
11
 
12
12
  module Bhook
13
13
  extend T::Sig
@@ -7,7 +7,7 @@
7
7
  #
8
8
  # https://github.com/sorbet/sorbet-typed/new/master?filename=lib/git/all/git.rbi
9
9
  #
10
- # git-1.10.2
10
+ # git-1.11.0
11
11
 
12
12
  module Git
13
13
  def config(name = nil, value = nil); end