yard-fence 0.1.0 → 0.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: 19c452cadbc7138751c282b00e156b13a181a6dde7de5ea94b9a11f2e4b2cd8b
4
- data.tar.gz: 82255194452e4fd285fc1c48b72daf6c6a4d3d3a0a628d237e7ec4e2c3a50bc1
3
+ metadata.gz: cab9d088b1349a451adc56f4b43e267d8c94844044812b66c5a57eed3289148b
4
+ data.tar.gz: d53f16b1762b761fa412527e325fccf3f0d2338d8d90e08f1b08a578d7f42ce2
5
5
  SHA512:
6
- metadata.gz: 81831151e5e12a8cab9fde1c590ba09c3b10a45e49fadb47565827f30aaca3eec7494d2005ff7a6d97a16a20d6cc74e93b8ad1fceb7b766d7e31a62bbf2f692f
7
- data.tar.gz: 8b46e712c8705da88215adc176afe5e3d908ace26d0ecc2e8303150091042420bbf60907a29e477d58caa061531df84fdc9c237609f10b0dd529c4be6622d179
6
+ metadata.gz: 164bcdf2a12d36a560ee1da0588de321822d16861e1b7c3ceed37bc1ec4a0bae89818b43fdb065ba8285a8512e9429ad5d21c2ab9a1fadfa2badfb627fe727a8
7
+ data.tar.gz: f92d68174febc61638fb8c7537882062aafa9547f6afdfa2299e9937d861ba0e4ca67a1c1efccba3d5d6d969b6e5ce5742fac335e510036eaa26a2c1b6e49225
checksums.yaml.gz.sig CHANGED
@@ -1 +1 @@
1
- �z�>j(�Y���Ι���j�)��������}�-�U#GtU�"���f���| �-�`��� K�̧�� ��t�&�A��c�,��m7mM)��MVוp�����/�rPll>w�=R/k����5�*�"8��s_z���i|�aS 3\&��ݠ���9sh���.�����o`}��~�+� Lg/��D������)=$U����c;�_�Yzm �d��!�;4Ĵ�V��~47uP�e��.�F3=��[-8�?����`����&ք:N���Mj꨾�Ö���{�AyB��#��,S���&�,-ϩ�� W����+#�}_}���������űT ��m-kD�ҁ��Jڗ�E���
1
+ N�{3�D,�-J�ᅵ��o�nԥ3�k��Y jf������O�����M,�f h]0&�e���q��\�"U�#=J����h�?Z*;<��Y!=����$Uk=_شf9�p��3NyVp���Ͷ��7 lQӂ��g0.n1Z'�c�\�a>�I�e�hre`�,������$���� o��EW�brO��}p,�py�α��N�ӵ��,�,����[�L~�;�����`{������Z<���Sq\�zw�%�;,�/4B�!!�-�+ |Y�D!�W'JmtO�'W�I��6ϓ+w-���.rH��ȿڰ�;j
data/CHANGELOG.md CHANGED
@@ -30,6 +30,27 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [0.2.0] - 2025-11-07
34
+
35
+ - TAG: [v0.2.0][0.2.0t]
36
+ - COVERAGE: 96.43% -- 81/84 lines in 4 files
37
+ - BRANCH COVERAGE: 93.75% -- 15/16 branches in 4 files
38
+ - 29.17% documented
39
+
40
+ ### Added
41
+
42
+ - Up to 96% lines / 93% branches test coverage
43
+
44
+ ### Fixed
45
+
46
+ - handling of optional dependencies
47
+ - kramdown
48
+ - kramdown-parser-gfm
49
+
33
50
  ## [0.1.0] - 2025-11-06
34
51
 
35
52
  - Initial release
53
+
54
+ [Unreleased]: https://github.com/galtzo-floss/yard-fence/compare/v0.2.0...HEAD
55
+ [0.2.0]: https://github.com/galtzo-floss/yard-fence/compare/v0.1.0...v0.2.0
56
+ [0.2.0t]: https://github.com/galtzo-floss/yard-fence/releases/tag/v0.2.0
data/README.md CHANGED
@@ -48,7 +48,7 @@
48
48
 
49
49
  ## 🌻 Synopsis
50
50
 
51
- A brace converter for the markdown fences in your YARD docs.
51
+ A brace converter for the markdown fences in your YARD docs to prevent the `InvalidLink` warning.
52
52
 
53
53
  Just the important bits:
54
54
  - Preprocesses top-level README and other `.md`/`.txt` files into `tmp/` replacing ASCII braces inside fenced code blocks, inline code spans, and simple placeholders like `{issuer}` or `{{TOKEN}}` with visually identical fullwidth braces.
@@ -557,7 +557,7 @@ Thanks for RTFM. ☺️
557
557
  [📌gitmoji]: https://gitmoji.dev
558
558
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
559
559
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
560
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-4.278-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
560
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-0.084-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
561
561
  [🔐security]: SECURITY.md
562
562
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
563
563
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
@@ -3,7 +3,7 @@
3
3
  module Yard
4
4
  module Fence
5
5
  module Version
6
- VERSION = "0.1.0"
6
+ VERSION = "0.2.0"
7
7
  end
8
8
  VERSION = Version::VERSION
9
9
  end
data/lib/yard/fence.rb CHANGED
@@ -43,7 +43,19 @@ require "version_gem"
43
43
 
44
44
  # includes gem files
45
45
  require_relative "fence/version"
46
- require_relative "fence/kramdown_gfm_document"
46
+ begin
47
+ require_relative "fence/kramdown_gfm_document"
48
+ # :nocov:
49
+ # Not covering, because kramdown support is tested, so this rescue is not hit in test runs.
50
+ rescue LoadError => error
51
+ # check the error message, and re-raise if not what is expected
52
+ if error.message.include?("kramdown")
53
+ warn("Yard::Fence: Kramdown GFM provider not loaded: #{error.class}: #{error.message}") if ENV.fetch("YARD_DEBUG", "false").casecmp?("true")
54
+ else
55
+ raise error
56
+ end
57
+ end
58
+ # :nocov:
47
59
 
48
60
  module Yard
49
61
  module Fence
@@ -57,7 +69,10 @@ module Yard
57
69
  SINGLE_BRACE_PLACEHOLDER_REGEX = /{([A-Za-z0-9_:\-]+)}/
58
70
 
59
71
  class Error < StandardError; end
72
+ # :nocov:
73
+ # This is a runtime sanity check to ensure our fullwidth braces differ from ASCII braces.
60
74
  raise Error, "ASCII braces are not the same as Unicode Fullwidth braces" if ASCII_BRACES == FULLWIDTH_BRACES
75
+ # :nocov:
61
76
 
62
77
  module_function
63
78
 
@@ -139,6 +154,12 @@ module Yard
139
154
  # require warnings when YARD is in the middle of loading itself. Call this
140
155
  # from a file loaded via .yardopts (e.g. `-e 'require "yard/fence/kramdown_gfm"; Yard::Fence.use_kramdown_gfm!'`).
141
156
  def use_kramdown_gfm!
157
+ # :nocov:
158
+ # Not covering, because kramdown support is tested, so this rescue is not hit in test runs.
159
+ unless defined?(Yard::Fence::KramdownGfmDocument)
160
+ raise Error, "Yard::Fence: Kramdown GFM provider not loaded. Add kramdown and kramdown-parser-gfm to your Gemfile."
161
+ end
162
+ # :nocov:
142
163
  providers = ::YARD::Templates::Helpers::MarkupHelper::MARKUP_PROVIDERS[:markdown]
143
164
  providers.unshift(KRAMDOWN_PROVIDER)
144
165
  providers.uniq! { |p| [p[:lib].to_s, p[:const].to_s] }
@@ -162,8 +183,10 @@ Yard::Fence::Version.class_eval do
162
183
  extend VersionGem::Basic
163
184
  end
164
185
 
165
- # After YARD completes, restore ASCII braces in generated HTML docs.
166
- # This guarantees the published docs (docs/*.html) show and copy normal { }.
167
- at_exit do
168
- Yard::Fence.postprocess_html_docs
186
+ unless ENV["YARD_FENCE_SKIP_AT_EXIT"] == "1"
187
+ # After YARD completes, restore ASCII braces in generated HTML docs.
188
+ # This guarantees the published docs (docs/*.html) show and copy normal { }.
189
+ at_exit do
190
+ Yard::Fence.postprocess_html_docs
191
+ end
169
192
  end
data/sig/kramdown.rbs CHANGED
@@ -1,6 +1,6 @@
1
+ # (RBS) Kramdown minimal signatures used by yard-fence
1
2
  module Kramdown
2
3
  class Document
3
4
  def initialize: (String source, ?::Hash[Symbol, untyped] options) -> void
4
5
  end
5
6
  end
6
-
data/sig/yard/fence.rbs CHANGED
@@ -1,10 +1,10 @@
1
1
  module Yard
2
2
  module Fence
3
- # Constants
3
+ # Constants (refined literal types where possible)
4
4
  VERSION: String
5
- ASCII_BRACES: String
6
- FULLWIDTH_BRACES: String
7
- KRAMDOWN_PROVIDER: Hash[Symbol, untyped]
5
+ ASCII_BRACES: "{}"
6
+ FULLWIDTH_BRACES: "{}"
7
+ KRAMDOWN_PROVIDER: { lib: Symbol, const: String }
8
8
  GLOB_PATTERN: String
9
9
  TRIPLE_TICK_FENCE: ::Regexp
10
10
  INLINE_TICK_FENCE: ::Regexp
@@ -15,16 +15,33 @@ module Yard
15
15
  class Error < ::StandardError
16
16
  end
17
17
 
18
- # Module functions
18
+ # Module functions (available both as singleton and instance via module_function)
19
19
  def self.fullwidth_braces: (String str) -> String
20
+ def fullwidth_braces: (String str) -> String
21
+
20
22
  def self.sanitize_inline_code: (String line) -> String
23
+ def sanitize_inline_code: (String line) -> String
24
+
21
25
  def self.sanitize_fenced_blocks: (String text) -> String
26
+ def sanitize_fenced_blocks: (String text) -> String
27
+
28
+ # Accept any object; if String returns String, otherwise returns original (untyped)
22
29
  def self.sanitize_text: (String text) -> String
23
30
  | (untyped text) -> untyped
31
+ def sanitize_text: (String text) -> String
32
+ | (untyped text) -> untyped
33
+
24
34
  def self.prepare_tmp_files: () -> void
35
+ def prepare_tmp_files: () -> void
36
+
25
37
  def self.restore_ascii_braces_in_html_file: (String html_filepath) -> void
38
+ def restore_ascii_braces_in_html_file: (String html_filepath) -> void
39
+
26
40
  def self.postprocess_html_docs: () -> void
41
+ def postprocess_html_docs: () -> void
42
+
27
43
  def self.use_kramdown_gfm!: () -> bool
44
+ def use_kramdown_gfm!: () -> bool
28
45
 
29
46
  module Version
30
47
  VERSION: String
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-fence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -315,10 +315,10 @@ licenses:
315
315
  - MIT
316
316
  metadata:
317
317
  homepage_uri: https://yard-fence.galtzo.com/
318
- source_code_uri: https://github.com/galtzo-floss/yard-fence/tree/v0.1.0
319
- changelog_uri: https://github.com/galtzo-floss/yard-fence/blob/v0.1.0/CHANGELOG.md
318
+ source_code_uri: https://github.com/galtzo-floss/yard-fence/tree/v0.2.0
319
+ changelog_uri: https://github.com/galtzo-floss/yard-fence/blob/v0.2.0/CHANGELOG.md
320
320
  bug_tracker_uri: https://github.com/galtzo-floss/yard-fence/issues
321
- documentation_uri: https://www.rubydoc.info/gems/yard-fence/0.1.0
321
+ documentation_uri: https://www.rubydoc.info/gems/yard-fence/0.2.0
322
322
  funding_uri: https://github.com/sponsors/pboling
323
323
  wiki_uri: https://github.com/galtzo-floss/yard-fence/wiki
324
324
  news_uri: https://www.railsbling.com/tags/yard-fence
metadata.gz.sig CHANGED
Binary file