mirror of
https://github.com/foo-dogsquared/website.git
synced 2025-01-31 01:57:54 +00:00
Add custom Asciidoctor extensions to load path
This commit is contained in:
parent
72cb5f8969
commit
e1f2ea4a1e
4
Gemfile
4
Gemfile
@ -1,2 +1,6 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
gem 'asciidoctor'
|
gem 'asciidoctor'
|
||||||
|
gem 'asciidoctor-html5s'
|
||||||
|
gem 'asciidoctor-rouge'
|
||||||
|
gem 'rouge'
|
||||||
|
gem 'asciidoctor-foodogsquared-extensions', :path => './gems'
|
||||||
|
31
Gemfile.lock
Normal file
31
Gemfile.lock
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
PATH
|
||||||
|
remote: gems
|
||||||
|
specs:
|
||||||
|
asciidoctor-foodogsquared-extensions (1.0.0)
|
||||||
|
asciidoctor (~> 2.0)
|
||||||
|
|
||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
asciidoctor (2.0.18)
|
||||||
|
asciidoctor-html5s (0.5.1)
|
||||||
|
asciidoctor (>= 1.5.7, < 3.0)
|
||||||
|
thread_safe (~> 0.3.4)
|
||||||
|
asciidoctor-rouge (0.4.0)
|
||||||
|
asciidoctor (>= 1.5.6, < 2.1)
|
||||||
|
rouge (>= 2.2, < 4)
|
||||||
|
rouge (3.30.0)
|
||||||
|
thread_safe (0.3.6)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
x86_64-linux
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
asciidoctor
|
||||||
|
asciidoctor-foodogsquared-extensions!
|
||||||
|
asciidoctor-html5s
|
||||||
|
asciidoctor-rouge
|
||||||
|
rouge
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
2.4.6
|
@ -13,6 +13,12 @@ path = "github.com/foo-dogsquared/hugo-theme-more-contentful"
|
|||||||
[[module.imports]]
|
[[module.imports]]
|
||||||
path = "github.com/foo-dogsquared/hugo-mod-web-feeds"
|
path = "github.com/foo-dogsquared/hugo-mod-web-feeds"
|
||||||
|
|
||||||
|
[markup.asciidocExt]
|
||||||
|
extensions = [
|
||||||
|
"asciidoctor-foodogsquared-extensions"
|
||||||
|
]
|
||||||
|
workingFolderCurrent = true
|
||||||
|
|
||||||
[markup.asciidocExt.attributes]
|
[markup.asciidocExt.attributes]
|
||||||
toc = true
|
toc = true
|
||||||
sectanchors = true
|
sectanchors = true
|
||||||
|
103
flake.lock
generated
103
flake.lock
generated
@ -1,5 +1,41 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"bundix": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-utils": "flake-utils_2",
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1673616892,
|
||||||
|
"narHash": "sha256-KDKdesIUpyM6YnGsZMOxN34NhTNCsXvd03qsHNtUdWc=",
|
||||||
|
"owner": "sagittaros",
|
||||||
|
"repo": "bundix",
|
||||||
|
"rev": "4e0d18ad1954bc447540e4f890c3efdf3c53b3a2",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "sagittaros",
|
||||||
|
"repo": "bundix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1668681692,
|
||||||
|
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1676283394,
|
"lastModified": 1676283394,
|
||||||
@ -15,6 +51,21 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-utils_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1667395993,
|
||||||
|
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1676150441,
|
"lastModified": 1676150441,
|
||||||
@ -31,10 +82,60 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1673525234,
|
||||||
|
"narHash": "sha256-fMP37VTeqSzC8JYoQJinLOnHfjriE5uKInLWJRz5K3E=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "92f9580a4c369b4b51a7b6a5e77da43720134c9f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_3": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1674361931,
|
||||||
|
"narHash": "sha256-lUIZItHbW+LmJAz9V9puLq2rHlewcUgg1RPehkQIkzc=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "ef479383e13698c8d5ccf8a608485dc8ce1d4f80",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"ruby-nix": "ruby-nix"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ruby-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"bundix": "bundix",
|
||||||
|
"nixpkgs": "nixpkgs_3"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1676983063,
|
||||||
|
"narHash": "sha256-VvBdc1KnNHD7Q5SKtMAvC9iLV7ferwv6lIACYdmUxas=",
|
||||||
|
"owner": "sagittaros",
|
||||||
|
"repo": "ruby-nix",
|
||||||
|
"rev": "e4a9f70e4f2785ebcfb14891f3017fdb0016fb40",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "sagittaros",
|
||||||
|
"repo": "ruby-nix",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
19
flake.nix
19
flake.nix
@ -4,14 +4,25 @@
|
|||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
ruby-nix.url = "github:sagittaros/ruby-nix";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs@{ self, nixpkgs, ... }:
|
outputs = inputs@{ self, nixpkgs, ... }:
|
||||||
let systems = inputs.flake-utils.lib.defaultSystems;
|
let
|
||||||
|
systems = inputs.flake-utils.lib.defaultSystems;
|
||||||
|
overlays = [ inputs.ruby-nix.overlays.ruby ];
|
||||||
in inputs.flake-utils.lib.eachSystem systems (system:
|
in inputs.flake-utils.lib.eachSystem systems (system:
|
||||||
let pkgs = import nixpkgs { inherit system; };
|
let
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = overlays ++ [
|
||||||
|
(final: prev: {
|
||||||
|
ruby-nix = inputs.ruby-nix.lib prev;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
devShell =
|
devShells.default = import ./shell.nix { inherit pkgs; };
|
||||||
import ./shell.nix { inherit pkgs; };
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
58
gems/.gitignore
vendored
Normal file
58
gems/.gitignore
vendored
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
|
||||||
|
### Ruby ###
|
||||||
|
*.gem
|
||||||
|
*.rbc
|
||||||
|
/.config
|
||||||
|
/coverage/
|
||||||
|
/InstalledFiles
|
||||||
|
/pkg/
|
||||||
|
/spec/reports/
|
||||||
|
/spec/examples.txt
|
||||||
|
/test/tmp/
|
||||||
|
/test/version_tmp/
|
||||||
|
/tmp/
|
||||||
|
|
||||||
|
# Used by dotenv library to load environment variables.
|
||||||
|
# .env
|
||||||
|
|
||||||
|
# Ignore Byebug command history file.
|
||||||
|
.byebug_history
|
||||||
|
|
||||||
|
## Specific to RubyMotion:
|
||||||
|
.dat*
|
||||||
|
.repl_history
|
||||||
|
build/
|
||||||
|
*.bridgesupport
|
||||||
|
build-iPhoneOS/
|
||||||
|
build-iPhoneSimulator/
|
||||||
|
|
||||||
|
## Specific to RubyMotion (use of CocoaPods):
|
||||||
|
#
|
||||||
|
# We recommend against adding the Pods directory to your .gitignore. However
|
||||||
|
# you should judge for yourself, the pros and cons are mentioned at:
|
||||||
|
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||||
|
# vendor/Pods/
|
||||||
|
|
||||||
|
## Documentation cache and generated files:
|
||||||
|
/.yardoc/
|
||||||
|
/_yardoc/
|
||||||
|
/doc/
|
||||||
|
/rdoc/
|
||||||
|
|
||||||
|
## Environment normalization:
|
||||||
|
/.bundle/
|
||||||
|
/vendor/bundle
|
||||||
|
/lib/bundler/man/
|
||||||
|
|
||||||
|
# for a library or gem, you might want to ignore these files since the code is
|
||||||
|
# intended to run in multiple environments; otherwise, check them in:
|
||||||
|
# Gemfile.lock
|
||||||
|
# .ruby-version
|
||||||
|
# .ruby-gemset
|
||||||
|
|
||||||
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
||||||
|
.rvmrc
|
||||||
|
|
||||||
|
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
||||||
|
# .rubocop-https?--*
|
||||||
|
|
19
gems/asciidoctor-foodogsquared-extensions.gemspec
Normal file
19
gems/asciidoctor-foodogsquared-extensions.gemspec
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
Gem::Specification.new do |s|
|
||||||
|
s.name = 'asciidoctor-foodogsquared-extensions'
|
||||||
|
s.version = '1.0.0'
|
||||||
|
s.licenses = ['MIT']
|
||||||
|
s.summary = "foo-dogsquared's custom Asciidoctor extensions"
|
||||||
|
s.description = <<-EOF
|
||||||
|
foo-dogsquared's custom Asciidoctor extensions as a Gem. This is not meant
|
||||||
|
to be used in production or as a public Gem. This is used since Hugo
|
||||||
|
doesn't allow loading Asciidoctor extensions with path separators.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
s.authors = ["Gabriel Arazas"]
|
||||||
|
s.email = "foodogsquared@foodogsquared.one"
|
||||||
|
s.metadata = { "source_code_uri" => "https://github.com/foo-dogsquared/foo-dogsquared.github.io" }
|
||||||
|
|
||||||
|
s.files = Dir["lib/**/*", "*.gemspec"]
|
||||||
|
|
||||||
|
s.add_runtime_dependency 'asciidoctor', '~> 2.0'
|
||||||
|
end
|
2
gems/lib/asciidoctor-foodogsquared-extensions.rb
Normal file
2
gems/lib/asciidoctor-foodogsquared-extensions.rb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
require 'asciidoctor/foodogsquared-extensions'
|
7
gems/lib/asciidoctor/foodogsquared-extensions.rb
Normal file
7
gems/lib/asciidoctor/foodogsquared-extensions.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require 'asciidoctor'
|
||||||
|
require 'asciidoctor/extensions'
|
||||||
|
require_relative 'man-inline-macro/extension'
|
||||||
|
|
||||||
|
Asciidoctor::Extensions.register do
|
||||||
|
inline_macro ManInlineMacro
|
||||||
|
end
|
22
gems/lib/asciidoctor/man-inline-macro/extension.rb
Normal file
22
gems/lib/asciidoctor/man-inline-macro/extension.rb
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
class ManInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
|
||||||
|
use_dsl
|
||||||
|
|
||||||
|
named :man
|
||||||
|
name_positional_attributes 'volnum'
|
||||||
|
|
||||||
|
def process parent, target, attrs
|
||||||
|
doc = parent.document
|
||||||
|
text = manname = target
|
||||||
|
suffix = (volnum = attrs['volnum']) ? %((#{volnum})) : ''
|
||||||
|
if doc.basebackend? 'html'
|
||||||
|
target = %(#{manname}#{doc.outfilesuffix})
|
||||||
|
doc.register :links, target
|
||||||
|
node = create_anchor parent, text, type: :link, target: target
|
||||||
|
elsif doc.backend == 'manpage'
|
||||||
|
node = create_inline parent, :quoted, manname, type: :strong
|
||||||
|
else
|
||||||
|
node = create_inline parent, :quoted, manname
|
||||||
|
end
|
||||||
|
create_inline parent, :quoted, %(#{node.convert}#{suffix})
|
||||||
|
end
|
||||||
|
end
|
76
gemset.nix
Normal file
76
gemset.nix
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
{
|
||||||
|
asciidoctor = {
|
||||||
|
groups = ["default"];
|
||||||
|
platforms = [];
|
||||||
|
source = {
|
||||||
|
remotes = ["https://rubygems.org"];
|
||||||
|
sha256 = "11z3vnd8vh3ny1vx69bjrbck5b2g8zsbj94npyadpn7fdp8y3ldv";
|
||||||
|
target = "ruby";
|
||||||
|
type = "gem";
|
||||||
|
};
|
||||||
|
targets = [];
|
||||||
|
version = "2.0.18";
|
||||||
|
};
|
||||||
|
asciidoctor-foodogsquared-extensions = {
|
||||||
|
dependencies = ["asciidoctor"];
|
||||||
|
groups = ["default"];
|
||||||
|
platforms = [];
|
||||||
|
source = {
|
||||||
|
path = "gems";
|
||||||
|
target = "ruby";
|
||||||
|
type = "path";
|
||||||
|
};
|
||||||
|
targets = [];
|
||||||
|
version = "1.0.0";
|
||||||
|
};
|
||||||
|
asciidoctor-html5s = {
|
||||||
|
dependencies = ["asciidoctor" "thread_safe"];
|
||||||
|
groups = ["default"];
|
||||||
|
platforms = [];
|
||||||
|
source = {
|
||||||
|
remotes = ["https://rubygems.org"];
|
||||||
|
sha256 = "1zfbfcqyrsk8bnd526ang3b4j3m5pbns7x3fdxarrm8vv1qplss1";
|
||||||
|
target = "ruby";
|
||||||
|
type = "gem";
|
||||||
|
};
|
||||||
|
targets = [];
|
||||||
|
version = "0.5.1";
|
||||||
|
};
|
||||||
|
asciidoctor-rouge = {
|
||||||
|
dependencies = ["asciidoctor" "rouge"];
|
||||||
|
groups = ["default"];
|
||||||
|
platforms = [];
|
||||||
|
source = {
|
||||||
|
remotes = ["https://rubygems.org"];
|
||||||
|
sha256 = "197sbzs9km58pgfqdnnglhqr7anhb0m330cv1vxfc3s2qz106zjz";
|
||||||
|
target = "ruby";
|
||||||
|
type = "gem";
|
||||||
|
};
|
||||||
|
targets = [];
|
||||||
|
version = "0.4.0";
|
||||||
|
};
|
||||||
|
rouge = {
|
||||||
|
groups = ["default"];
|
||||||
|
platforms = [];
|
||||||
|
source = {
|
||||||
|
remotes = ["https://rubygems.org"];
|
||||||
|
sha256 = "1dnfkrk8xx2m8r3r9m2p5xcq57viznyc09k7r3i4jbm758i57lx3";
|
||||||
|
target = "ruby";
|
||||||
|
type = "gem";
|
||||||
|
};
|
||||||
|
targets = [];
|
||||||
|
version = "3.30.0";
|
||||||
|
};
|
||||||
|
thread_safe = {
|
||||||
|
groups = ["default"];
|
||||||
|
platforms = [];
|
||||||
|
source = {
|
||||||
|
remotes = ["https://rubygems.org"];
|
||||||
|
sha256 = "0nmhcgq6cgz44srylra07bmaw99f5271l0dpsvl5f75m44l0gmwy";
|
||||||
|
target = "ruby";
|
||||||
|
type = "gem";
|
||||||
|
};
|
||||||
|
targets = [];
|
||||||
|
version = "0.3.6";
|
||||||
|
};
|
||||||
|
}
|
23
shell.nix
23
shell.nix
@ -2,18 +2,33 @@
|
|||||||
|
|
||||||
with pkgs;
|
with pkgs;
|
||||||
|
|
||||||
|
let
|
||||||
|
localGem = ruby-nix {
|
||||||
|
name = "asciidoctor-foodogsquared-extensions";
|
||||||
|
ruby = ruby_3_1;
|
||||||
|
gemset = ./gemset.nix;
|
||||||
|
};
|
||||||
|
in
|
||||||
mkShell {
|
mkShell {
|
||||||
|
buildInputs = [
|
||||||
|
localGem.env
|
||||||
|
localGem.ruby
|
||||||
|
];
|
||||||
|
|
||||||
packages = [
|
packages = [
|
||||||
curl
|
bundix
|
||||||
cacert
|
|
||||||
asciidoctor
|
|
||||||
entr
|
|
||||||
git
|
git
|
||||||
go
|
go
|
||||||
hugo
|
hugo
|
||||||
jq
|
jq
|
||||||
openring
|
openring
|
||||||
gnumake
|
gnumake
|
||||||
|
tree-sitter
|
||||||
|
|
||||||
|
# Formatters...
|
||||||
|
rufo # ...for Ruby.
|
||||||
|
nixpkgs-fmt # ...for Nix.
|
||||||
|
nodePackages.prettier # ...for the web files.
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user