Module YARD::Templates::Helpers::MarkupHelper
In: lib/yard/templates/helpers/markup_helper.rb

Helper methods for loading and managing markup types.

Methods

Constants

MARKUP_PROVIDERS = { :markdown => [ {:lib => :bluecloth, :const => 'BlueCloth'}, {:lib => :kramdown, :const => "Kramdown::Document"}, {:lib => :maruku, :const => 'Maruku'}, {:lib => :"rpeg-markdown", :const => "PEGMarkdown"}, {:lib => :rdiscount, :const => "RDiscount"}   The default list of markup providers for each markup type
MARKUP_EXTENSIONS = { :html => ['htm', 'html', 'shtml'], :text => ['txt'], :textile => ['textile', 'txtile'], :markdown => ['markdown', 'md', 'mdown', 'mkd'], :rdoc => ['rdoc'], }   Returns a list of extensions for various markup types. To register extensions for a type, add them to the array of extensions for the type. @since 0.6.0
MARKUP_FILE_SHEBANG = /\A#!(\S+)\s*$/   Contains the Regexp object that matches the shebang line of extra files to detect the markup type.

Attributes

markup_cache  [RW]  @return [Hash{Symbol=>{(:provider,:class)=>Object}}] the cached markup providers @private @since 0.6.4

Public Class methods

Clears the markup provider cache information. Mainly used for testing. @return [void]

Public Instance methods

Attempts to load the first valid markup provider in {MARKUP_PROVIDERS}. If a provider is specified, immediately try to load it.

On success this sets `@markup_provider` and `@markup_class` to the provider name and library constant class/module respectively for the loaded provider.

On failure this method will inform the user that no provider could be found and exit the program.

@return [Boolean] whether the markup provider was successfully loaded.

Gets the markup provider class/module constant for a markup type Call {load_markup_provider} before using this method.

@param [Symbol] the markup type (:rdoc, :markdown, etc.) @return [Class] the markup class

Strips any shebang lines on the file contents that pertain to markup or preprocessing data.

@return [String] the file contents minus any preprocessing tags @since 0.6.0

Checks for a shebang or looks at the file extension to determine the markup type for the file contents. File extensions are registered for a markup type in {MARKUP_EXTENSIONS}.

A shebang should be on the first line of a file and be in the form:

  #!markup_type

Standard markup types are text, html, rdoc, markdown, textile

@return [Symbol] the markup type recognized for the file @see MARKUP_EXTENSIONS @since 0.6.0

Gets the markup provider name for a markup type Call {load_markup_provider} before using this method.

@param [Symbol] the markup type (:rdoc, :markdown, etc.) @return [Symbol] the markup provider name (usually the gem name of the library)

[Validate]