Utopia::ProjectSourceUtopiaProjectDocument

class Document

Definitions

def reference_node(content)

Replace source code references in the given text with HTML anchors.

Implementation

def reference_node(content)
	if reference = @index.languages.parse_reference(content, default_language: @default_language)
		definition = @index.lookup(reference, relative_to: @definition)
	end
	
	if definition
		link_node(reference.identifier, @base.link_for(definition),
			code_node(definition.qualified_form, reference.language.name)
		)
	elsif reference
		code_node(reference.identifier, reference.language.name)
	else
		code_node(content)
	end
end