textbringer-rouge 1.0.0 → 1.1.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: e89b464e5be51fbd10033c8d1a95191cf21482c340643bf508cd1ab66dd8bc87
4
- data.tar.gz: e21d2edce25eb08bf50e647ee40ab4440e92ba4aaee93d7e59fbc32cf37a8a5b
3
+ metadata.gz: 8fa4ec040936b1ae70156650ab6d21103bdfacf82ec41b565dafb6d7c8278ca0
4
+ data.tar.gz: 916828719b8cd888226559cd47b8d77ee804a22ecdbb42823e01f9f300ecf1ef
5
5
  SHA512:
6
- metadata.gz: e93f5c3f03d1c27b3d4d1b5d892b98759eddaa0f068cd73bddd382c615485d27e2bea91858794aea332629221c67ce226f2f5954026e4bdfc285ba0379a28b64
7
- data.tar.gz: 11fe7c6c2cf289931d0f1df4068bf1e2f239fdd21b03c326b98ea2819c7b59af2542c4ff71bba75b9ddceeb221b8eadd9febddcdf58d723a84055bce5fa6370d
6
+ metadata.gz: e2a91608774436da674e7093a652b2ab8bb87abe29641ba5e8da73a3d845975861f1a3551b4e20eab0e24787d991d16753c05d56bad6777442b01d840cd7d836
7
+ data.tar.gz: 73aa733f3dcb48118ed7b6e2f3ee1ecc4d3509a85f1e580eed33f93f753891f824daba704b5b8fd9f05d52ee43b3468ac7221ca7e7ced7d883ffe5cbba92a5bf
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Textbringer
4
4
  module Rouge
5
- VERSION = "1.0.0"
5
+ VERSION = "1.1.0"
6
6
  end
7
7
  end
@@ -8,9 +8,28 @@ module Textbringer
8
8
  class RougeMode < Mode
9
9
  include RougeAdapter
10
10
 
11
- # Match common source file extensions
12
- # This pattern will match before Fundamental mode but after specific modes like RubyMode
13
- self.file_name_pattern = /\.(py|js|ts|jsx|tsx|json|yaml|yml|toml|xml|html|css|scss|sass|java|c|cpp|h|hpp|rs|go|php|rb|sh|bash|sql|md|txt)\z/i
11
+ # Dynamically build file_name_pattern from all Rouge lexers
12
+ # This matches all file extensions that Rouge supports
13
+ patterns = ::Rouge::Lexer.all.flat_map do |lexer|
14
+ next [] unless lexer.filenames
15
+
16
+ lexer.filenames.map do |pattern|
17
+ if pattern.start_with?("*.")
18
+ # "*.rb" -> /\.rb\z/i
19
+ ext = Regexp.escape(pattern[2..-1])
20
+ /\.#{ext}\z/i
21
+ elsif pattern.include?("*")
22
+ # "*.foo.bar" -> /\.foo\.bar\z/i
23
+ regex_pattern = Regexp.escape(pattern.sub(/^\*/, '')).gsub('\\*', '.*')
24
+ /#{regex_pattern}\z/i
25
+ else
26
+ # "Rakefile" -> /Rakefile\z/
27
+ /#{Regexp.escape(pattern)}\z/
28
+ end
29
+ end
30
+ end.compact
31
+
32
+ self.file_name_pattern = Regexp.union(patterns)
14
33
 
15
34
  def initialize(buffer)
16
35
  super(buffer)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textbringer-rouge
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yancya