class BlueCloth

def self::opthash_from_flags( flags=0 )

## Returns a Hash that reflects the settings from the specified +flags+ Integer.
def self::opthash_from_flags( flags=0 )
	flags = flags.to_i
	opthash = {}
	if  ( flags & MKD_NOLINKS         ).nonzero? then opthash[:remove_links]     = true; end
	if  ( flags & MKD_NOIMAGE         ).nonzero? then opthash[:remove_images]    = true; end
	if !( flags & MKD_NOPANTS         ).nonzero? then opthash[:smartypants]      = true; end
	if  ( flags & MKD_NOHTML          ).nonzero? then opthash[:escape_html]      = true; end
	if  ( flags & MKD_STRICT          ).nonzero? then opthash[:strict_mode]      = true; end
	if  ( flags & MKD_TAGTEXT         ).nonzero? then opthash[:tagtext_mode]     = true; end
	if !( flags & MKD_NO_EXT          ).nonzero? then opthash[:pseudoprotocols]  = true; end
	if  ( flags & MKD_CDATA           ).nonzero? then opthash[:xml_cdata]        = true; end
	if !( flags & MKD_NOSUPERSCRIPT   ).nonzero? then opthash[:superscript]      = true; end
	if !( flags & MKD_NORELAXED       ).nonzero? then opthash[:relaxed]          = true; end
	if !( flags & MKD_NOTABLES        ).nonzero? then opthash[:tables]           = true; end
	if !( flags & MKD_NOSTRIKETHROUGH ).nonzero? then opthash[:strikethrough]    = true; end
	if  ( flags & MKD_TOC             ).nonzero? then opthash[:header_labels]    = true; end
	if  ( flags & MKD_1_COMPAT        ).nonzero? then opthash[:mdtest_1_compat]  = true; end
	if  ( flags & MKD_AUTOLINK        ).nonzero? then opthash[:auto_links]       = true; end
	if  ( flags & MKD_SAFELINK        ).nonzero? then opthash[:safe_links]       = true; end
	if !( flags & MKD_NOHEADER        ).nonzero? then opthash[:pandoc_headers]   = true; end
	if  ( flags & MKD_TABSTOP         ).nonzero? then opthash[:expand_tabs]      = true; end
	if !( flags & MKD_NODIVQUOTE      ).nonzero? then opthash[:divquotes]        = true; end
	if !( flags & MKD_NOALPHALIST     ).nonzero? then opthash[:alphalists]       = true; end
	if !( flags & MKD_NODLIST         ).nonzero? then opthash[:definition_lists] = true; end
	if  ( flags & MKD_EXTRA_FOOTNOTE  ).nonzero? then opthash[:footnotes]        = true; end
	return opthash
end