asciidoctor-git-include 1.1.1 → 1.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: 5177a48bd23b29740f870018e5603e8677a76105d0991668d851e3e8a9f36ab1
4
- data.tar.gz: 542dd9ddcae0b7762c5ecb11c5cc9be23d41964bb41033301127b54a61fc885c
3
+ metadata.gz: 33432a5c915af840e5c057ad582d1f54b3d726f1af3578166beb1f7302ae109b
4
+ data.tar.gz: 505f52a6111ab421f165eb62d1c62578b17e9ef6f56e2ba7aaa20cc1ef81c431
5
5
  SHA512:
6
- metadata.gz: e357995f3f6b3d9a32981c16a65a5b16cc357a3621ca4372b266d5bab19f21005879e6f21a28e6a283635826c5563a2674887d7c02ec9165394f4cd97f5271a8
7
- data.tar.gz: 74ae0db05208795e6266a62c3740358771e82d241e4348e2e2ed288313a5d5a63949cc4d21f40d92f69c88edffaae5aca494ba2489ca68a8ff0600174c6e2a49
6
+ metadata.gz: 07eb32eb3c68749eb8ff1665ff613ca3b37d0d0df3d7c279087e1770d3089d87143af739ec59e25bf46704977285b1505aedcd22b9ce19889d6b7ed353c699ac
7
+ data.tar.gz: 2c78469dda664ed8d3a27fcbfe55dae1e99360f183c140f4a284fe54e6ef335e3fc5da29ea0b17fc666134985f985513d6055974d065521385a17cf46c8becc6
@@ -14,8 +14,13 @@ class GitIncludeMacro < Asciidoctor::Extensions::IncludeProcessor
14
14
  repository = attributes.fetch('repository', '.')
15
15
  revision = attributes.fetch('revision', 'HEAD')
16
16
  lines = attributes.fetch('lines', '')
17
+ as_diff = attributes.value?('diff') || attributes.key?('diff')
18
+ diff_revision = attributes.fetch('diff', "#{revision}~1")
17
19
 
18
20
  cmd = %(git -C #{repository} show #{revision}:#{target})
21
+ if (as_diff)
22
+ cmd = %(git -C #{repository} diff #{diff_revision}:#{target} #{revision}:#{target})
23
+ end
19
24
  content = %x(#{cmd})
20
25
 
21
26
  content = process_line_selection(content, lines) unless lines == ""
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-git-include
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Zalas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-31 00:00:00.000000000 Z
11
+ date: 2023-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor