query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Handles rdoc type links for footnotes. | def handle_rdoc_link url
case url
when /^rdoc-ref:/ then
$'
when /^rdoc-label:footmark-(\d+)/ then
"[^#{$1}]:"
when /^rdoc-label:foottext-(\d+)/ then
"[^#{$1}]"
when /^rdoc-label:label-/ then
gen_url url, $'
when /^rdoc-image:/ then
""
when /^rdoc-[a-z... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_regexp_TIDYLINK target\n text = target.text\n\n return text unless text =~ /\\{(.*?)\\}\\[(.*?)\\]/ or text =~ /(\\S+)\\[(.*?)\\]/\n\n label = $1\n url = $2\n\n if url =~ /^rdoc-label:foot/ then\n handle_rdoc_link url\n else\n gen_url url, label\n end\n end",
"def foo... | [
"0.6121818",
"0.5959783",
"0.590145",
"0.5851033",
"0.5688141",
"0.5564723",
"0.55357176",
"0.5447438",
"0.5242577",
"0.52335376",
"0.52334523",
"0.519151",
"0.5188615",
"0.51817733",
"0.5171823",
"0.51617324",
"0.51512843",
"0.5123446",
"0.5116357",
"0.51017284",
"0.50366926... | 0.66796947 | 0 |
Converts the RDoc markup tidylink into a Markdown.style link. | def handle_regexp_TIDYLINK target
text = target.text
return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
label = $1
url = $2
if url =~ /^rdoc-label:foot/ then
handle_rdoc_link url
else
gen_url url, label
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linkify(text)\n text.gsub(URL_REGEXP, '<a href=\"\\0\">\\0</a>') rescue text\n end",
"def linkify( text )\n s = text.to_s\n s.gsub!( @generic_URL_regexp, '\\1<a href=\"\\2\">\\2</a>' )\n s.gsub!( @starts_with_www_regexp, '\\1<a href=\"http://\\2\">\\2</a>' )\n s.gsub!( @starts_with_ftp_regexp, '\\1<a... | [
"0.6332714",
"0.6300206",
"0.6300088",
"0.6227953",
"0.6209587",
"0.61550736",
"0.6113601",
"0.6108449",
"0.6106311",
"0.6080753",
"0.60747844",
"0.605526",
"0.59913784",
"0.598753",
"0.59466285",
"0.59067863",
"0.59051466",
"0.59011024",
"0.5885324",
"0.5882534",
"0.5879851"... | 0.6061906 | 11 |
Converts the rdoc...: links into a Markdown.style links. | def handle_regexp_RDOCLINK target
handle_rdoc_link target.text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix_links_in_text(markdown)\n markdown.gsub(/(\\s)(https?:\\/\\/[^\\s]*?)([\\.\\)][\\s\\)\\.])/) {\n \"#{$1}[#{$2}](#{$2})#{$3}\"\n }\n end",
"def links_aide_markdown\n @links_aide_markdown ||= begin\n File.read(markdown_links_file)\n end\n end",
"def build_mdlinks\n retu... | [
"0.66432047",
"0.655292",
"0.65472895",
"0.6486411",
"0.6397414",
"0.6309866",
"0.6225124",
"0.621091",
"0.6091628",
"0.60800844",
"0.6062768",
"0.6046447",
"0.60208046",
"0.59941787",
"0.59525317",
"0.5947285",
"0.5942398",
"0.59217155",
"0.5918322",
"0.5916143",
"0.5887508"... | 0.54741853 | 81 |
Creates a new Raw containing +parts+ | def initialize *parts
@parts = []
@parts.concat parts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(raw, part)\n @raw = raw\n @part = part\n end",
"def newWith( stuff )\n @rawContents = stuff\n end",
"def initialize(parts)\n @parts = parts\n end",
"def initialize(*parts)\n @parts = parts.to_a.flatten\n end",
"def from_r(raw)\n\t\toffset = 8\... | [
"0.68878305",
"0.6389103",
"0.6316132",
"0.61230683",
"0.59503603",
"0.59503603",
"0.59140486",
"0.590382",
"0.5860492",
"0.55973655",
"0.5570238",
"0.5570238",
"0.5532776",
"0.5522937",
"0.54562974",
"0.5454097",
"0.53793776",
"0.519774",
"0.51868457",
"0.51770115",
"0.51399... | 0.5940262 | 6 |
Calls accept_raw+ on +visitor+ | def accept visitor
visitor.accept_raw self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept visitor\n visitor.accept_verbatim self\n end",
"def accept(visitor); end",
"def accept(visitor); end",
"def accept visitor\n visitor.start_accepting\n\n visitor.accept_document self\n\n visitor.end_accepting\n end",
"def accept_visitor(visitor)\n visit_method... | [
"0.74743974",
"0.71539944",
"0.71539944",
"0.6940968",
"0.6860152",
"0.68477046",
"0.67093146",
"0.66983473",
"0.6492013",
"0.6492013",
"0.6492013",
"0.6259151",
"0.6226191",
"0.6213279",
"0.62037677",
"0.61809325",
"0.5977177",
"0.5977177",
"0.5968002",
"0.58879066",
"0.5857... | 0.87085664 | 0 |
Appends +texts+ onto this Paragraph | def push *texts
self.parts.concat texts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_text(content)\n temp_text_ele = @text_ele.clone\n temp_text_ele.elements[1].content = content\n last_para = @main_doc.xpath('.//w:p')[-1]\n last_para.add_child(temp_text_ele)\n end",
"def append(text); end",
"def texts=(texts); end",
"def texts=(texts); end",
"def all_text\r\n @t... | [
"0.6931596",
"0.68356943",
"0.6622525",
"0.6622525",
"0.6602602",
"0.6562994",
"0.65248275",
"0.6363725",
"0.6334882",
"0.6281307",
"0.62420756",
"0.62276655",
"0.62133235",
"0.6161428",
"0.6098974",
"0.6060487",
"0.6056483",
"0.60413736",
"0.59883916",
"0.5978674",
"0.596579... | 0.5905065 | 29 |
Calls accept_heading on +visitor+ | def accept visitor
visitor.accept_heading self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_visitor(visitor)\n visit_method_name = \"visit#{basename(self.class.name.to_s.gsub(/::/, '/'))}\".to_sym\n visitor.send(visit_method_name, self) if visitor.respond_to?(visit_method_name)\n end",
"def accept(visitor); end",
"def accept(... | [
"0.6729056",
"0.66788363",
"0.66788363",
"0.63220686",
"0.6261758",
"0.6250526",
"0.6247308",
"0.6244312",
"0.62140614",
"0.6210021",
"0.61468816",
"0.60577935",
"0.6048828",
"0.5968635",
"0.59438545",
"0.57272583",
"0.5613171",
"0.55805093",
"0.55633456",
"0.55626225",
"0.54... | 0.8969792 | 0 |
An HTMLsafe anchor reference for this header. | def aref
"label-#{self.class.to_label.convert text.dup}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anchor\n return @anchor\n end",
"def to_anchor\n anchor = @uri.fragment\n anchor ? Wgit::Url.new(\"##{anchor}\") : nil\n end",
"def anchor=(value)\n @anchor = value\n end",
"def href\n href = (@url || @dos).to_s.dup\n if @fragment... | [
"0.7457616",
"0.7153768",
"0.70120776",
"0.6787997",
"0.6785707",
"0.6690137",
"0.6684333",
"0.66187406",
"0.65497",
"0.6500254",
"0.6468194",
"0.64515936",
"0.64333034",
"0.64321154",
"0.64245266",
"0.6381519",
"0.6380151",
"0.6353759",
"0.63429743",
"0.6342414",
"0.633966",... | 0.0 | -1 |
Creates a fullyqualified label which will include the label from +context+. This helps keep ids unique in HTML. | def label context = nil
label = aref
label = [context.aref, label].compact.join '-' if
context and context.respond_to? :aref
label
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label(*args)\n current_form_context.label(*args)\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def label\n <<-HTML\n\n <label id=\"#{label_id}\" class=\"string #{lab... | [
"0.702202",
"0.6737072",
"0.6737072",
"0.6737072",
"0.66112965",
"0.6544137",
"0.65154463",
"0.647971",
"0.6283374",
"0.61758965",
"0.61635846",
"0.6145839",
"0.6141548",
"0.61394453",
"0.61394215",
"0.60985243",
"0.60980093",
"0.6092034",
"0.6069221",
"0.60225487",
"0.600784... | 0.76641065 | 0 |
HTML markup of the text of this label without the surrounding header element. | def plain_html
self.class.to_html.to_html(text.dup)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_plain\n Redcap::Utilities.html_to_plain_text label\n end",
"def label\n \"\"\n end",
"def no_tags label\n return label.gsub(/\\<.+\\/?\\>/,'')\n end",
"def full_label\n ''\n end",
"def emit_label\n return '' if @options[:no_label]\n title = @anno[:tit... | [
"0.74868405",
"0.74433357",
"0.7157115",
"0.7108721",
"0.70835394",
"0.7044785",
"0.69404244",
"0.69404244",
"0.69404244",
"0.68778795",
"0.67525595",
"0.6702956",
"0.66287595",
"0.66242087",
"0.6609443",
"0.65871143",
"0.65790415",
"0.6565237",
"0.65561265",
"0.65222996",
"0... | 0.0 | -1 |
Calls accept_hard_break on +visitor+ | def accept visitor
visitor.accept_hard_break self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept visitor\r\n visitor.accept_hard_break self\r\n end",
"def accept(visitor); end",
"def accept(visitor); end",
"def accept(evaluator)\n evaluator.break_out(self)\n end",
"def accept visitor\n visitor.accept_raw self\n end",
"def visit(&block)\n # block.call self\n yield sel... | [
"0.899584",
"0.6545986",
"0.6545986",
"0.6453815",
"0.63177216",
"0.62675744",
"0.625015",
"0.61676234",
"0.60714424",
"0.5893698",
"0.5799504",
"0.57412124",
"0.57358783",
"0.5673614",
"0.5595074",
"0.5582117",
"0.55817586",
"0.5571828",
"0.55711055",
"0.555171",
"0.550786",... | 0.8999853 | 0 |
Creates a new list of +type+ with +items+. Valid list types are: +:BULLET+, +:LABEL+, +:LALPHA+, +:NOTE+, +:NUMBER+, +:UALPHA+ | def initialize type = nil, *items
@type = type
@items = []
@items.concat items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_item type, description, options\n type = type.downcase\n if type_allowed? type\n # Create and return a new item of the type passed in\n @@list_types[type.to_sym].new(description, options)\n else\n # Raise the invalid item type error if the type does not exist\n raise Udac... | [
"0.67039526",
"0.6537437",
"0.6537437",
"0.640028",
"0.6346279",
"0.6314427",
"0.6223723",
"0.62037396",
"0.617908",
"0.61656046",
"0.611869",
"0.60935575",
"0.6061962",
"0.6031753",
"0.60249835",
"0.5990402",
"0.5926995",
"0.5896492",
"0.58935374",
"0.5859352",
"0.5853386",
... | 0.6171192 | 9 |
Appends +item+ to the list | def << item
@items << item
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_item(item)\r\n @list << item \r\n end",
"def add_item(item)\n\t\t#takes in item and adds to list\n\t\t@list << item\n\tend",
"def append(item)\n items << item unless items.include?(item)\n end",
"def add_item item\n @items << item\n @@all_items << item\n end",
"def <<(item)... | [
"0.86025035",
"0.85042214",
"0.8149896",
"0.80241454",
"0.79033285",
"0.78109485",
"0.78072107",
"0.76167977",
"0.75700265",
"0.74956304",
"0.74454427",
"0.7382413",
"0.7361877",
"0.73606426",
"0.73432046",
"0.73183155",
"0.73039305",
"0.730391",
"0.7246401",
"0.722288",
"0.7... | 0.7593576 | 8 |
Runs this list and all its items through +visitor+ | def accept visitor
visitor.accept_list_start self
@items.each do |item|
item.accept visitor
end
visitor.accept_list_end self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept visitor\n visitor.accept_list_item_start self\n\n @parts.each do |part|\n part.accept visitor\n end\n\n visitor.accept_list_item_end self\n end",
"def accept(visitor); end",
"def accept(visitor); end",
"def accept(visitor)\n visitor.visit(self)\n end",
"def accept(v... | [
"0.6787533",
"0.64618486",
"0.64618486",
"0.6319696",
"0.6309191",
"0.6105722",
"0.59892327",
"0.5981617",
"0.5980265",
"0.59615743",
"0.5950963",
"0.58895373",
"0.58848333",
"0.5883772",
"0.5831338",
"0.5814057",
"0.5770394",
"0.5746378",
"0.5736327",
"0.57205",
"0.56734157"... | 0.76484036 | 0 |
Is the list empty? | def empty?
@items.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty?\n @list.empty?\n end",
"def is_list_empty?\n @head.nil?\n end",
"def list_empty?\n return (@first_node == nil) ? true : false\n end",
"def empty?\n @exact.empty? && @list.empty?\n end",
"def is_empty()\n return @items.empty?\n end",
"def empty?\n ... | [
"0.9217213",
"0.85951513",
"0.85516644",
"0.8441759",
"0.84331113",
"0.84030807",
"0.834237",
"0.82604903",
"0.82604903",
"0.8241488",
"0.8221005",
"0.813743",
"0.8106962",
"0.80686265",
"0.80686265",
"0.805755",
"0.8007819",
"0.8007819",
"0.7994657",
"0.79926664",
"0.7956672... | 0.81769353 | 12 |
Returns the last item in the list | def last
@items.last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last\n list.first\n end",
"def last(list)\n list[-1]\nend",
"def last\n items.compact.last\n end",
"def get_last_item(arr)\n\treturn arr[-1]\nend",
"def last\n list = self\n list = list.tail until list.tail.empty?\n list.head\n end",
"def last_item\n self.simple_... | [
"0.85941875",
"0.845151",
"0.8367741",
"0.8273618",
"0.8067048",
"0.79856426",
"0.79180527",
"0.7890178",
"0.7883755",
"0.7879191",
"0.78304315",
"0.77556336",
"0.77402806",
"0.7732358",
"0.7719531",
"0.7615636",
"0.7597083",
"0.7589217",
"0.75820106",
"0.7528669",
"0.7496384... | 0.8162463 | 4 |
Appends +items+ to the list | def push *items
@items.concat items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_all(items)\n items.each { |item| append(item) }\n end",
"def add_items(items)\n add_items!(unknown_items(items))\n end",
"def add_item item\n @items << item\n @@all_items << item\n end",
"def append(item)\n items << item unless items.include?(item)\n end",
"def... | [
"0.80494493",
"0.7604309",
"0.72770077",
"0.7265199",
"0.7226949",
"0.7099781",
"0.70515186",
"0.7003724",
"0.7003484",
"0.6898878",
"0.6785065",
"0.6664318",
"0.662197",
"0.6580458",
"0.65532255",
"0.6497868",
"0.6476366",
"0.642282",
"0.63541216",
"0.6350151",
"0.63500005",... | 0.71968234 | 5 |
Creates a new crossref resolver that generates links relative to +context+ which lives at +from_path+ in the generated files. '' characters on references are removed unless +show_hash+ is true. Only method names preceded by '' or '::' are linked, unless +hyperlink_all+ is true. | def initialize(options, from_path, context, markup = nil)
raise ArgumentError, 'from_path cannot be nil' if from_path.nil?
super options, markup
@context = context
@from_path = from_path
@hyperlink_all = @options.hyperlink_all
@show_hash = @options.show_hash
@cross_reference... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_href(from_path)\n RDoc::Markup::ToHtml.gen_relative_url from_path, path\n end",
"def initialize(from_path, context, show_hash)\n super()\n\n # class names, variable names, or instance variables\n @markup.add_special(/(\n # A::B.meth(**) (for operator in Fortran95)\n ... | [
"0.5929088",
"0.5375775",
"0.5319559",
"0.52186614",
"0.50815314",
"0.50301653",
"0.48274606",
"0.47985336",
"0.4770793",
"0.4769498",
"0.47259003",
"0.46751273",
"0.46513098",
"0.46190074",
"0.46156228",
"0.46154326",
"0.45972216",
"0.45388186",
"0.4504698",
"0.45034972",
"0... | 0.637331 | 0 |
Creates a link to the reference +name+ if the name exists. If +text+ is given it is used as the link text, otherwise +name+ is used. | def cross_reference name, text = nil, code = true
lookup = name
name = name[1..-1] unless @show_hash if name[0, 1] == '#'
if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])@/
text ||= "#{CGI.unescape $'} at <code>#{$1}</code>"
code = false
else
text ||= name
end
link lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link name, text, code = true\n if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])@/\n name = $1\n label = $'\n end\n\n ref = @cross_reference.resolve name, text\n\n case ref\n when String then\n ref\n else\n path = ref.as_href @from_path\n\n if code and RDoc::Cod... | [
"0.6853711",
"0.680652",
"0.66925234",
"0.6566226",
"0.63652414",
"0.6207514",
"0.6201457",
"0.6191413",
"0.61871046",
"0.6052438",
"0.60088915",
"0.6005073",
"0.59813654",
"0.59683543",
"0.5962928",
"0.5951896",
"0.5902869",
"0.58733314",
"0.5865166",
"0.58625764",
"0.584787... | 0.6421498 | 4 |
We're invoked when any text matches the CROSSREF pattern. If we find the corresponding reference, generate a link. If the name we're looking for contains no punctuation, we look for it up the module/class chain. For example, ToHtml is found, even without the RDoc::Markup:: prefix, because we look for it in module Marku... | def handle_regexp_CROSSREF(target)
name = target.text
return name if name =~ /@[\w-]+\.[\w-]/ # labels that look like emails
unless @hyperlink_all then
# This ensures that words entirely consisting of lowercase letters will
# not have cross-references generated (to suppress lots of erroneous
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_reference name, text = nil, code = true\n lookup = name\n\n name = name[1..-1] unless @show_hash if name[0, 1] == '#'\n\n if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])@/\n text ||= \"#{CGI.unescape $'} at <code>#{$1}</code>\"\n code = false\n else\n text ||= name\n ... | [
"0.71658355",
"0.6972199",
"0.6880442",
"0.65588045",
"0.65266794",
"0.61751395",
"0.6150311",
"0.58749634",
"0.58387125",
"0.58251834",
"0.5763737",
"0.5676025",
"0.56373984",
"0.55759454",
"0.5540784",
"0.55238056",
"0.5516832",
"0.54941416",
"0.5489915",
"0.54835343",
"0.5... | 0.7143292 | 1 |
Handles rdocref: scheme links and allows RDoc::Markup::ToHtml to handle other schemes. | def handle_regexp_HYPERLINK target
return cross_reference $' if target.text =~ /\Ardoc-ref:/
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_rdoc_link url\n case url\n when /^rdoc-ref:/ then\n $'\n when /^rdoc-label:footmark-(\\d+)/ then\n \"[^#{$1}]:\"\n when /^rdoc-label:foottext-(\\d+)/ then\n \"[^#{$1}]\"\n when /^rdoc-label:label-/ then\n gen_url url, $'\n when /^rdoc-image:/ then\n \"/ then\n \"[^#{$1}]:\"\n when /^rdoc-label:foottext-(\\d+)/ then\n \"[^#{$1}]\"\n when /^rdoc-label:label-/ then\n gen_url url, $'\n when /^rdoc-image:/ then\n \") and name =~ /(.*[^#:])@/
name = $1
label = $'
end
ref = @cross_reference.resolve name, text
case ref
when String then
ref
else
path = ref.as_href @from_path
if code and RDoc::CodeObject === ref and... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_link(name, web, text = nil, options = {})\n mode = (options[:mode] || :show).to_sym\n link_type = (options[:link_type] || :show).to_sym\n\n if (link_type == :show)\n known_page = web.has_page?(name)\n else\n known_page = web.has_file?(name)\n description = web.description(name)\... | [
"0.71295464",
"0.70431346",
"0.68811655",
"0.6807824",
"0.6658288",
"0.65666443",
"0.6481939",
"0.635472",
"0.6352721",
"0.63526154",
"0.633634",
"0.63232434",
"0.6286899",
"0.62621135",
"0.6254337",
"0.6228063",
"0.6185726",
"0.6150289",
"0.61453605",
"0.61177295",
"0.610151... | 0.699004 | 2 |
Creates a new regexp handling sequence of +type+ with +text+ | def initialize(type, text)
@type, @text = type, text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pattern_create(length, sets = nil)\n Rex::Text.pattern_create(length, sets)\n end",
"def convert_regexp_handling target\n return target.text if in_tt?\n\n handled = false\n\n @attributes.each_name_of target.type do |name|\n method_name = \"handle_regexp_#{name}\"\n\n if respond_to? met... | [
"0.61470574",
"0.5910772",
"0.5775103",
"0.5574036",
"0.5559264",
"0.5484096",
"0.54576814",
"0.5450564",
"0.5418628",
"0.53953594",
"0.53427166",
"0.5334512",
"0.53283",
"0.5310388",
"0.53102225",
"0.53052366",
"0.5273383",
"0.5268759",
"0.52575743",
"0.5250928",
"0.5249111"... | 0.53629404 | 11 |
Regexp handlings are equal when the have the same text and type | def ==(o)
self.text == o.text && self.type == o.type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(regexp); end",
"def match_to_regex(match, type=:fuzzy)\n match.downcase!\n if type == :exact\n /^#{match}$/\n else\n /#{match}/\n end\n end",
"def accept? text\r\n !text.match(@regexp).nil?\r\n end",
"def regexp; end",
"def ... | [
"0.6307015",
"0.6273078",
"0.62694407",
"0.6131021",
"0.6131021",
"0.5944505",
"0.5894454",
"0.5868992",
"0.58368945",
"0.58360326",
"0.58079994",
"0.57813466",
"0.57568586",
"0.5740932",
"0.57343876",
"0.57155395",
"0.571219",
"0.57020044",
"0.5676951",
"0.56642985",
"0.5653... | 0.5607465 | 25 |
Creates a new IndentedParagraph containing +parts+ indented with +indent+ spaces | def initialize indent, *parts
@indent = indent
super(*parts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paragraph parts\n parts = parts.map do |part|\n if \"\\n\" == part then\n RDoc::Markup::HardBreak.new\n else\n part\n end\n end if break_on_newline?\n\n RDoc::Markup::Paragraph.new(*parts)\n end",
"def accept_indented_paragraph paragraph\n @indent += paragraph.indent... | [
"0.61888355",
"0.570944",
"0.5477448",
"0.54439133",
"0.54148996",
"0.5385366",
"0.538422",
"0.52417266",
"0.5178151",
"0.51436776",
"0.5073899",
"0.5062497",
"0.5046409",
"0.503279",
"0.49830645",
"0.49705112",
"0.4954788",
"0.4947341",
"0.49473405",
"0.4890374",
"0.48900846... | 0.57245225 | 1 |
Calls accept_indented_paragraph on +visitor+ | def accept visitor
visitor.accept_indented_paragraph self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_indented_paragraph paragraph\n @indent += paragraph.indent\n text = paragraph.text @hard_break\n wrap attributes text\n @indent -= paragraph.indent\n end",
"def visit_indented(node)\n if NOINDENT.include?(node.type)\n visit_plain(node)\n else\n indented { visit_pla... | [
"0.6879432",
"0.67776895",
"0.66579413",
"0.6542725",
"0.63854903",
"0.6374204",
"0.6179981",
"0.5988314",
"0.5966637",
"0.59618455",
"0.5924771",
"0.5900269",
"0.57844126",
"0.5710745",
"0.56747156",
"0.5663807",
"0.56518036",
"0.56518036",
"0.56502056",
"0.56233394",
"0.560... | 0.9265879 | 0 |
Joins the raw paragraph text and converts inline HardBreaks to the +hard_break+ text followed by the indent. | def text hard_break = nil
@parts.map do |part|
if RDoc::Markup::HardBreak === part then
'%1$s%3$*2$s' % [hard_break, @indent, ' '] if hard_break
else
part
end
end.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text hard_break = ''\n @parts.map do |part|\n if RDoc::Markup::HardBreak === part then\n hard_break\n else\n part\n end\n end.join\n end",
"def hard_break( text ) \n text.gsub!( /(.)\\n(?!\\n|\\Z|>| *([#*=]+(\\s|$)|[{|]))/, \"\\\\1<br />\" ) if hard_breaks\n ... | [
"0.6851058",
"0.650138",
"0.64632845",
"0.6375038",
"0.6324683",
"0.62558293",
"0.62272",
"0.6090805",
"0.60703504",
"0.6069623",
"0.604794",
"0.6044798",
"0.6042478",
"0.60402",
"0.6031806",
"0.60183716",
"0.5959996",
"0.5947117",
"0.59244084",
"0.5889474",
"0.5848154",
"0... | 0.68693435 | 0 |
Creates a new attribute manager that understands bold, emphasized and teletype text. | def initialize
@html_tags = {}
@matching_word_pairs = {}
@protectable = %w[<]
@regexp_handlings = []
@word_pair_map = {}
@exclusive_bitmap = 0
@attributes = RDoc::Markup::Attributes.new
add_word_pair "*", "*", :BOLD, true
add_word_pair "_", "_", :EM, true
add_word_pair "+", "+",... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeAttributed(parameters = {})\n options = { text: 'text',\n font: NSFont.fontWithName( 'Menlo', size: 12 ),\n traits: 0, # trait mask (NSBoldFontMask, NSItalicFontMask, etc)\n textColor: NSColor.textColor,\n backgroundColor: NSColor.clearColor, # us... | [
"0.6016054",
"0.59642136",
"0.56514245",
"0.54746956",
"0.53845006",
"0.52833676",
"0.52489775",
"0.5224064",
"0.5215624",
"0.5174667",
"0.506464",
"0.505696",
"0.50198835",
"0.50172323",
"0.5011231",
"0.49946386",
"0.49884978",
"0.49860632",
"0.49700564",
"0.4963074",
"0.496... | 0.4899958 | 24 |
Return an attribute object with the given turn_on and turn_off bits set | def attribute(turn_on, turn_off)
RDoc::Markup::AttrChanger.new turn_on, turn_off
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_turn_lights_off\n house = House.new(color: \"Gray\", floors: 2, year_built: 2003, address: '274 Baker St', lights: true, safe_mode:true)\n actual = house.lights\n assert_equal(true, actual, \"'true' as a boolean should be returned\")\n\n house.lights_off\n actual = house.lights\n assert_... | [
"0.5698784",
"0.56865555",
"0.5580671",
"0.54872185",
"0.5469029",
"0.54486275",
"0.5359849",
"0.5354417",
"0.53526366",
"0.52831495",
"0.52650523",
"0.5264509",
"0.52119386",
"0.5141737",
"0.5122023",
"0.5115141",
"0.51150036",
"0.507075",
"0.50351083",
"0.5032948",
"0.50162... | 0.6983297 | 0 |
Changes the current attribute from +current+ to +new+ | def change_attribute current, new
diff = current ^ new
attribute(new & diff, current & diff)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __set_current(current)\n @current = current\n end",
"def current=(new_value)\n value = (new_value)%steps\n @dirty = @current != value\n @current = value\n end",
"def set_current c\n @current = c\n end",
"def update(current)\n end",
"def attribute_set(name, value)\n ... | [
"0.68294823",
"0.66313666",
"0.6430209",
"0.6421792",
"0.629604",
"0.62884265",
"0.6109641",
"0.6060413",
"0.59250265",
"0.5908709",
"0.58885294",
"0.58882594",
"0.5887264",
"0.58273476",
"0.57896876",
"0.5786373",
"0.5765938",
"0.57593745",
"0.5758632",
"0.57536924",
"0.5701... | 0.78452903 | 0 |
Used by the tests to change attributes by name from +current_set+ to +new_set+ | def changed_attribute_by_name current_set, new_set
current = new = 0
current_set.each do |name|
current |= @attributes.bitmap_for(name)
end
new_set.each do |name|
new |= @attributes.bitmap_for(name)
end
change_attribute(current, new)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_attribute current, new\n diff = current ^ new\n attribute(new & diff, current & diff)\n end",
"def attribute_set(name, value)\n @dirty[name] = true\n @attributes[:current][name] = value\n end",
"def new_set\r\n @sets[@current_set_name] = @current_set\r\n @current_set ... | [
"0.6621526",
"0.65655637",
"0.6294831",
"0.62851596",
"0.6046185",
"0.5997604",
"0.5991132",
"0.59138334",
"0.5895288",
"0.5892776",
"0.5884232",
"0.5818639",
"0.5733529",
"0.57313424",
"0.5726945",
"0.57175916",
"0.5673867",
"0.5637467",
"0.56360215",
"0.5622997",
"0.5612954... | 0.75614154 | 0 |
Copies +start_pos+ to +end_pos+ from the current string | def copy_string(start_pos, end_pos)
res = @str[start_pos...end_pos]
res.gsub!(/\000/, '')
res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_string(start_pos, end_pos)\n StringExtractor.new(self, start_pos, end_pos).extract_string\n end",
"def function(str,start_position, end_position) #the method of return substring\n\tstr1=str.split(\"\")\n\tstr2=[]\n\tj=0\n\tfor i in start_position-1...end_position\n\t\tstr2[j]=str1[i]\n\t\tj+=... | [
"0.63430804",
"0.6310562",
"0.6179489",
"0.5921248",
"0.5880937",
"0.57089424",
"0.55825734",
"0.5567815",
"0.5539058",
"0.5539058",
"0.5539058",
"0.5539058",
"0.5539058",
"0.5539058",
"0.5539058",
"0.5539058",
"0.55253685",
"0.5442495",
"0.5418312",
"0.54057705",
"0.54057705... | 0.7684693 | 0 |
:nodoc: Map attributes like textto the sequence \001\002\001\003, where is a perattribute specific character | def convert_attrs(str, attrs, exclusive = false)
convert_attrs_matching_word_pairs(str, attrs, exclusive)
convert_attrs_word_pair_map(str, attrs, exclusive)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_attribute_text(prefix, line)\n print prefix\n line.each do |achar|\n print achar.char\n end\n puts\n end",
"def set_char(attr, val); end",
"def get_char(attr); end",
"def apply_attributes(string)\n string.gsub ATTRIBUTE_REGEXP do |match|\n key, value = matc... | [
"0.63031256",
"0.61833936",
"0.61014587",
"0.6041035",
"0.58786297",
"0.58562416",
"0.5855026",
"0.5814462",
"0.57974726",
"0.5751886",
"0.567347",
"0.5591674",
"0.5582723",
"0.5581085",
"0.5546894",
"0.5543648",
"0.55015033",
"0.5500269",
"0.5490888",
"0.5470901",
"0.5463289... | 0.5913134 | 4 |
Converts HTML tags to RDoc attributes | def convert_html(str, attrs, exclusive = false)
tags = @html_tags.select { |start, bitmap|
exclusive == exclusive?(bitmap)
}.keys.join '|'
1 while str.gsub!(/<(#{tags})>(.*?)<\/\1>/i) { |orig|
attr = @html_tags[$1.downcase]
html_length = $1.length + 2
seq = NULL * html_length
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_attributes(attr); end",
"def attr_tag(text); end",
"def parse_html_attributes(str, line = T.unsafe(nil), in_html_tag = T.unsafe(nil)); end",
"def on_html_attrs(*args) = [:html, :attrs, *args]",
"def init_tags\n @attr_tags = [\n InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:BOLD)... | [
"0.74355125",
"0.7034978",
"0.67203885",
"0.6657362",
"0.6462311",
"0.6446431",
"0.6446431",
"0.64154315",
"0.63734657",
"0.6365047",
"0.62345964",
"0.6198461",
"0.61646146",
"0.6122326",
"0.61058354",
"0.6079834",
"0.5968442",
"0.59636223",
"0.5956862",
"0.59029204",
"0.5885... | 0.586466 | 22 |
Converts regexp handling sequences to RDoc attributes | def convert_regexp_handlings str, attrs, exclusive = false
@regexp_handlings.each do |regexp, attribute|
next unless exclusive == exclusive?(attribute)
str.scan(regexp) do
capture = $~.size == 1 ? 0 : 1
s, e = $~.offset capture
attrs.set_attrs s, e - s, attribute | @attributes.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_regexp_handling target\n return target.text if in_tt?\n\n handled = false\n\n @attributes.each_name_of target.type do |name|\n method_name = \"handle_regexp_#{name}\"\n\n if respond_to? method_name then\n target.text = public_send method_name, target\n handled = true\n ... | [
"0.6724275",
"0.6527613",
"0.6272155",
"0.6272155",
"0.6272155",
"0.6055113",
"0.59603393",
"0.58866054",
"0.58866054",
"0.58866054",
"0.5837407",
"0.5810117",
"0.5799805",
"0.57893497",
"0.57893497",
"0.57838094",
"0.5702751",
"0.56886464",
"0.56875485",
"0.5635353",
"0.5580... | 0.66240597 | 1 |
Escapes regexp handling sequences of text to prevent conversion to RDoc | def mask_protected_sequences
# protect __send__, __FILE__, etc.
@str.gsub!(/__([a-z]+)__/i,
"_#{PROTECT_ATTR}_#{PROTECT_ATTR}\\1_#{PROTECT_ATTR}_#{PROTECT_ATTR}")
@str.gsub!(/(\A|[^\\])\\([#{Regexp.escape @protectable.join}])/m,
"\\1\\2#{PROTECT_ATTR}")
@str.gsub!(/\\(\\[#{Regexp.es... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def escape_re(str)\n str.gsub(@re_chars) {|c| @re_esc + c}\n end",
"def escape_text input\n escape input, text_regexp, text_mapping\n end",
"def escape(text)\n replacements.inject(text.to_s) do |corpus, (pattern, replacement)|\n corpus.gsub(pattern, replacement)\n end\n end",
"def esc... | [
"0.715754",
"0.70428973",
"0.70133156",
"0.69805074",
"0.68697995",
"0.68668604",
"0.6858128",
"0.6714471",
"0.6628049",
"0.66233474",
"0.6554835",
"0.63917816",
"0.63674283",
"0.6334957",
"0.6319174",
"0.6272918",
"0.6229135",
"0.6221019",
"0.6144403",
"0.6138542",
"0.613351... | 0.0 | -1 |
Unescapes regexp handling sequences of text | def unmask_protected_sequences
@str.gsub!(/(.)#{PROTECT_ATTR}/, "\\1\000")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unescape( value )\n return value unless @escape\n\n value = value.to_s\n value.gsub!(%r/\\\\[0nrt\\\\]/) { |char|\n case char\n when '\\0'; \"\\0\"\n when '\\n'; \"\\n\"\n when '\\r'; \"\\r\"\n when '\\t'; \"\\t\"\n when '\\\\\\\\'; \"\\\\\"\n end\n }\n ... | [
"0.63836634",
"0.6079271",
"0.5977411",
"0.59271735",
"0.5924761",
"0.5833948",
"0.582302",
"0.58083767",
"0.58072335",
"0.5753395",
"0.57116073",
"0.57024866",
"0.56987566",
"0.5683845",
"0.5675305",
"0.56546086",
"0.56421334",
"0.56263936",
"0.5620199",
"0.5608928",
"0.5566... | 0.0 | -1 |
Adds a markup class with +name+ for words wrapped in the +start+ and +stop+ character. To make words wrapped with "" bold: am.add_word_pair '', '', :BOLD | def add_word_pair(start, stop, name, exclusive = false)
raise ArgumentError, "Word flags may not start with '<'" if
start[0,1] == '<'
bitmap = @attributes.bitmap_for name
if start == stop then
@matching_word_pairs[start] = bitmap
else
pattern = /(#{Regexp.escape start})(\S+)(#{Regexp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_word_pair(start, stop, name)\n @attribute_manager.add_word_pair(start, stop, name)\n end",
"def add_word_pair(start, stop, name)\n @attribute_manager.add_word_pair(start, stop, name)\n end",
"def add_word_pair(start, stop, name)\n @am.add_word_pair(start, stop, name)\n end",
"def start_el... | [
"0.7295",
"0.7295",
"0.72389424",
"0.5900631",
"0.5373865",
"0.5290534",
"0.5283114",
"0.5276625",
"0.52421534",
"0.5235932",
"0.5215395",
"0.51093453",
"0.50894886",
"0.5080624",
"0.507721",
"0.507721",
"0.50485003",
"0.50460017",
"0.5039447",
"0.49766383",
"0.49393922",
"... | 0.70606387 | 3 |
Adds a markup class with +name+ for words surrounded by HTML tag +tag+. To process emphasis tags: am.add_html 'em', :EM | def add_html(tag, name, exclusive = false)
bitmap = @attributes.bitmap_for name
@html_tags[tag.downcase] = bitmap
@exclusive_bitmap |= bitmap if exclusive
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_html(tag, name)\n @am.add_html(tag, name)\n end",
"def add_html(tag, name)\n @attribute_manager.add_html(tag, name)\n end",
"def add_html(tag, name)\n @attribute_manager.add_html(tag, name)\n end",
"def tag tag, text, classes = nil\n \"<#{tag} #{classes.nil? ? '': \"class='#{classes}'\"}... | [
"0.6954033",
"0.6428379",
"0.6428379",
"0.58304405",
"0.57077175",
"0.56407565",
"0.5610154",
"0.5609936",
"0.5592091",
"0.55819464",
"0.55633336",
"0.55569965",
"0.55569965",
"0.5533078",
"0.55310756",
"0.55077696",
"0.54585844",
"0.5456221",
"0.5449075",
"0.5437901",
"0.542... | 0.5980399 | 3 |
Adds a regexp handling for +pattern+ with +name+. A simple URL handler would be: | def add_regexp_handling pattern, name, exclusive = false
bitmap = @attributes.bitmap_for(name)
@regexp_handlings << [pattern, bitmap]
@exclusive_bitmap |= bitmap if exclusive
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_regexp_handling(pattern, name)\n @attribute_manager.add_regexp_handling(pattern, name)\n end",
"def route6\n name = params[:name]\n regex = Regexp.new(Regexp.escape(name))\n end",
"def route7\n name = params[:name]\n regex = Regexp.new(Regexp.quote(name))\n end",
"def url_regexp\n ... | [
"0.78067154",
"0.69048744",
"0.6874121",
"0.6696668",
"0.6655962",
"0.6654656",
"0.6529913",
"0.6289053",
"0.6229418",
"0.61708844",
"0.6150521",
"0.6068922",
"0.6041536",
"0.6012337",
"0.59815943",
"0.59683436",
"0.596795",
"0.59653825",
"0.5964149",
"0.5932812",
"0.5909235"... | 0.74524915 | 1 |
Processes +str+ converting attributes, HTML and regexp handlings | def flow str
@str = str.dup
mask_protected_sequences
@attrs = RDoc::Markup::AttrSpan.new @str.length, @exclusive_bitmap
convert_attrs @str, @attrs, true
convert_html @str, @attrs, true
convert_regexp_handlings @str, @attrs, true
convert_attrs @str, @attrs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_attributes(string)\n string.gsub ATTRIBUTE_REGEXP do |match|\n key, value = match.match(ATTRIBUTE_REGEXP).to_a[1..2]\n self[key] = value\n ''\n end\n end",
"def parse_html_attributes(str, line = T.unsafe(nil), in_html_tag = T.unsafe(nil)); end",
"def parse_tag(string... | [
"0.712314",
"0.6922175",
"0.6569357",
"0.64988047",
"0.6494407",
"0.6361468",
"0.63009816",
"0.62337095",
"0.62067944",
"0.5996923",
"0.59131795",
"0.5892884",
"0.58772033",
"0.58639127",
"0.57913876",
"0.5784831",
"0.57438236",
"0.573427",
"0.5726441",
"0.57154465",
"0.57121... | 0.5876185 | 13 |
Debug method that prints a string along with its attributes | def display_attributes
puts
puts @str.tr(NULL, "!")
bit = 1
16.times do |bno|
line = ""
@str.length.times do |i|
if (@attrs[i] & bit) == 0
line << " "
else
if bno.zero?
line << "S"
else
line << ("%d" % (bno+1))
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debug_string\n str = \"\"\n klass.fields.each do |f|\n if f.is_padding?\n str << \"#{f.name}: \\n\"\n else\n str << \"#{f.name}: #{send(f.name.to_sym)}\\n\"\n end\n end\n\n str\n end",
"def debug_str(inspect_method = :inspect)\n \"Current Dat... | [
"0.74957705",
"0.7390789",
"0.7214643",
"0.71066266",
"0.7101739",
"0.6957741",
"0.6851698",
"0.6848502",
"0.6812591",
"0.6806555",
"0.6795213",
"0.6775716",
"0.67737913",
"0.675809",
"0.67218834",
"0.6713035",
"0.6709388",
"0.66604",
"0.66545177",
"0.6594339",
"0.6594319",
... | 0.66502446 | 19 |
Splits the string into chunks by attribute change | def split_into_flow
res = []
current_attr = 0
str_len = @str.length
# skip leading invisible text
i = 0
i += 1 while i < str_len and @str[i].chr == "\0"
start_pos = i
# then scan the string, chunking it on attribute changes
while i < str_len
new_attr = @attrs[i]
if new... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_split(string, chr)\n result, tmp = [], ''\n\n # Hideous code follows\n string.split(chr).each do | attr |\n if attr.count('\"') == 1 || tmp.count('\"') == 1\n tmp << attr << chr\n next unless tmp.count('\"') == 2\n end\n\n result << attr if tmp.size == 0\n\n i... | [
"0.59872144",
"0.5829982",
"0.5675887",
"0.5673891",
"0.565845",
"0.55779934",
"0.55608386",
"0.5548639",
"0.550375",
"0.54833263",
"0.5464564",
"0.54540735",
"0.544967",
"0.5404248",
"0.537921",
"0.5370245",
"0.53324234",
"0.53234303",
"0.5258537",
"0.52423066",
"0.52333105"... | 0.7224668 | 0 |
Sets a flag that is picked up by annotate to do the right thing in convert_string | def init_tags
add_tag :BOLD, '+b', '-b'
add_tag :EM, '+_', '-_'
add_tag :TT, '' , '' # we need in_tt information maintained
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flag_as(flag)\n raise ArgumentError if flag.class != String\n @flag = flag\n end",
"def annotate tag\n case tag\n when '+b' then @in_b = true\n when '-b' then @in_b = false\n when '+_' then @in_em = true\n when '-_' then @in_em = false\n end\n ''\n end",
"def convert_bool... | [
"0.6145389",
"0.55753714",
"0.5395166",
"0.53032416",
"0.52468526",
"0.5219027",
"0.517166",
"0.51676875",
"0.51621187",
"0.51492065",
"0.5049053",
"0.49879485",
"0.49623257",
"0.4954377",
"0.49487543",
"0.49346116",
"0.49331075",
"0.49312782",
"0.4924258",
"0.4901805",
"0.48... | 0.0 | -1 |
Makes heading text bold. | def accept_heading heading
use_prefix or @res << ' ' * @indent
@res << @headings[heading.level][0]
@in_b = true
@res << attributes(heading.text)
@in_b = false
@res << @headings[heading.level][1]
@res << "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bold; end",
"def bold; end",
"def bold_title=(value)\n @title_font.bold = value\n end",
"def bold(text)\n \"\\e[1m#{text}\\e[0m\"\n end",
"def to_bold_s\n \"\\e[1m#{titre}\\e[22m: #{summary}.\"\n end",
"def h3; self.green.bold end",
"def bold\n surround_with_ansi(ANSI... | [
"0.7310348",
"0.7310348",
"0.7272131",
"0.7246373",
"0.7193444",
"0.7148316",
"0.7147599",
"0.690961",
"0.6820676",
"0.67913866",
"0.6791382",
"0.67587626",
"0.67555386",
"0.6713131",
"0.66664475",
"0.66137606",
"0.660618",
"0.6593748",
"0.65857303",
"0.65430397",
"0.64826167... | 0.6262449 | 33 |
Turns on or off regexp handling for +convert_string+ | def annotate tag
case tag
when '+b' then @in_b = true
when '-b' then @in_b = false
when '+_' then @in_em = true
when '-_' then @in_em = false
end
''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_regexp_handling target\n convert_string super\n end",
"def prepare_for_regexp(output_str)\n split_lines(output_str).map do |str|\n Regexp.new(Regexp.escape(str), Regexp::EXTENDED)\n end\n end",
"def convert_regexp_handlings str, attrs, exclusive = false\n @regexp_handling... | [
"0.7596544",
"0.64609444",
"0.6256973",
"0.61130756",
"0.5810122",
"0.58086497",
"0.5758934",
"0.57453656",
"0.57089424",
"0.5619566",
"0.5619566",
"0.5619566",
"0.5619566",
"0.5619566",
"0.55823356",
"0.55144143",
"0.55009514",
"0.5481103",
"0.54807997",
"0.54333943",
"0.541... | 0.0 | -1 |
Calls convert_string on the result of convert_regexp_handling | def convert_regexp_handling target
convert_string super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_regexp_handling target\n return target.text if in_tt?\n\n handled = false\n\n @attributes.each_name_of target.type do |name|\n method_name = \"handle_regexp_#{name}\"\n\n if respond_to? method_name then\n target.text = public_send method_name, target\n handled = true\n ... | [
"0.61621433",
"0.6117495",
"0.60797083",
"0.5921017",
"0.5904083",
"0.5860615",
"0.5748629",
"0.57016134",
"0.57016134",
"0.57012814",
"0.5679994",
"0.5580432",
"0.5552709",
"0.5528886",
"0.54813766",
"0.5456318",
"0.54334235",
"0.54240453",
"0.5404381",
"0.5404381",
"0.53948... | 0.7880055 | 0 |
Adds bold or underline mixed with backspaces | def convert_string string
return string unless @in_b or @in_em
chars = if @in_b then
string.chars.map do |char| "#{char}\b#{char}" end
elsif @in_em then
string.chars.map do |char| "_\b#{char}" end
end
chars.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bold\n surround_with_ansi(ANSI_BOLD)\n end",
"def underline; end",
"def underline; end",
"def bold; end",
"def bold; end",
"def bold; \"\\e[1m#{self}\\e[22m\" end",
"def scr_bold\n print \"\\33[1m\"\nend",
"def bold(text)\n \"\\e[1m#{text}\\e[0m\"\n end",
"def bold(... | [
"0.66841966",
"0.6606141",
"0.6606141",
"0.6535296",
"0.6535296",
"0.6476371",
"0.64689386",
"0.64034176",
"0.6328201",
"0.6197189",
"0.61916006",
"0.6080968",
"0.60728806",
"0.6069851",
"0.59999925",
"0.59777874",
"0.59681284",
"0.5884883",
"0.58440113",
"0.58233273",
"0.573... | 0.0 | -1 |
Calls accept_blank_line on +visitor+ | def accept visitor
visitor.accept_blank_line self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_blank_line(blank_line)\n # @res << annotate(\"<p />\") << \"\\n\"\n end",
"def accept_blank_line blank_line\n @res << \"\\n\"\n end",
"def empty_line\n end",
"def parse_blank_line; end",
"def accept visitor\n visitor.accept_verbatim self\n end",
"def on_newline(p); end",
"def ... | [
"0.73821133",
"0.6891286",
"0.68176883",
"0.6802494",
"0.6592926",
"0.6003692",
"0.5979753",
"0.59144527",
"0.5895767",
"0.58949155",
"0.5834631",
"0.5829467",
"0.581192",
"0.581192",
"0.58001256",
"0.5781519",
"0.57772446",
"0.5772958",
"0.57518667",
"0.57518667",
"0.5733042... | 0.9191788 | 0 |
Calls accept_verbatim on +visitor+ | def accept visitor
visitor.accept_verbatim self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept visitor\n visitor.accept_raw self\n end",
"def accept(visitor); end",
"def accept(visitor); end",
"def accept_visitor(visitor)\n visit_method_name = \"visit#{basename(self.class.name.to_s.gsub(/::/, '/'))}\".to_sym\n visitor.send(visit_method_name,... | [
"0.78108567",
"0.7393878",
"0.7393878",
"0.6786489",
"0.6778437",
"0.6777843",
"0.6722631",
"0.672111",
"0.6708317",
"0.6702221",
"0.6549657",
"0.6348897",
"0.6334041",
"0.63031656",
"0.6283424",
"0.6283424",
"0.6283424",
"0.61671996",
"0.616196",
"0.6087348",
"0.6081604",
... | 0.89272064 | 0 |
Collapses 3+ newlines into two newlines | def normalize
parts = []
newlines = 0
@parts.each do |part|
case part
when /^\s*\n/ then
newlines += 1
parts << part if newlines == 1
else
newlines = 0
parts << part
end
end
parts.pop if parts.last =~ /\A\r?\n\z/
@parts = parts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def break_to_newline\n end",
"def wrap_text(txt, col = 80)\n txt.gsub(/(.{1,#{col}})( +|$\\n?)|(.{1,#{col}})/, \"\\\\1\\\\3\\n\") \nend",
"def text_breaking_wrap(txt, col = 80)\n return nil if txt.blank?\n txt.gsub(/(.{1,#{col}})( +|$\\n?)|(.{1,#{col}})/, \"\\\\1\\\\3 \")\n end",
"def ... | [
"0.6699791",
"0.66130847",
"0.65604645",
"0.6556691",
"0.6470587",
"0.64055705",
"0.6377218",
"0.6328202",
"0.6185991",
"0.617823",
"0.61531705",
"0.6090118",
"0.6085769",
"0.606895",
"0.60553604",
"0.60190785",
"0.6005628",
"0.5998517",
"0.59769833",
"0.5976618",
"0.5940973"... | 0.0 | -1 |
Is this verbatim section Ruby code? | def ruby?
@format ||= nil # TODO for older ri data, switch the tree to marshal_dump
@format == :ruby
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_multiline?\n @code =~ /\\n/\n end",
"def valid?\n return false if !raw.include?('Returns')\n return false if sections.size < 2\n true\n end",
"def is_continuing_line?(line)\n line.expunge =~ /^[^#]*\\\\\\s*(#.*)?$/\n #first use expunge to eliminate inline closures\n #t... | [
"0.67246103",
"0.6650923",
"0.66132456",
"0.6502931",
"0.6360687",
"0.6321913",
"0.62593323",
"0.62101173",
"0.62083024",
"0.6122184",
"0.6070147",
"0.6009531",
"0.6006431",
"0.59791535",
"0.596282",
"0.59587497",
"0.59441906",
"0.59213114",
"0.591566",
"0.5896393",
"0.589596... | 0.0 | -1 |
The text of the section | def text
@parts.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text\n @text\n end",
"def inner_text; end",
"def inner_text; end",
"def text\n @text\n end",
"def text\n @text[range]\n end",
"def teaser_text\n\t\t# assumption: html_content always starts with '<section>'\n\t\t# therefore I will find the content of the next '<section>'\n\... | [
"0.6997351",
"0.69215393",
"0.69215393",
"0.6918558",
"0.67116266",
"0.66953677",
"0.66953677",
"0.66948044",
"0.66234434",
"0.66182715",
"0.6573044",
"0.6554328",
"0.65376025",
"0.6502851",
"0.6490632",
"0.6487864",
"0.64846176",
"0.64846176",
"0.64846176",
"0.64846176",
"0.... | 0.6566213 | 11 |
Creates a new preprocessor for +input_file_name+ that will look for included files in +include_path+ | def initialize(input_file_name, include_path)
@input_file_name = input_file_name
@include_path = include_path
@options = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include(path)\n path = resolve_path(path)\n\n return if @files_included.include?(path)\n @files_included << path\n\n @env.logger.info \"- interpreting: #{path}\"\n\n file_contents = File.open(path) { |f| f.read }\n file_iseq = ::RubyVM::InstructionSequence.compile(file_contents)\n... | [
"0.57501507",
"0.5634822",
"0.5516534",
"0.5516534",
"0.5464967",
"0.52587014",
"0.5218853",
"0.52178633",
"0.5143512",
"0.51272935",
"0.5103852",
"0.5056879",
"0.5055802",
"0.5040904",
"0.5005229",
"0.4932999",
"0.49109143",
"0.4890283",
"0.4887593",
"0.48727486",
"0.4865856... | 0.63151646 | 0 |
Look for directives in the given +text+. Options that we don't handle are yielded. If the block returns false the directive is restored to the text. If the block returns nil or no block was given the directive is handled according to the registered directives. If a String was returned the directive is replaced with the... | def handle text, code_object = nil, &block
if RDoc::Comment === text then
comment = text
text = text.text
end
# regexp helper (square brackets for optional)
# $1 $2 $3 $4 $5
# [prefix][\]:directive:[spaces][param]newline
text = text.gsub(/^([ \t]*(?:#|\/?\*)?[ \t]*... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle(text)\n text.gsub!(/^([ \\t#]*):(\\w+):\\s*(.+)?\\n/) do \n prefix = $1\n directive = $2.downcase\n param = $3\n\n case directive\n when \"include\"\n filename = param.split[0]\n include_file(filename, prefix)\n\n else\n yi... | [
"0.5193317",
"0.49752447",
"0.47095945",
"0.4390843",
"0.43668622",
"0.43617123",
"0.4358727",
"0.434775",
"0.43057978",
"0.4280222",
"0.42597842",
"0.42529693",
"0.42504835",
"0.4234975",
"0.4226526",
"0.42205954",
"0.42107898",
"0.42087018",
"0.4204517",
"0.4198761",
"0.415... | 0.6736324 | 0 |
Performs the actions described by +directive+ and its parameter +param+. +code_object+ is used for directives that operate on a class or module. +prefix+ is used to ensure the replacement for handled directives is correct. +encoding+ is used for the include directive. For a list of directives in RDoc see RDoc::Markup. ... | def handle_directive prefix, directive, param, code_object = nil,
encoding = nil
blankline = "#{prefix.strip}\n"
directive = directive.downcase
case directive
when 'arg', 'args' then
return "#{prefix}:#{directive}: #{param}\n" unless code_object && code_object.kind_of?(RDoc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefix(code)\n @src << code\n end",
"def prefix=(prefix) @prefix = prefix end",
"def handle text, code_object = nil, &block\n if RDoc::Comment === text then\n comment = text\n text = text.text\n end\n\n # regexp helper (square brackets for optional)\n # $1 $2 $3 $... | [
"0.55014676",
"0.4903871",
"0.487274",
"0.48277715",
"0.47802567",
"0.47384095",
"0.4665434",
"0.46328032",
"0.46308434",
"0.45906657",
"0.45485917",
"0.45275006",
"0.44995815",
"0.44919845",
"0.44649938",
"0.44561315",
"0.44474196",
"0.44137958",
"0.44137958",
"0.44137958",
... | 0.69306755 | 0 |
Handles the :include: _filename_ directive. If the first line of the included file starts with '', and contains an encoding information in the form 'coding:' or 'coding=', it is removed. If all lines in the included file start with a '', this leading '' is removed before inclusion. The included content is indented like... | def include_file name, indent, encoding
full_name = find_include_file name
unless full_name then
warn "Couldn't find file to include '#{name}' from #{@input_file_name}"
return ''
end
content = RDoc::Encoding.read_file full_name, encoding, true
content = RDoc::Encoding.remove_magic_comm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include_file(name, indent)\n if (full_name = find_include_file(name))\n content = File.open(full_name) {|f| f.read}\n # strip leading '#'s, but only if all lines start with them\n if content =~ /^[^#]/\n content.gsub(/^/, indent)\n else\n content.gsub(/^#?/, i... | [
"0.70389307",
"0.61915857",
"0.5927222",
"0.5835836",
"0.5825668",
"0.5810332",
"0.57323986",
"0.571418",
"0.5563758",
"0.5548129",
"0.543274",
"0.54088485",
"0.53991777",
"0.5381098",
"0.53506726",
"0.53506726",
"0.5333191",
"0.5333191",
"0.5330643",
"0.5314858",
"0.53045106... | 0.7692603 | 0 |
Look for the given file in the directory containing the current file, and then in each of the directories specified in the RDOC_INCLUDE path | def find_include_file(name)
to_search = [File.dirname(@input_file_name)].concat @include_path
to_search.each do |dir|
full_name = File.join(dir, name)
stat = File.stat(full_name) rescue next
return full_name if stat.readable?
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find\r\n scanner = DirectoryScanner.new\r\n scanner.setBasedir(@context.root)\r\n scanner.setCaseSensitive(false)\r\n scanner.setIncludes(@includes.to_java :String) unless @includes.empty?\r\n scanner.setExcludes(@excludes.to_java :String) unless @excludes.empty?\r\n scanner.scan\r\n scann... | [
"0.68674",
"0.6603143",
"0.6575187",
"0.6404633",
"0.63221824",
"0.60786426",
"0.59497535",
"0.5921795",
"0.5921795",
"0.5867484",
"0.5862792",
"0.5848495",
"0.58468914",
"0.58415",
"0.58415",
"0.5839297",
"0.5808766",
"0.5792532",
"0.5783678",
"0.57584405",
"0.57565016",
"... | 0.59044665 | 9 |
Toggles +bits+ from +start+ to +length+ | def set_attrs(start, length, bits)
updated = false
for i in start ... (start+length)
if (@exclusive & @attrs[i]) == 0 || (@exclusive & bits) != 0
@attrs[i] |= bits
updated = true
end
end
updated
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def []=(i, v)\n raise ArgumentError, 'Invalid bit index' unless i >= 0 && i < size\n byte_i = i / 8\n bit_i = i % 8\n if !v || v == 0\n # clear bit\n @bytes[byte_i] = @bytes[byte_i] & (0xff ^ (0x80 >> bit_i))\n else\n # set bit\n @bytes[byte_i] = @bytes[byte_i]... | [
"0.55641943",
"0.55544144",
"0.54951996",
"0.54951996",
"0.54943174",
"0.5446886",
"0.54355973",
"0.54052895",
"0.53605705",
"0.5353689",
"0.5315847",
"0.52924037",
"0.5286499",
"0.5267909",
"0.5264273",
"0.5210713",
"0.5179937",
"0.517804",
"0.5121953",
"0.5118485",
"0.50891... | 0.6302424 | 0 |
Accesses flags for character +n+ | def [](n)
@attrs[n]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flags\n match(/Flags\\s+:\\s+(.+)$/).split rescue []\n end",
"def flags\n match(/Flags\\s+:\\s+(.+)$/).split rescue []\n end",
"def flag index=nil\n index ||= @cursor\n @flags[index] = !@flags[index]\n display\n end",
"def flags; end",
"def rchar\n\t\t\tcase status\n\t\t\twhen... | [
"0.5489776",
"0.5489776",
"0.54745287",
"0.5453454",
"0.54308635",
"0.5347371",
"0.5347371",
"0.5347371",
"0.5345544",
"0.5326292",
"0.5326292",
"0.53181416",
"0.53139627",
"0.52961916",
"0.52931005",
"0.5222211",
"0.5216528",
"0.5187185",
"0.51766425",
"0.5171031",
"0.516594... | 0.0 | -1 |
Creates a new include that will import +file+ from +include_path+ | def initialize file, include_path
@file = file
@include_path = include_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_include(path)\n @includes << path\n end",
"def add_include(path)\n @includes << path\n end",
"def include_from(path)\n mod = import(path, caller(1..1).first)\n add_module_methods(mod, self)\n add_module_constants(mod, self)\n end",
"def include(path)\n path = resolve_path(path)... | [
"0.7340052",
"0.7340052",
"0.6723716",
"0.6591494",
"0.64300996",
"0.6322546",
"0.632114",
"0.6299423",
"0.6299423",
"0.6281078",
"0.6279948",
"0.6261547",
"0.6117369",
"0.6042048",
"0.60307616",
"0.5921415",
"0.58681315",
"0.58258957",
"0.58028084",
"0.57261366",
"0.57117116... | 0.7012473 | 2 |
Creates a new attributes set. | def initialize
@regexp_handling = 1
@name_to_bitmap = [
[:_REGEXP_HANDLING_, @regexp_handling],
]
@next_bitmap = @regexp_handling << 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize attributes = {}\n @attributes = {}\n attributes.each { |attribute, value| set attribute, value }\n end",
"def set_attribute_set\n @attribute_set = AttributeSet.find(params[:id])\n end",
"def create\n @attribute_set = AttributeSet.new(attribute_set_params)\n\n respond_t... | [
"0.650648",
"0.64668036",
"0.64384025",
"0.6208315",
"0.62058675",
"0.6079256",
"0.6078248",
"0.60728925",
"0.60140866",
"0.59963894",
"0.599502",
"0.5989319",
"0.59460855",
"0.5945512",
"0.5941759",
"0.59321326",
"0.59106815",
"0.58973974",
"0.58850414",
"0.58473045",
"0.584... | 0.0 | -1 |
Returns a unique bit for +name+ | def bitmap_for name
bitmap = @name_to_bitmap.assoc name
unless bitmap then
bitmap = @next_bitmap
@next_bitmap <<= 1
@name_to_bitmap << [name, bitmap]
else
bitmap = bitmap.last
end
bitmap
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namehash(name)\n node = '0' * 64\n if (name != '')\n name.split('.').reverse.each do |label|\n node = sha3(node + sha3(label),encoding: :hex);\n end\n end\n '0x'+node\n end",
"def unique_name(name)\n \"#{name}_#{Time.now.to_i}\"\n end",
"def unique_name(name)\n \"#{name... | [
"0.68439484",
"0.6427404",
"0.6427404",
"0.6397669",
"0.6337399",
"0.6215909",
"0.61829126",
"0.61262226",
"0.6070995",
"0.6057314",
"0.6026253",
"0.593325",
"0.58474797",
"0.5779564",
"0.57264906",
"0.5710467",
"0.5693751",
"0.56843257",
"0.56635284",
"0.5640583",
"0.5638081... | 0.58447045 | 13 |
Returns a string representation of +bitmap+ | def as_string bitmap
return 'none' if bitmap.zero?
res = []
@name_to_bitmap.each do |name, bit|
res << name if (bitmap & bit) != 0
end
res.join ','
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_bitmap(_args = nil)\n raise BitmapNotInitializedError unless bitmap\n\n (1..bitmap.height).each do |y|\n line = (1..bitmap.width).map { |x| bitmap[x, y] }.join\n output.puts line\n end\n end",
"def to_s\n @image.map(&:join).join(\"\\n\")\n end",
"def to_s\n @image.map { |ro... | [
"0.7193948",
"0.66063315",
"0.65949595",
"0.65673876",
"0.6520634",
"0.63477635",
"0.6310037",
"0.6190269",
"0.599377",
"0.59883004",
"0.5889385",
"0.58833355",
"0.586549",
"0.5812504",
"0.5803831",
"0.5772537",
"0.5761511",
"0.5738878",
"0.57380074",
"0.57375157",
"0.5724503... | 0.8084255 | 0 |
yields each attribute name in +bitmap+ | def each_name_of bitmap
return enum_for __method__, bitmap unless block_given?
@name_to_bitmap.each do |name, bit|
next if bit == @regexp_handling
yield name.to_s if (bitmap & bit) != 0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_attribute # :yields: key\n @attrs.each_key { |k| yield(k) }\n end",
"def attributs()\n if block_given?\n rados_getxattrs.each { |key,value| \n yield key,value\n }\n else\n return rados_getxattrs\n end\n \n end",
"def bmAttributes\n self... | [
"0.64464754",
"0.6316688",
"0.60327524",
"0.5983306",
"0.5973785",
"0.59462976",
"0.59462976",
"0.59462976",
"0.58418065",
"0.5840128",
"0.5829677",
"0.5825163",
"0.5796454",
"0.57728",
"0.57420003",
"0.5732078",
"0.5671313",
"0.56481594",
"0.56348616",
"0.5603774",
"0.560377... | 0.6342097 | 1 |
Maps attributes to ANSI sequences | def init_tags
add_tag :BOLD, "\e[1m", "\e[m"
add_tag :TT, "\e[7m", "\e[m"
add_tag :EM, "\e[4m", "\e[m"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ansi_code( *attributes )\n\t\t\tattributes.flatten!\n\t\t\tattributes.collect! {|at| at.to_s }\n\t\t\treturn '' unless /(?:vt10[03]|xterm(?:-color)?|linux|screen)/i =~ ENV['TERM']\n\t\t\tattributes = ANSI_ATTRIBUTES.values_at( *attributes ).compact.join(';')\n\n\t\t\tif attributes.empty? \n\t\t\t\treturn ''\n\... | [
"0.684591",
"0.6810282",
"0.6810282",
"0.6810282",
"0.66927075",
"0.66616946",
"0.65048003",
"0.63499576",
"0.62401354",
"0.61780477",
"0.61337453",
"0.6071371",
"0.6042277",
"0.59951305",
"0.5839377",
"0.5784499",
"0.5778471",
"0.5776421",
"0.5745636",
"0.57103235",
"0.55744... | 0.0 | -1 |
Overrides indent width to ensure output lines up correctly. | def accept_list_item_end list_item
width = case @list_type.last
when :BULLET then
2
when :NOTE, :LABEL then
if @prefix then
@res << @prefix.strip
@prefix = nil
end
@res << "\n" unless res.length == 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indentation\n \" \" * @indent_size * @indent_level\n end",
"def indent; end",
"def indent; end",
"def indent; end",
"def indent; end",
"def indent; end",
"def indent\n return unless blank?\n write(' ' * @indentation)\n self\n end",
"def indent\n @__indent__ ||= 0\n ... | [
"0.7141556",
"0.710137",
"0.710137",
"0.710137",
"0.710137",
"0.710137",
"0.7048067",
"0.70206904",
"0.6941017",
"0.68698275",
"0.68698275",
"0.68241143",
"0.67663723",
"0.6691685",
"0.6635265",
"0.6591807",
"0.6590607",
"0.65470666",
"0.6545266",
"0.64790577",
"0.6452452",
... | 0.0 | -1 |
Adds coloring to note and label list items | def accept_list_item_start list_item
bullet = case @list_type.last
when :BULLET then
'*'
when :NOTE, :LABEL then
labels = Array(list_item.label).map do |label|
attributes(label).strip
end.join "\n"
labels << ":\n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_style(item); end",
"def recolor(tag, color)\r\n @listarea.tag_configure(tag, 'foreground' => color)\r\n end",
"def add_list_definition(style); end",
"def put_colour_to(item, color)\n item.colorize(color: :\"#{color}\")\n end",
"def ListView_GetInsertMarkColor(hwnd) send_listview_message(hw... | [
"0.69101286",
"0.624157",
"0.6132042",
"0.6043864",
"0.59790725",
"0.59426373",
"0.5786796",
"0.5664161",
"0.5647824",
"0.56003153",
"0.5581459",
"0.5566166",
"0.55625325",
"0.5479067",
"0.5479067",
"0.5477811",
"0.54720765",
"0.54682636",
"0.5466614",
"0.5406626",
"0.5387311... | 0.56015086 | 9 |
Starts accepting with a reset screen | def start_accepting
super
@res = ["\e[0m"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n\t\tdo_send('ARST 2')\n\tend",
"def reset_screen!\n clear_screen!\n move_to_home!\n end",
"def reset_window\n end",
"def reset!\n self.command = :reset\n end",
"def reset_screen\n clear_screen\n move_to_home\nend",
"def reset_screen\n clear_screen\n move_to_home\nend"... | [
"0.6804569",
"0.67569584",
"0.666672",
"0.66353655",
"0.6527203",
"0.6527203",
"0.65041876",
"0.6488795",
"0.64691883",
"0.64691883",
"0.645682",
"0.6388393",
"0.6376418",
"0.6346697",
"0.63420147",
"0.6329208",
"0.6314996",
"0.6309249",
"0.6295526",
"0.6232116",
"0.6184311",... | 0.0 | -1 |
Creates a new ToHtmlSnippet formatter that will cut off the input on the next word boundary after the given number of +characters+ or +paragraphs+ of text have been encountered. | def initialize options, characters = 100, paragraphs = 3, markup = nil
super options, markup
@character_limit = characters
@paragraph_limit = paragraphs
@characters = 0
@mask = 0
@paragraphs = 0
@markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snippet(sentence, desired_word_count = 3)\n sentence.sub(/\\A(?<first_x_words>(\\w+ ){#{desired_word_count}})(?<the_rest>.*)/, '\\k<first_x_words>...')\nend",
"def snippet(text, wordcount, omission)\n return '' if text.blank?\n text.split[0..(wordcount-1)].join(\" \") + (text.split.size > wordcount ? ... | [
"0.61930394",
"0.6066707",
"0.5785104",
"0.56262136",
"0.56243056",
"0.55606526",
"0.55485636",
"0.5515633",
"0.5513265",
"0.5475096",
"0.5453223",
"0.5436499",
"0.54117626",
"0.5389668",
"0.5374024",
"0.5355836",
"0.53543454",
"0.53480977",
"0.53375435",
"0.53330564",
"0.531... | 0.0 | -1 |
Adds +heading+ to the output as a paragraph | def accept_heading heading
@res << "<p>#{to_html heading.text}\n"
add_paragraph
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_section(heading, body)\n return '' if body.compact.empty?\n fancy_heading = Pry::Helpers::Text.bold(color(:heading, heading))\n Pry::Helpers.tablify_or_one_line(fancy_heading, body)\n end",
"def accept_heading heading\n level = [6, heading.level].min\n\n label = heading... | [
"0.7586888",
"0.707148",
"0.7057075",
"0.7012993",
"0.69909906",
"0.68982875",
"0.68936443",
"0.6760173",
"0.67414075",
"0.6738382",
"0.6712298",
"0.6609944",
"0.6602269",
"0.6602269",
"0.65999675",
"0.6597082",
"0.6548474",
"0.65470356",
"0.6544446",
"0.652932",
"0.64525527"... | 0.80833507 | 0 |
Finishes consumption of +list_item+ | def accept_list_item_end list_item
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finish_item(list_id:, item_id:)\n api_request(method: :put, path: \"lists/#{list_id}/items/#{item_id}/finish\")\n end",
"def finish_item(list_id:, id:)\n path = \"lists/#{list_id}/items/#{id}/finish\"\n request(method: :put, path: path)\n end",
"def finish_item(id:, list_id:)... | [
"0.7368562",
"0.7114058",
"0.698339",
"0.69327444",
"0.6434634",
"0.6417249",
"0.62921005",
"0.62344486",
"0.62287444",
"0.62108004",
"0.6207613",
"0.60137326",
"0.5880574",
"0.5876352",
"0.5866503",
"0.58460593",
"0.5830715",
"0.58268905",
"0.5800131",
"0.5789021",
"0.578862... | 0.64725566 | 4 |
Prepares the visitor for consuming +list_item+ | def accept_list_item_start list_item
@res << list_item_start(list_item, @list.last)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept visitor\n visitor.accept_list_start self\n\n @items.each do |item|\n item.accept visitor\n end\n\n visitor.accept_list_end self\n end",
"def start_special_list_item\n end",
"def accept_list_item_start(list_item)\n if tag = @in_list_entry.last\n @res << tag\n end\n\n ... | [
"0.65896237",
"0.6479231",
"0.63256234",
"0.62758464",
"0.6270702",
"0.616251",
"0.6032553",
"0.60239387",
"0.60038126",
"0.58058476",
"0.57764244",
"0.5761247",
"0.5689332",
"0.5668147",
"0.5644806",
"0.56354755",
"0.5590748",
"0.5590748",
"0.5520237",
"0.5503127",
"0.547215... | 0.6128728 | 6 |
Prepares the visitor for consuming +list+ | def accept_list_start list
@list << list.type
@res << html_list_name(list.type, true)
@in_list_entry.push ''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept visitor\n visitor.accept_list_start self\n\n @items.each do |item|\n item.accept visitor\n end\n\n visitor.accept_list_end self\n end",
"def parse_list; end",
"def parse_list; end",
"def start_accepting\n @res = []\n @in_list_entry = []\n @list = []\n end",
"def accep... | [
"0.6834632",
"0.6508309",
"0.6508309",
"0.6406663",
"0.6382121",
"0.61321205",
"0.60627145",
"0.60136473",
"0.5928757",
"0.59008354",
"0.5897962",
"0.5897034",
"0.58576816",
"0.5844002",
"0.58271235",
"0.56773317",
"0.5669278",
"0.5574543",
"0.5574543",
"0.5574543",
"0.557294... | 0.6025577 | 7 |
Adds +verbatim+ to the output | def accept_verbatim verbatim
throw :done if @characters >= @character_limit
input = verbatim.text.rstrip
text = truncate input
text << ' ...' unless text == input
super RDoc::Markup::Verbatim.new text
add_paragraph
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_verbatim verbatim\n indent = ' ' * (@indent + 4)\n\n verbatim.parts.each do |part|\n @res << indent unless part == \"\\n\"\n @res << part\n end\n\n @res << \"\\n\"\n end",
"def accept_verbatim verbatim\n indent = ' ' * (@indent + 2)\n\n verbatim.parts.each do |part|\n ... | [
"0.758583",
"0.75812066",
"0.68818635",
"0.6581288",
"0.58381754",
"0.58074284",
"0.5760813",
"0.5757308",
"0.56809396",
"0.5671564",
"0.5666861",
"0.5630463",
"0.56254965",
"0.55624896",
"0.5561371",
"0.5557841",
"0.5525999",
"0.55231726",
"0.5508087",
"0.54058015",
"0.53899... | 0.65176374 | 4 |
Prepares the visitor for HTML snippet generation | def start_accepting
super
@characters = 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markup_context=(_arg0); end",
"def preprocess!\n input_html\n nil\n end",
"def skip_html_injection=(_arg0); end",
"def markup_context; end",
"def prepare_render\n @content = '## Página no encontrada'\n event = Event.find(params[:event_id])\n if (event)\n pages = event.pages.s... | [
"0.63354605",
"0.6225026",
"0.6210805",
"0.5964015",
"0.5883397",
"0.588121",
"0.5808771",
"0.5807538",
"0.57661647",
"0.57661647",
"0.5746229",
"0.57201093",
"0.5710233",
"0.5705707",
"0.5662469",
"0.5638785",
"0.5635577",
"0.56244135",
"0.5620905",
"0.55908024",
"0.5573573"... | 0.0 | -1 |
Removes escaping from the crossreferences in +target+ | def handle_regexp_CROSSREF target
target.text.sub(/\A\\/, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_regexp_CROSSREF target\n text = target.text\n\n text.sub(/^\\\\/, '')\n end",
"def handle_regexp_SUPPRESSED_CROSSREF target\n text = target.text\n text = text.sub('\\\\', '') unless in_tt?\n text\n end",
"def handle_regexp_CROSSREF(target)\n name = target.text\n\n return name ... | [
"0.7689778",
"0.7124037",
"0.64376974",
"0.6374864",
"0.58612597",
"0.5396733",
"0.5349614",
"0.5334238",
"0.5273615",
"0.525486",
"0.5245094",
"0.5227352",
"0.5141183",
"0.5123761",
"0.5116772",
"0.5111413",
"0.5098243",
"0.4992115",
"0.4963313",
"0.49596503",
"0.49498722",
... | 0.7496968 | 1 |
Lists are paragraphs, but notes and labels have a separator | def list_item_start list_item, list_type
throw :done if @characters >= @character_limit
case list_type
when :BULLET, :LALPHA, :NUMBER, :UALPHA then
"<p>"
when :LABEL, :NOTE then
labels = Array(list_item.label).map do |label|
to_html label
end.join ', '
labels << " &mdas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bulletlist\n b = pbpaste\n a = b.remove(/^[\\t]*\\*/) # strip off bullet etc from beginning\n\n if a.scan(\"\\n\").size > 1 # determine whether to split on newline, space or comma\n splt = \"\\n\"\n elsif a.scan(\")\").size > a.scan(\"(\").size + 2\n splt = \")\"\n a.gsub!(/[, (]*\\d+\\)/,\")\")\... | [
"0.66039556",
"0.65096986",
"0.6429824",
"0.6392089",
"0.6366901",
"0.63524073",
"0.6351538",
"0.6334343",
"0.63120925",
"0.6283033",
"0.6277858",
"0.6262509",
"0.6228882",
"0.6204336",
"0.6200068",
"0.618788",
"0.61485386",
"0.61485386",
"0.6138762",
"0.6116158",
"0.6113121"... | 0.6163728 | 16 |
Returns just the text of +link+, +url+ is only used to determine the link type. | def gen_url url, text
if url =~ /^rdoc-label:([^:]*)(?::(.*))?/ then
type = "link"
elsif url =~ /([A-Za-z]+):(.*)/ then
type = $1
else
type = "http"
end
if (type == "http" or type == "https" or type == "link") and
url =~ /\.(gif|png|jpg|jpeg|bmp)$/ then
''
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_text(tag)\n $2 if tag =~ link_regex\n end",
"def link_text\n name\n end",
"def link(_link, _title, content)\n content.to_s\n end",
"def text_url\n link_uri\n end",
"def link\n node.at(\"link\").text\n end",
"def read_link(item)\n link = item.search(\"link:first... | [
"0.696798",
"0.69279957",
"0.6871552",
"0.6649154",
"0.6570205",
"0.6278152",
"0.62719536",
"0.62392074",
"0.6211436",
"0.6195417",
"0.6168669",
"0.614397",
"0.6131709",
"0.61249316",
"0.6100569",
"0.6070484",
"0.6045032",
"0.6005033",
"0.6001892",
"0.59805757",
"0.595466",
... | 0.56044465 | 44 |
In snippets, there are no lists | def html_list_name list_type, open_tag
''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def list(*) end",
"def anonymous_safelists; end",
"def anonymous_blocklists; end",
"def list\n end",
"def list\n end",
"def list\n end",
"def print_list; end",
"def list\n\n end",
"def parslets; end",... | [
"0.65094227",
"0.65094227",
"0.65094227",
"0.65094227",
"0.65094227",
"0.6470302",
"0.62873596",
"0.6278902",
"0.617867",
"0.617867",
"0.617867",
"0.6055585",
"0.604042",
"0.60348284",
"0.59373647",
"0.5926912",
"0.5924824",
"0.59155613",
"0.5882671",
"0.58787936",
"0.5877286... | 0.5680523 | 52 |
Throws +:done+ when paragraph_limit paragraphs have been encountered | def add_paragraph
@paragraphs += 1
throw :done if @paragraphs >= @paragraph_limit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paragraph_end; end",
"def parse_paragraph; end",
"def wrapped_by_paragraph; end",
"def paragraphs?\n false\n end",
"def paragraph; end",
"def accept_paragraph paragraph\n @res << \"\\n<p>\"\n text = paragraph.text @hard_break\n text = text.gsub(/\\r?\\n/, ' ')\n @res << to_html(text)\... | [
"0.6833898",
"0.65835166",
"0.6362248",
"0.61765736",
"0.61505604",
"0.6133578",
"0.6115641",
"0.6042069",
"0.6042069",
"0.6002409",
"0.5985149",
"0.5957461",
"0.5877497",
"0.5864004",
"0.58462477",
"0.58391106",
"0.5772363",
"0.5709612",
"0.56903446",
"0.5677357",
"0.5642836... | 0.731891 | 0 |
Converts flow items +flow+ | def convert_flow flow
throw :done if @characters >= @character_limit
res = []
@mask = 0
flow.each do |item|
case item
when RDoc::Markup::AttrChanger then
off_tags res, item
on_tags res, item
when String then
text = convert_string item
res << truncate(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_flow(flow)\n res = []\n\n flow.each do |item|\n case item\n when String then\n res << convert_string(item)\n when RDoc::Markup::AttrChanger then\n off_tags res, item\n on_tags res, item\n when RDoc::Markup::RegexpHandling then\n res << convert_regex... | [
"0.7717207",
"0.6888027",
"0.5787533",
"0.5450289",
"0.51856434",
"0.5180219",
"0.5115426",
"0.50285226",
"0.49490666",
"0.48697937",
"0.48391587",
"0.48236635",
"0.48161006",
"0.48161006",
"0.4800123",
"0.47941738",
"0.47879192",
"0.47874045",
"0.4785076",
"0.47528526",
"0.4... | 0.64480186 | 2 |
Maintains a bitmask to allow HTML elements to be closed properly. See RDoc::Markup::Formatter. | def on_tags res, item
@mask ^= item.turn_on
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @html_tags = {}\n @matching_word_pairs = {}\n @protectable = %w[<]\n @regexp_handlings = []\n @word_pair_map = {}\n @exclusive_bitmap = 0\n @attributes = RDoc::Markup::Attributes.new\n\n add_word_pair \"*\", \"*\", :BOLD, true\n add_word_pair \"_\", \"_\", :EM, true\n ... | [
"0.5147892",
"0.51423126",
"0.5067197",
"0.50369126",
"0.49924284",
"0.49759528",
"0.492892",
"0.49230465",
"0.48404184",
"0.48304862",
"0.48058707",
"0.4771108",
"0.4753424",
"0.4750837",
"0.47465593",
"0.47349438",
"0.47237533",
"0.47060013",
"0.4688042",
"0.467881",
"0.467... | 0.0 | -1 |
Maintains a bitmask to allow HTML elements to be closed properly. See RDoc::Markup::Formatter. | def off_tags res, item
@mask ^= item.turn_off
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @html_tags = {}\n @matching_word_pairs = {}\n @protectable = %w[<]\n @regexp_handlings = []\n @word_pair_map = {}\n @exclusive_bitmap = 0\n @attributes = RDoc::Markup::Attributes.new\n\n add_word_pair \"*\", \"*\", :BOLD, true\n add_word_pair \"_\", \"_\", :EM, true\n ... | [
"0.51476306",
"0.5142719",
"0.50683856",
"0.50354695",
"0.49919018",
"0.49749476",
"0.4927683",
"0.49223033",
"0.48404208",
"0.48314574",
"0.48071328",
"0.4770953",
"0.47561044",
"0.47519302",
"0.47450134",
"0.47341385",
"0.47248432",
"0.47087717",
"0.4687113",
"0.4679109",
"... | 0.0 | -1 |
Truncates +text+ at the end of the first word after the character_limit. | def truncate text
length = text.length
characters = @characters
@characters += length
return text if @characters < @character_limit
remaining = @character_limit - characters
text =~ /\A(.{#{remaining},}?)(\s|$)/m # TODO word-break instead of \s?
$1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def truncate(text, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n\n # support either old or Rails 2.2 calling convention:\n unless args.empty?\n options[:length] = args[0] || 30\n options[:omission] = args[1] || \"…\"\n end\n\n options = {:length => 30, :omission => ... | [
"0.7359911",
"0.7323814",
"0.73006475",
"0.7299759",
"0.7275298",
"0.7275298",
"0.7275298",
"0.7223354",
"0.7215305",
"0.72098285",
"0.716519",
"0.716519",
"0.7154729",
"0.7079416",
"0.7077498",
"0.7074699",
"0.70583284",
"0.70314264",
"0.7008998",
"0.69498444",
"0.68855727",... | 0.8621007 | 0 |
Creates a new ttonly formatter. | def initialize markup = nil
super nil, markup
add_tag :TT, nil, nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_formatter\n BunyanFormatterWithSilencedTimestamp.new\n end",
"def create_formatter\n ::Ougai::Formatters::Bunyan.new\n end",
"def initialize(*args)\n old_initialize(*args)\n self.formatter = SimpleFormatter.new\n end",
"def initialize\n @formatter = method(:default_fo... | [
"0.709733",
"0.63853574",
"0.5905449",
"0.58171564",
"0.5668756",
"0.56601125",
"0.5647512",
"0.5637615",
"0.5637615",
"0.5637615",
"0.5630736",
"0.56275994",
"0.5593045",
"0.55378926",
"0.55378926",
"0.5518488",
"0.5500335",
"0.54549474",
"0.5419214",
"0.5370084",
"0.535703"... | 0.488188 | 53 |
Adds tts from +block_quote+ to the output | def accept_block_quote block_quote
tt_sections block_quote.text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_block_quote block_quote\n @res << \"\\n<blockquote>\"\n\n block_quote.parts.each do |part|\n part.accept self\n end\n\n @res << \"</blockquote>\\n\"\n end",
"def inject_timestamp(chunk)\n stamped = +\"\"\n lines = chunk.each_line.to_a\n return stamped if lines.empty?\n\n ... | [
"0.5655928",
"0.5378203",
"0.5242126",
"0.51895607",
"0.50922513",
"0.50922513",
"0.5080846",
"0.50725716",
"0.48816246",
"0.48595124",
"0.48522776",
"0.47785205",
"0.47342193",
"0.47165093",
"0.4714207",
"0.4713672",
"0.47069162",
"0.46410018",
"0.46397567",
"0.46395266",
"0... | 0.58992225 | 0 |
Pops the list type for +list+ from list_type | def accept_list_end list
@list_type.pop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_list_end list\n @list_index.pop\n @list_type.pop\n @list_width.pop\n end",
"def unpack\n list_items\n @items.each do |type,list|\n @items.delete(type)\n end\n end",
"def start_special_list(list_type)\n end",
"def list_type\n base = self.class.to_s.split('::').las... | [
"0.6707295",
"0.6455553",
"0.6188168",
"0.6172146",
"0.60959816",
"0.6069331",
"0.5905996",
"0.5900907",
"0.58668",
"0.5860596",
"0.582313",
"0.57541007",
"0.5505879",
"0.5497879",
"0.54441965",
"0.54000527",
"0.5398113",
"0.5368986",
"0.53682137",
"0.53656805",
"0.5363092",
... | 0.73776436 | 0 |
Pushes the list type for +list+ onto list_type | def accept_list_start list
@list_type << list.type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_type=(list_type)\n if self.type != :list\n raise NodeError, \"can't set list_type for non-list\"\n end\n res = CMark.node_set_list_type(@pointer, list_type)\n if res == 0 then raise NodeError, \"could not set list_type\" end\n end",
"def list_type\n if self.type != :li... | [
"0.735241",
"0.68446016",
"0.65320826",
"0.6518747",
"0.649788",
"0.64727986",
"0.645823",
"0.6350203",
"0.63420963",
"0.63291365",
"0.626603",
"0.62616277",
"0.60790116",
"0.60790116",
"0.60790116",
"0.6038021",
"0.6036703",
"0.6033921",
"0.5952762",
"0.5901948",
"0.58977884... | 0.73843896 | 0 |
Prepares the visitor for consuming +list_item+ | def accept_list_item_start list_item
case @list_type.last
when :NOTE, :LABEL then
Array(list_item.label).map do |label|
tt_sections label
end.flatten
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept visitor\n visitor.accept_list_start self\n\n @items.each do |item|\n item.accept visitor\n end\n\n visitor.accept_list_end self\n end",
"def start_special_list_item\n end",
"def accept_list_item_start(list_item)\n if tag = @in_list_entry.last\n @res << tag\n end\n\n ... | [
"0.6588041",
"0.6479458",
"0.63250226",
"0.62759286",
"0.62688315",
"0.6161612",
"0.6128178",
"0.60287744",
"0.6024276",
"0.60027534",
"0.5803894",
"0.57766306",
"0.57589537",
"0.56914735",
"0.56674284",
"0.56436443",
"0.563605",
"0.5587911",
"0.5587911",
"0.55208653",
"0.550... | 0.51143605 | 60 |
Adds +paragraph+ to the output | def accept_paragraph paragraph
tt_sections(paragraph.text)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_paragraphs\n lines = seperate_lines\n max_index = lines.size - 1\n (1..(max_index)).each do |index|\n previous_line = lines[index -1]\n current_line = lines[index]\n next_line = lines[index + 1]\n if current_line[0] != (\"#\" || \"\\n\" || \"</p>\")\n if previous_line[0]... | [
"0.7715802",
"0.7444769",
"0.74170953",
"0.740991",
"0.7324625",
"0.72791845",
"0.725087",
"0.72088283",
"0.7184581",
"0.70468533",
"0.6982861",
"0.6929198",
"0.69060725",
"0.6876316",
"0.6866161",
"0.6851489",
"0.68245345",
"0.6813418",
"0.678874",
"0.6778175",
"0.67772543",... | 0.6707435 | 23 |
Does nothing to +markup_item+ because it doesn't have any userbuilt content | def do_nothing markup_item
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unfiltered_content; end",
"def unfiltered_content; end",
"def unfiltered_content; end",
"def extra_item?\n false\n end",
"def process_markup()\n [title,content].each do |text|\n next if !text\n clear_webpage(text).scan(PTN_MARKUP).map{|e|e[0].split(PTN_ELEMENT_SEP)}.flatten.each do |el... | [
"0.59932065",
"0.59932065",
"0.59932065",
"0.584048",
"0.5767902",
"0.5752309",
"0.5731446",
"0.56726706",
"0.56694525",
"0.5643747",
"0.5607672",
"0.55428845",
"0.550075",
"0.54760104",
"0.5459499",
"0.5447968",
"0.544413",
"0.5433145",
"0.5404382",
"0.53744245",
"0.5368629"... | 0.7826364 | 0 |
:nodoc: Extracts tt sections from +text+ | def tt_sections text
flow = @am.flow text.dup
flow.each do |item|
case item
when String then
@res << item if in_tt?
when RDoc::Markup::AttrChanger then
off_tags res, item
on_tags res, item
when RDoc::Markup::RegexpHandling then
@res << convert_regexp_hand... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan(text, pattern, &block)\n # convert tabs to spaces\n text.gsub!(/^(\\t+)/) {|tabs| ' ' * (8 * tabs.length)}\n\n text.scan(pattern).each do |matches|\n hash = Hash[pattern.names.zip(matches)]\n yield hash if block\n\n section = hash.delete('section')\n section ||= hash.delete('a... | [
"0.64675194",
"0.62222415",
"0.61429733",
"0.6063242",
"0.59248674",
"0.5855479",
"0.5843399",
"0.58432436",
"0.5786672",
"0.5755741",
"0.5742251",
"0.5705806",
"0.56707954",
"0.5642167",
"0.5627651",
"0.55922407",
"0.5576437",
"0.55694336",
"0.5567052",
"0.55452496",
"0.5532... | 0.8000387 | 0 |
Returns an Array of items that were wrapped in plus, tt or code. | def end_accepting
@res.compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_array(*body)\n @last_sexp =\n super(*body).tap do |sexp|\n next unless SPECIAL_LITERALS.include?(body.dig(0, :type))\n\n comments = sexp.dig(:body, 0).delete(:comments)\n sexp.merge!(comments: comments) if comments\n end\n end",
"def gradebook_items\n it... | [
"0.56683475",
"0.5277253",
"0.52153367",
"0.51622295",
"0.514337",
"0.5136644",
"0.51188064",
"0.5118468",
"0.51016587",
"0.5095967",
"0.5095486",
"0.5095129",
"0.5034688",
"0.502822",
"0.50233483",
"0.5018292",
"0.50012505",
"0.4998373",
"0.4988197",
"0.49833405",
"0.4933062... | 0.0 | -1 |
Prepares the visitor for gathering tt sections | def start_accepting
@res = []
@list_type = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tt_sections text\n flow = @am.flow text.dup\n\n flow.each do |item|\n case item\n when String then\n @res << item if in_tt?\n when RDoc::Markup::AttrChanger then\n off_tags res, item\n on_tags res, item\n when RDoc::Markup::RegexpHandling then\n @res << con... | [
"0.58716136",
"0.54745275",
"0.54100996",
"0.53779155",
"0.53745896",
"0.5344053",
"0.5309179",
"0.52775997",
"0.52042675",
"0.5194403",
"0.515041",
"0.5131934",
"0.5106004",
"0.50820154",
"0.5081603",
"0.5072731",
"0.50638306",
"0.5052851",
"0.50477153",
"0.5010348",
"0.5001... | 0.0 | -1 |
Creates a new Formatter | def initialize options, markup = nil
@options = options
@markup = markup || RDoc::Markup.new
@am = @markup.attribute_manager
@am.add_regexp_handling(/<br>/, :HARD_BREAK)
@attributes = @am.attributes
@attr_tags = []
@in_tt = 0
@tt_bit = @attributes.bitmap_for :TT
@hard_break ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_formatter\n BunyanFormatterWithSilencedTimestamp.new\n end",
"def formatted_with( new_formatter, &block )\n\t\treturn self.clone_with( formatter: new_formatter, &block )\n\tend",
"def formatted_with( new_formatter, &block )\n\t\treturn self.clone_with( formatter: new_formatter, &block )\n\te... | [
"0.7011571",
"0.6993294",
"0.6993294",
"0.6904319",
"0.6838535",
"0.68044525",
"0.67113614",
"0.6581889",
"0.6509594",
"0.64512104",
"0.64363146",
"0.6358304",
"0.6277945",
"0.6270914",
"0.6247333",
"0.6247333",
"0.6247333",
"0.6213281",
"0.620491",
"0.61387444",
"0.61328393"... | 0.0 | -1 |
Adds +document+ to the output | def accept_document document
document.parts.each do |item|
case item
when RDoc::Markup::Document then # HACK
accept_document item
else
item.accept self
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receive_document(doc)\n folder.documents << doc\n end",
"def write_to(doc);end",
"def add_to_doc(str)\n @out_doc << str\n end",
"def append(document)\n with_add_callbacks(document, already_related?(document)) do\n _target.push(document)\n characterize_... | [
"0.7059703",
"0.6832971",
"0.66740674",
"0.6652562",
"0.6592786",
"0.6583104",
"0.654427",
"0.6455473",
"0.6432101",
"0.6432101",
"0.6432101",
"0.6432101",
"0.6432101",
"0.6432101",
"0.6432101",
"0.6432101",
"0.6432101",
"0.6432101",
"0.6432101",
"0.6432101",
"0.6432101",
"... | 0.0 | -1 |
Adds a regexp handling for links of the form rdoc...: | def add_regexp_handling_RDOCLINK
@markup.add_regexp_handling(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_regexp_RDOCLINK target\n handle_rdoc_link target.text\n end",
"def handle_rdoc_link url\n case url\n when /^rdoc-ref:/ then\n $'\n when /^rdoc-label:footmark-(\\d+)/ then\n \"[^#{$1}]:\"\n when /^rdoc-label:foottext-(\\d+)/ then\n \"[^#{$1}]\"\n when /^rdoc-label:labe... | [
"0.7612134",
"0.74402976",
"0.71191233",
"0.7077987",
"0.68981016",
"0.65903276",
"0.65693396",
"0.64303666",
"0.6401618",
"0.6401618",
"0.63475794",
"0.6177609",
"0.6167207",
"0.6147319",
"0.6131172",
"0.60840523",
"0.60775274",
"0.60350096",
"0.60077983",
"0.59637463",
"0.5... | 0.7790786 | 0 |
Add a new set of tags for an attribute. We allow separate start and end tags for flexibility | def add_tag(name, start, stop)
attr = @attributes.bitmap_for name
@attr_tags << InlineTag.new(attr, start, stop)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_tag(name, start, stop)\n @attr_tags << InlineTag.new(SM::Attribute.bitmap_for(name), start, stop)\n end",
"def add_tag(name, start, stop)\n @attr_tags << InlineTag.new(RDoc::Markup::Attribute.bitmap_for(name), start, stop)\n end",
"def add_tag(name, start, stop)\n @attr_tags << InlineTag... | [
"0.74680674",
"0.73929805",
"0.73929805",
"0.6577171",
"0.6560368",
"0.6526055",
"0.6480313",
"0.6474845",
"0.63724846",
"0.6326631",
"0.62847245",
"0.6247176",
"0.6220775",
"0.6206034",
"0.6199303",
"0.61799407",
"0.61445665",
"0.6131669",
"0.6102035",
"0.6090484",
"0.607744... | 0.7296894 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.