asciidoctor-git-include 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/asciidoctor-git-include.rb +27 -0
  3. metadata +72 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e7d8c1b4ad1989815ac1c7d48b5eb38266804cdcae48aeeabc88fba0aaa57995
4
+ data.tar.gz: 3facff4687ba1987ea71b12d24f25d0586b969604fea0a5b986b91fa488ada72
5
+ SHA512:
6
+ metadata.gz: bce9989f570a271db90ebdb8914754589f24a79b333e6bceaa96818f68f4921db05dfd8b71cb1a976a14889784c30101d91bb8fb6de7a59d82de44b930248cdc
7
+ data.tar.gz: 3dc70bd01f12c4d9a5864ee5911619721664be8e5fa380ccd1fde282411a529bc015b7a50c519306ac6e3ee39e4cc920925150b50b55537ebfeccff1beaff4cc
@@ -0,0 +1,27 @@
1
+ require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal'
2
+
3
+ include ::Asciidoctor
4
+
5
+ class GitIncludeMacro < Asciidoctor::Extensions::IncludeProcessor
6
+ use_dsl
7
+
8
+ def handles? target
9
+ (target.start_with? 'git@')
10
+ end
11
+
12
+ def process doc, reader, target, attributes
13
+ target.slice! "git@"
14
+ repository = attributes.fetch('repository', '.')
15
+ revision = attributes.fetch('revision', 'HEAD')
16
+
17
+ cmd = %(git -C #{repository} show #{revision}:#{target})
18
+ content = %x(#{cmd})
19
+
20
+ reader.push_include content, target, target, 1, attributes
21
+ reader
22
+ end
23
+ end
24
+
25
+ Asciidoctor::Extensions.register do
26
+ include_processor GitIncludeMacro
27
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: asciidoctor-git-include
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jakub Zalas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-05-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: asciidoctor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.12'
41
+ description: Asciidoctor extension for including files from Git repositories
42
+ email:
43
+ - jakub@zalas.pl
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - lib/asciidoctor-git-include.rb
49
+ homepage: https://github.com/jakzal/asciidoctor-git-include
50
+ licenses:
51
+ - MIT
52
+ metadata: {}
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubygems_version: 3.4.10
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: Fetch files from Git repositories while rendering asciidoc files.
72
+ test_files: []