| 
									
										
										
										
											2024-08-12 10:30:59 +01:00
										 |  |  | # typed: true # rubocop:todo Sorbet/StrictSigil | 
					
						
							| 
									
										
										
										
											2024-03-10 03:22:53 +00:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | require "kramdown/converter/kramdown" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module Homebrew | 
					
						
							|  |  |  |   module Manpages | 
					
						
							|  |  |  |     module Converter | 
					
						
							|  |  |  |       # Converts our Kramdown-like input to pure Kramdown. | 
					
						
							|  |  |  |       class Kramdown < ::Kramdown::Converter::Kramdown | 
					
						
							|  |  |  |         def initialize(root, options) | 
					
						
							|  |  |  |           super(root, options.merge(line_width: 80)) | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         def convert_variable(element, _options) | 
					
						
							|  |  |  |           "*`#{element.value}`*" | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         def convert_a(element, options) | 
					
						
							|  |  |  |           text = inner(element, options) | 
					
						
							|  |  |  |           if element.attr["href"] == text | 
					
						
							|  |  |  |             # Don't duplicate the URL if the link text is the same as the URL. | 
					
						
							|  |  |  |             "<#{text}>" | 
					
						
							|  |  |  |           else | 
					
						
							| 
									
										
										
										
											2024-05-23 17:08:41 +01:00
										 |  |  |             super | 
					
						
							| 
									
										
										
										
											2024-03-10 03:22:53 +00:00
										 |  |  |           end | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |