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 |
|---|---|---|---|---|---|---|
Allows +tag+ to be decorated with additional information. | def annotate(tag)
tag
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def annotate(tag)\n tag\n end",
"def tag(tag); end",
"def tag(tag); end",
"def tag(new_tag); end",
"def tag!(tag)\n H[tag, attr, convert_children]\n end",
"def tag(_helper, **_props)\n raise NotImplementedError\n end",
"def attr_tag(text); end",
"def tag(tag, *a)\n if Hash ... | [
"0.6600969",
"0.65875363",
"0.65875363",
"0.6424743",
"0.64182794",
"0.63582516",
"0.6256518",
"0.6233644",
"0.62060475",
"0.6193754",
"0.6180175",
"0.6180175",
"0.6147186",
"0.61290735",
"0.6077349",
"0.6077349",
"0.60297257",
"0.60297257",
"0.6004767",
"0.5984626",
"0.59713... | 0.63797134 | 6 |
Converts flow items +flow+ | def convert_flow(flow)
res = []
flow.each do |item|
case item
when String then
res << convert_string(item)
when RDoc::Markup::AttrChanger then
off_tags res, item
on_tags res, item
when RDoc::Markup::RegexpHandling then
res << convert_regexp_handling(item)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_html item\n super convert_flow @am.flow item\n end",
"def convert_flow flow\n throw :done if @characters >= @character_limit\n\n res = []\n @mask = 0\n\n flow.each do |item|\n case item\n when RDoc::Markup::AttrChanger then\n off_tags res, item\n on_tags res, item\... | [
"0.6888474",
"0.64472497",
"0.57879245",
"0.54512465",
"0.5185543",
"0.5180181",
"0.51154053",
"0.5028972",
"0.49485007",
"0.4869732",
"0.48387015",
"0.48235482",
"0.48155266",
"0.48155266",
"0.47997105",
"0.4793893",
"0.478831",
"0.47882867",
"0.4785222",
"0.47521138",
"0.47... | 0.7716841 | 0 |
Converts added regexp handlings. See RDoc::Markupadd_regexp_handling | def convert_regexp_handling target
return target.text if in_tt?
handled = false
@attributes.each_name_of target.type do |name|
method_name = "handle_regexp_#{name}"
if respond_to? method_name then
target.text = public_send method_name, target
handled = true
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_regexp_handling target\n convert_string super\n end",
"def init_regexp_handlings\n # external links\n @markup.add_regexp_handling(/(?:link:|https?:|mailto:|ftp:|irc:|www\\.)\\S+\\w/,\n :HYPERLINK)\n init_link_notation_regexp_handlings\n end",
"def init_l... | [
"0.7289971",
"0.72700804",
"0.7141678",
"0.6985359",
"0.6938676",
"0.6800526",
"0.6181984",
"0.61243105",
"0.61151016",
"0.6059812",
"0.6059812",
"0.6059812",
"0.60577273",
"0.6023544",
"0.601816",
"0.59914064",
"0.59914064",
"0.59914064",
"0.5889933",
"0.5860892",
"0.5837965... | 0.7402994 | 0 |
Converts a string to be fancier if desired | def convert_string string
string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(str) return str end",
"def normalised(string)\n return unless string\n\n # single quotes\n string = string.gsub(/'/, '’')\n # double quotes\n string = string.gsub(/\"/, '“')\n # ellipsis\n string = string.gsub(/\\.\\.\\./, '…')\n # em-dash\n string = string.gsub(/---/, '—... | [
"0.74953866",
"0.7294643",
"0.72927755",
"0.69445366",
"0.6865047",
"0.67742115",
"0.67162377",
"0.67162377",
"0.66364634",
"0.6572692",
"0.65512073",
"0.65440357",
"0.6435313",
"0.6324339",
"0.62869656",
"0.62718064",
"0.6245319",
"0.6236692",
"0.62323403",
"0.6220695",
"0.6... | 0.7256799 | 3 |
Use ignore in your subclass to ignore the content of a node. We don't support raw nodes in ToNoRaw alias accept_raw ignore | def ignore *node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ignore_node(xn)\n @xn_context.process_children = false\n end",
"def visit_e(node)\n ignore_node(node)\n end",
"def visit_i(node)\n ignore_node(node)\n end",
"def visit_s(node)\n ignore_node(node)\n end",
"def ignore\n @ignore = true\n end",
"def ignore;... | [
"0.68575287",
"0.6670753",
"0.6506393",
"0.6467515",
"0.63631016",
"0.63502544",
"0.6336506",
"0.6172774",
"0.6136421",
"0.6098678",
"0.60475487",
"0.6024395",
"0.5849918",
"0.5833558",
"0.5833558",
"0.5789642",
"0.57176113",
"0.56974775",
"0.5680127",
"0.563904",
"0.562785",... | 0.78216666 | 0 |
Are we currently inside tt tags? | def in_tt?
@in_tt > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tt?(tag)\n tag.bit == @tt_bit\n end",
"def tt? tag\n tag.bit == @tt_bit\n end",
"def in_toc?(el); end",
"def element_is_text?\n !self[:is_tag]\n end",
"def should_spit_text?\n @tags_chain.size > 0 && \n #(not @text.empty?) &&\n [\"body\", \"p\", \"br\", \"b\", H... | [
"0.73572874",
"0.72275627",
"0.64697975",
"0.64284384",
"0.6296186",
"0.6228367",
"0.6185367",
"0.6076457",
"0.6042835",
"0.60034186",
"0.6001863",
"0.5964209",
"0.59328175",
"0.59328175",
"0.591041",
"0.59054214",
"0.58855796",
"0.5881557",
"0.5822224",
"0.58166474",
"0.5791... | 0.6782354 | 3 |
Turns on tags for +item+ on +res+ | def on_tags res, item
attr_mask = item.turn_on
return if attr_mask.zero?
@attr_tags.each do |tag|
if attr_mask & tag.bit != 0 then
res << annotate(tag.on)
@in_tt += 1 if tt? tag
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_tags res, item\n @mask ^= item.turn_on\n\n super\n end",
"def make_tags(item)\n\ttags_for(item, { :base_url => @site.config()[:base_url] + \"/tags/\" })\nend",
"def off_tags res, item\n @mask ^= item.turn_off\n\n super\n end",
"def saw_item(item); end",
"def off_tags res, item\n att... | [
"0.73774236",
"0.6095608",
"0.5937321",
"0.5839132",
"0.5794799",
"0.56837434",
"0.5536939",
"0.54946756",
"0.5389812",
"0.5368242",
"0.53101957",
"0.53086334",
"0.529635",
"0.5288267",
"0.52336365",
"0.5225861",
"0.52121913",
"0.519672",
"0.5168138",
"0.5165923",
"0.51233315... | 0.7229005 | 1 |
Turns off tags for +item+ on +res+ | def off_tags res, item
attr_mask = item.turn_off
return if attr_mask.zero?
@attr_tags.reverse_each do |tag|
if attr_mask & tag.bit != 0 then
@in_tt -= 1 if tt? tag
res << annotate(tag.off)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def off_tags res, item\n @mask ^= item.turn_off\n\n super\n end",
"def on_tags res, item\n @mask ^= item.turn_on\n\n super\n end",
"def remove( item)\n\t\titem.dtag( self.gettag)\n\tend",
"def each_tag_not_in_layout(marc_item)\n layout_tags\n marc_item.marc.each_data_tags_present do |tag|... | [
"0.73889846",
"0.63198304",
"0.59643877",
"0.56738317",
"0.5654071",
"0.5650125",
"0.5514109",
"0.5507549",
"0.54335105",
"0.5425303",
"0.53245974",
"0.53026754",
"0.5260172",
"0.51988685",
"0.51860005",
"0.5162172",
"0.51446563",
"0.5129319",
"0.5128381",
"0.51099545",
"0.51... | 0.71766764 | 1 |
Extracts and a scheme, url and an anchor id from +url+ and returns them. | def parse_url url
case url
when /^rdoc-label:([^:]*)(?::(.*))?/ then
scheme = 'link'
path = "##{$1}"
id = " id=\"#{$2}\"" if $2
when /([A-Za-z]+):(.*)/ then
scheme = $1.downcase
path = $2
when /^#/ then
else
scheme = 'http'
path = url
url ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_url(url)\n if url.match(%r|([^/]+)(/.*)|)\n host = $1\n uri = $2\n end\n # Gegebenenfalls Host und Portnummer trennen\n if host =~ /:/\n (host, port) = host.split(\":\")\n port = port.to_i\n else\n port = 80\n end\n # Alle drei Komponenten zurueckgeben\n [host, port, uri]\nend",
"def par... | [
"0.6705471",
"0.6705471",
"0.66697764",
"0.6462849",
"0.64155227",
"0.6415283",
"0.6374632",
"0.63711137",
"0.6209586",
"0.61906946",
"0.61504865",
"0.61415946",
"0.61295307",
"0.6123395",
"0.60216206",
"0.6020371",
"0.594104",
"0.5925596",
"0.58605546",
"0.5826127",
"0.58194... | 0.7534244 | 0 |
Is +tag+ a tt tag? | def tt? tag
tag.bit == @tt_bit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tt?(tag)\n tag.bit == @tt_bit\n end",
"def has_tag?(t)\n tags.include?(t)\n end",
"def tag?(t)\n return false if t.nil?\n if t =~ /^[a-zA-Z][\\w\\_\\-]+[a-zA-Z]$/\n return true\n end\n false\n end",
"def has_tag?(name); end",
"def hastag?(tag)\n @tags[tag] ? tru... | [
"0.839849",
"0.74133253",
"0.74104273",
"0.71466184",
"0.6648223",
"0.6590266",
"0.65722346",
"0.6559088",
"0.65386057",
"0.6500046",
"0.6481767",
"0.64372313",
"0.6436319",
"0.6399243",
"0.63511664",
"0.6350912",
"0.6339974",
"0.6218962",
"0.6198325",
"0.6187438",
"0.6106196... | 0.8186152 | 1 |
Adds +document+ to the output, using its heading cutoff if present | def accept_document document
@omit_headings_below = document.omit_headings_below
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_document_heading(document=@document, options={})\n render :partial => 'document_heading', :locals => { :document => document, :heading => document_heading }\n end",
"def render_document_heading(*args)\n options = args.extract_options!\n document = args.first\n tag = options.fetch(:t... | [
"0.6072846",
"0.6064449",
"0.59853226",
"0.5908119",
"0.5867205",
"0.581756",
"0.5740938",
"0.5738364",
"0.5724483",
"0.570217",
"0.5682",
"0.56621706",
"0.56621706",
"0.56298894",
"0.5621602",
"0.5609443",
"0.5560113",
"0.5552205",
"0.55461",
"0.552211",
"0.5519956",
"0.54... | 0.61164284 | 0 |
Adds +heading+ to the table of contents | def accept_heading heading
@res << heading unless suppressed? heading
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_heading(heading)\n table.heading = heading\n end",
"def library_heading_row\n content_tag(:tr) do\n column_tags(:th, *LIBRARY_COLUMNS, class: 'heading')\n end\n end",
"def headings_with_rows\n @headings + rows\n end",
"def accept_heading heading\n @res << \"<p>#{to_html... | [
"0.8760043",
"0.7195033",
"0.71759987",
"0.68786967",
"0.66917783",
"0.667031",
"0.66507304",
"0.6596565",
"0.64821607",
"0.64741135",
"0.64374834",
"0.640048",
"0.6399974",
"0.6399974",
"0.63985986",
"0.6390247",
"0.6367644",
"0.63660336",
"0.6320882",
"0.6303874",
"0.629435... | 0.6383803 | 16 |
Returns the table of contents | def end_accepting
@res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table_of_contents\n accept RDoc::Markup::ToTableOfContents.to_toc\n end",
"def get_table_contents(&block)\n TableBodyDSL.new(&block).elements\n end",
"def table\r\n\t\tempty = Hash.new\r\n\t\tif @text.length < 2\r\n\t\t\treturn empty\r\n\t\tend\r\n\t\ttableHelper(@tree, \"\")\r\n\t\... | [
"0.7873859",
"0.7310896",
"0.70160437",
"0.681319",
"0.66878074",
"0.66712445",
"0.66070163",
"0.660651",
"0.66063166",
"0.64813244",
"0.6460978",
"0.64555436",
"0.6316368",
"0.63136005",
"0.6298156",
"0.62771446",
"0.62630594",
"0.6255811",
"0.6239554",
"0.6219212",
"0.62171... | 0.0 | -1 |
Prepares the visitor for text generation | def start_accepting
@omit_headings_below = nil
@res = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visit_Text(text, *rest)\n end",
"def accept(visitor); end",
"def accept(visitor); end",
"def finish_preparations\n munge\n @document.attributes['alternative_language_counter'] = @counter + 1\n @listing_text = @listing.convert\n @colist_text = @colist&.convert\n end",
"def so... | [
"0.5764863",
"0.56980884",
"0.56980884",
"0.5629763",
"0.5565271",
"0.5504113",
"0.5466755",
"0.5456021",
"0.5439147",
"0.5390395",
"0.5360831",
"0.5352435",
"0.5302356",
"0.52940613",
"0.5286382",
"0.5285246",
"0.52846324",
"0.52846324",
"0.52673686",
"0.52387875",
"0.522994... | 0.0 | -1 |
Returns true if +heading+ is below the display threshold | def suppressed? heading
return false unless @omit_headings_below
heading.level > @omit_headings_below
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heading?\n self.is_heading?\n end",
"def health_below_threshold?\n (plugins[Character].current_health.to_f / plugins[Character].total_health.to_f) * 100 < @health_threshold_percentage\n end",
"def valid_heading?\n elements = @parser.find('h1,h2,h3,h4,h5,h6').list_results\n last_le... | [
"0.69938207",
"0.61445755",
"0.6090418",
"0.60480404",
"0.5891242",
"0.5853071",
"0.58417225",
"0.5818169",
"0.5804844",
"0.57324666",
"0.57295567",
"0.5721109",
"0.56907284",
"0.5666109",
"0.56578064",
"0.5648181",
"0.5648181",
"0.5546749",
"0.5490267",
"0.54761624",
"0.5465... | 0.69943255 | 0 |
:section: Creates a new formatter that will output HTML | def initialize options, markup = nil
super
@code_object = nil
@from_path = ''
@in_list_entry = nil
@list = nil
@th = nil
@hard_break = "<br>\n"
init_regexp_handlings
init_tags
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatter; end",
"def formatter; end",
"def formatter; end",
"def call\n formatter.section_one(document, report_data)\n formatter.section_two(document, report_data)\n formatter.render(document)\n end",
"def formatter\n @formatter.formatter\n end",
"def formatter()\n @formatter\... | [
"0.6785419",
"0.6785419",
"0.6785419",
"0.67724705",
"0.6650577",
"0.64519405",
"0.6437907",
"0.6410823",
"0.63962495",
"0.63828695",
"0.6277861",
"0.6202684",
"0.6189096",
"0.61541307",
"0.61367446",
"0.6052019",
"0.60507065",
"0.6017912",
"0.6017912",
"0.5968382",
"0.594077... | 0.0 | -1 |
:section: Regexp Handling These methods are used by regexp handling markup added by RDoc::Markupadd_regexp_handling. Adds regexp handlings. | def init_regexp_handlings
# external links
@markup.add_regexp_handling(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/,
:HYPERLINK)
init_link_notation_regexp_handlings
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_regexp_handling pattern, name, exclusive = false\n bitmap = @attributes.bitmap_for(name)\n @regexp_handlings << [pattern, bitmap]\n @exclusive_bitmap |= bitmap if exclusive\n end",
"def add_regexp_handling(pattern, name)\n @attribute_manager.add_regexp_handling(pattern, name)\n end",
"def... | [
"0.7436779",
"0.70482725",
"0.7024456",
"0.69965",
"0.68977576",
"0.6858122",
"0.6858122",
"0.67341757",
"0.661297",
"0.66123956",
"0.6578799",
"0.6578799",
"0.6578799",
"0.6504844",
"0.6504844",
"0.6504844",
"0.6427554",
"0.6393671",
"0.6347984",
"0.6347057",
"0.6347057",
... | 0.7421498 | 1 |
Adds regexp handlings about link notations. | def init_link_notation_regexp_handlings
add_regexp_handling_RDOCLINK
add_regexp_handling_TIDYLINK
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_regexp_handlings\n # external links\n @markup.add_regexp_handling(/(?:link:|https?:|mailto:|ftp:|irc:|www\\.)\\S+\\w/,\n :HYPERLINK)\n init_link_notation_regexp_handlings\n end",
"def linkify( text )\n s = text.to_s\n s.gsub!( @generic_URL_regexp, '\\1<a href=\... | [
"0.82190853",
"0.64036024",
"0.6363058",
"0.62913096",
"0.6280791",
"0.62482625",
"0.6239983",
"0.62357116",
"0.6183883",
"0.61554086",
"0.6123424",
"0.6110779",
"0.60949725",
"0.5979248",
"0.5967304",
"0.5967304",
"0.5966812",
"0.59550476",
"0.5921902",
"0.5904366",
"0.58948... | 0.8264824 | 0 |
+target+ is a potential link. The following schemes are handled: mailto::: Inserted asis. http::: Links are checked to see if they reference an image. If so, that image gets inserted using an tag. Otherwise a conventional is used. link::: Reference to a local file relative to the output directory. | def handle_regexp_HYPERLINK(target)
url = target.text
gen_url url, url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link(target)\n File.join(site.url, target)\n end",
"def link(text, target, attributes = {})\n if target.is_a? Fixnum\n attributes[:rel] = rel_value(target)\n target = url(target)\n end\n @template.link_to(text, target, attributes)\n end",
"def link(text, target, attr... | [
"0.7725184",
"0.69841546",
"0.6978359",
"0.67925066",
"0.67293555",
"0.66758156",
"0.6654293",
"0.6598821",
"0.6386675",
"0.63084114",
"0.63071895",
"0.625608",
"0.6250172",
"0.62418336",
"0.6237891",
"0.6236146",
"0.62230164",
"0.62045056",
"0.6165895",
"0.6164067",
"0.61188... | 0.60499525 | 24 |
+target+ is an rdocschemed link that will be converted into a hyperlink. For the +rdocref+ scheme the named reference will be returned without creating a link. For the +rdoclabel+ scheme the footnote and label prefixes are stripped when creating a link. All other contents will be linked verbatim. | def handle_regexp_RDOCLINK target
handle_RDOCLINK target.text
end | {
"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 hre... | [
"0.7016477",
"0.70156944",
"0.6687976",
"0.65871674",
"0.65703857",
"0.63115585",
"0.6122284",
"0.6040776",
"0.5994679",
"0.59803236",
"0.58889616",
"0.5858711",
"0.58338875",
"0.5798102",
"0.5784788",
"0.5749643",
"0.5748941",
"0.5729707",
"0.56238776",
"0.56054074",
"0.5547... | 0.0 | -1 |
:section: Visitor These methods implement the HTML visitor. Prepares the visitor for HTML generation | def start_accepting
@res = []
@in_list_entry = []
@list = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_html\n # the individual descriptions for files and classes\n gen_into(@files)\n gen_into(@classes)\n # and the index files\n gen_file_index\n gen_class_index\n gen_method_index\n gen_main_index\n\n # this method is defined in the template file\n write_extra_pages if defin... | [
"0.6602494",
"0.65736216",
"0.6549103",
"0.6373491",
"0.6373491",
"0.62506205",
"0.61459446",
"0.60402083",
"0.6000229",
"0.6000229",
"0.5995615",
"0.5848901",
"0.579885",
"0.57955295",
"0.57915187",
"0.5788225",
"0.5767782",
"0.5672281",
"0.5664882",
"0.5661813",
"0.5655329"... | 0.0 | -1 |
Returns the generated output | def end_accepting
@res.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"... | [
"0.7732727",
"0.7732727",
"0.7732727",
"0.7732727",
"0.7732727",
"0.7732727",
"0.7732727",
"0.7732727",
"0.7732727",
"0.7732727",
"0.7732727",
"0.7732727",
"0.7732727",
"0.7732727",
"0.7732727",
"0.74951255",
"0.7472923",
"0.73920155",
"0.73635674",
"0.7334625",
"0.7274417",
... | 0.0 | -1 |
Adds +block_quote+ to the output | def accept_block_quote block_quote
@res << "\n<blockquote>"
block_quote.parts.each do |part|
part.accept self
end
@res << "</blockquote>\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_block_quote block_quote\n @indent += 2\n\n block_quote.parts.each do |part|\n @prefix = '> '\n\n part.accept self\n end\n\n @indent -= 2\n end",
"def accept_block_quote block_quote\n tt_sections block_quote.text\n end",
"def set_quote\n \n end",
"def add_language... | [
"0.6634687",
"0.6397398",
"0.63214815",
"0.6255358",
"0.62122804",
"0.61267924",
"0.5988515",
"0.59820163",
"0.5796364",
"0.57934093",
"0.5782247",
"0.5775004",
"0.57429194",
"0.57339174",
"0.57305986",
"0.56994194",
"0.5664842",
"0.5631144",
"0.56310827",
"0.5623242",
"0.561... | 0.7424158 | 0 |
Adds +paragraph+ to the output | def accept_paragraph paragraph
@res << "\n<p>"
text = paragraph.text @hard_break
text = text.gsub(/\r?\n/, ' ')
@res << to_html(text)
@res << "</p>\n"
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.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.6773069",
... | 0.72088283 | 7 |
Adds +verbatim+ to the output | def accept_verbatim verbatim
text = verbatim.text.rstrip
klass = nil
content = if verbatim.ruby? or parseable? text then
begin
tokens = RDoc::Parser::RipperStateLex.parse text
klass = ' class="ruby"'
result = RDoc::TokenStream.to_html... | {
"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.6581288",
"0.65176374",
"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.68818635 | 2 |
Adds +rule+ to the output | def accept_rule rule
@res << "<hr>\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_rule(rule)\n @rules << rule\n LOGGER.info \"Adding rule: #{rule.readable}\"\n end",
"def add(rule); end",
"def << rule\n rules << rule\n nil\n end",
"def add_rule(rule)\n @rulebook.add_rule rule\n end",
"def <<(rule); end",
"def add_rule(rule)\n new_rules = rules.du... | [
"0.77868515",
"0.77113026",
"0.7530972",
"0.73635674",
"0.7303412",
"0.7163099",
"0.70910716",
"0.69768625",
"0.6948735",
"0.6901686",
"0.68531686",
"0.6832126",
"0.6701292",
"0.6687976",
"0.66323453",
"0.66046464",
"0.6600563",
"0.6600563",
"0.6600563",
"0.6599418",
"0.65287... | 0.6970356 | 8 |
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 false
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.6025577",
"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.5572944... | 0.60136473 | 8 |
Finishes consumption of +list+ | def accept_list_end(list)
@list.pop
if tag = @in_list_entry.pop
@res << tag
end
@res << html_list_name(list.type, false) << "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(list); end",
"def closed_end_list(list); end",
"def flush\n @lists = nil\n end",
"def saw_end_list(list); end",
"def finish_item(list_id:, id:)\n path = \"lists/#{list_id}/items/#{id}/finish\"\n request(method: :put, path: path)\n end",
"def final(list)\n\tputs \"Grocer... | [
"0.63480574",
"0.6280506",
"0.6153483",
"0.6075285",
"0.6070111",
"0.5965878",
"0.5864178",
"0.58611083",
"0.58583593",
"0.5790192",
"0.5736218",
"0.57052475",
"0.568907",
"0.566995",
"0.5664627",
"0.56402636",
"0.56378156",
"0.5619682",
"0.56174755",
"0.560082",
"0.5583078",... | 0.56635255 | 15 |
Prepares the visitor for consuming +list_item+ | def accept_list_item_start(list_item)
if tag = @in_list_entry.last
@res << tag
end
@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 saw_item(item); end",
"def accept visitor\n visitor.accept_list_item_start self\n\n @parts.ea... | [
"0.6588041",
"0.6479458",
"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.5501308",
"0.5472... | 0.63250226 | 2 |
Finishes consumption of +list_item+ | def accept_list_item_end(list_item)
@in_list_entry[-1] = list_end_for(@list.last)
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.7369168",
"0.7114417",
"0.69839805",
"0.69334286",
"0.6472272",
"0.6435207",
"0.6418733",
"0.62944436",
"0.6234189",
"0.623005",
"0.6210294",
"0.6208338",
"0.6014709",
"0.588178",
"0.58659834",
"0.5846448",
"0.5828969",
"0.5826774",
"0.58007467",
"0.5789878",
"0.57891315",... | 0.5875888 | 14 |
Adds +blank_line+ to the output | def accept_blank_line(blank_line)
# @res << annotate("<p />") << "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blank_line\n output \"\"\n end",
"def accept_blank_line blank_line\n @res << \"\\n\"\n end",
"def empty_line\n end",
"def empty_line\r\n puts \"\\n\"\r\n end",
"def print_empty_line\n print_in_same_line(\" \... | [
"0.83867013",
"0.8041081",
"0.79575413",
"0.79298115",
"0.76295817",
"0.745943",
"0.71074235",
"0.6943462",
"0.68982065",
"0.67824274",
"0.6764752",
"0.67471737",
"0.6721258",
"0.66603404",
"0.64678186",
"0.6462303",
"0.6458836",
"0.64288294",
"0.63712025",
"0.63294554",
"0.6... | 0.75918937 | 5 |
Adds +heading+ to the output. The headings greater than 6 are trimmed to level 6. | def accept_heading heading
level = [6, heading.level].min
label = heading.label @code_object
@res << if @options.output_decoration
"\n<h#{level} id=\"#{label}\">"
else
"\n<h#{level}>"
end
@res << to_html(heading.text)
unless @options.pipe then
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_heading level\n heading = RDoc::Markup::Heading.new level, text\n skip :NEWLINE\n\n heading\n end",
"def add_heading(heading)\n table.heading = heading\n end",
"def accept_heading heading\n use_prefix or @res << ' ' * @indent\n @res << @headings[heading.level][0]\n @in_b = ... | [
"0.6893213",
"0.6883779",
"0.67771405",
"0.67291164",
"0.67232656",
"0.67032635",
"0.6645663",
"0.6633412",
"0.6552686",
"0.6459453",
"0.6380232",
"0.6331144",
"0.6302452",
"0.6270485",
"0.61355925",
"0.6012599",
"0.60092574",
"0.6006842",
"0.6000606",
"0.59186953",
"0.589091... | 0.69852924 | 0 |
Adds +raw+ to the output | def accept_raw raw
@res << raw.parts.join("\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw\n @lines.map(&:line).join(\"\\n\") << \"\\n\"\n end",
"def _raw\n @_raw\n end",
"def raw\n @raw ||= ''\n end",
"def raw\n #\n end",
"def raw; end",
"def raw; end",
"def raw; end",
"def raw; end",
"def raw\n @raw = true\n self\n end"... | [
"0.69652355",
"0.6852248",
"0.67796314",
"0.6770999",
"0.66836476",
"0.66836476",
"0.66836476",
"0.66836476",
"0.66738755",
"0.6653057",
"0.6445832",
"0.64133656",
"0.6391651",
"0.61996055",
"0.6117128",
"0.6100107",
"0.6065103",
"0.6034815",
"0.60326034",
"0.6016972",
"0.594... | 0.7309811 | 1 |
Adds +table+ to the output | def accept_table header, body, aligns
@res << "\n<table role=\"table\">\n<thead>\n<tr>\n"
header.zip(aligns) do |text, align|
@res << '<th'
@res << ' align="' << align << '"' if align
@res << '>' << CGI.escapeHTML(text) << "</th>\n"
end
@res << "</tr>\n</thead>\n<tbody>\n"
body.eac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put_table(table)\n table.each {|row| puts row.join(' ') }\nend",
"def add_table(table)\n return table if @tables.has_value? table\n @tables[table.name.to_s] = table\n table.owner= self\n table\n end",
"def table(header, values, io = $stdout)\n self.puts(io, MiGA.tabulate(header,... | [
"0.70797366",
"0.68021524",
"0.66586685",
"0.6621356",
"0.6520911",
"0.6520911",
"0.6520911",
"0.6520911",
"0.651105",
"0.65076786",
"0.6506999",
"0.64365625",
"0.6407687",
"0.63761634",
"0.6353817",
"0.6333305",
"0.63209975",
"0.63006884",
"0.6294524",
"0.6248145",
"0.623268... | 0.0 | -1 |
:section: Utilities CGIescapes +text+ | def convert_string(text)
CGI.escapeHTML text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cgi_escape(input); end",
"def escape_text(text)\n text\n end",
"def html_escape(text)\n Rack::Utils.escape_html(text)\n end",
"def html_escape(text)\n text.to_s.gsub(/[\\\"><&]/) { |s| HTML_ESCAPE[s] }\n end",
"def escape(string); end",
"def uri_escape(input); end",
"def escape_text... | [
"0.83069474",
"0.7830497",
"0.76020926",
"0.7345727",
"0.73257303",
"0.72499907",
"0.72247666",
"0.7182544",
"0.7181869",
"0.71747375",
"0.70970863",
"0.7088029",
"0.70723057",
"0.7069992",
"0.6965254",
"0.6963662",
"0.6950788",
"0.6938547",
"0.6931097",
"0.68863666",
"0.6849... | 0.76458585 | 2 |
Generate a link to +url+ with content +text+. Handles the special cases for img: and link: described under handle_regexp_HYPERLINK | def gen_url url, text
scheme, url, id = parse_url url
if %w[http https link].include?(scheme) and
url =~ /\.(gif|png|jpg|jpeg|bmp)$/ then
"<img src=\"#{url}\" />"
else
if scheme != 'link' and %r%\A((?!https?:)(?:[^/#]*/)*+)([^/#]+)\.(rb|rdoc|md)(?=\z|#)%i =~ url
url = "#$1#{$2.tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_url(url, text)\n if url =~ /([A-Za-z]+):(.*)/ then\n type = $1\n path = $2\n else\n type = \"http\"\n path = url\n url = \"http://#{url}\"\n end\n\n if type == \"link\" then\n url = if path[0, 1] == '#' then # is this meaningful?\n path\n e... | [
"0.7988852",
"0.77669513",
"0.77020186",
"0.76410055",
"0.762898",
"0.7402638",
"0.72969997",
"0.72361344",
"0.718561",
"0.71748155",
"0.7158779",
"0.7148174",
"0.7083953",
"0.70736927",
"0.70635504",
"0.7061831",
"0.7058717",
"0.7014959",
"0.69593817",
"0.6936345",
"0.693559... | 0.7749465 | 2 |
Determines the HTML list element for +list_type+ and +open_tag+ | def html_list_name(list_type, open_tag)
tags = LIST_TYPE_TO_HTML[list_type]
raise RDoc::Error, "Invalid list type: #{list_type.inspect}" unless tags
tags[open_tag ? 0 : 1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_list_name list_type, open_tag\n ''\n end",
"def list_type\n case @node.name\n when 'ol' then :ordered\n when 'ul' then :unordered\n end\n end",
"def list_item_start(list_item, list_type)\n case list_type\n when :BULLET, :LALPHA, :NUMBE... | [
"0.7999354",
"0.75879633",
"0.7207911",
"0.6776171",
"0.66512245",
"0.657534",
"0.6466799",
"0.64133537",
"0.63783574",
"0.6355639",
"0.6345706",
"0.6336929",
"0.6323002",
"0.62939614",
"0.6285982",
"0.6175236",
"0.61714613",
"0.6153238",
"0.61497086",
"0.6128919",
"0.6107015... | 0.77581054 | 1 |
Maps attributes to HTML tags | def init_tags
add_tag :BOLD, "<strong>", "</strong>"
add_tag :TT, "<code>", "</code>"
add_tag :EM, "<em>", "</em>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_attributes(attr); end",
"def attr_tag(text); end",
"def tag(tag_name, content, attributes = {})\n partials = attributes.map do |key, value|\n \"#{key}=\\\"#{value}\\\"\"\n end\n\n html_attributes = partials.join(' ')\n\n \"<#{tag_name} #{html_attributes}>#{content}</#{tag_name}>\"\nend",
"def... | [
"0.77971584",
"0.7326789",
"0.7173453",
"0.71715516",
"0.7099935",
"0.70990443",
"0.70961815",
"0.70314765",
"0.6855859",
"0.67514706",
"0.6749143",
"0.67338216",
"0.67338216",
"0.67224914",
"0.67115074",
"0.6700695",
"0.66192317",
"0.6574409",
"0.65026623",
"0.6454356",
"0.6... | 0.0 | -1 |
Returns the HTML tag for +list_type+, possible using a label from +list_item+ | def list_item_start(list_item, list_type)
case list_type
when :BULLET, :LALPHA, :NUMBER, :UALPHA then
"<li>"
when :LABEL, :NOTE then
Array(list_item.label).map do |label|
"<dt>#{to_html label}\n"
end.join << "<dd>"
else
raise RDoc::Error, "Invalid list type: #{list_type.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_list_name(list_type, open_tag)\n tags = LIST_TYPE_TO_HTML[list_type]\n raise RDoc::Error, \"Invalid list type: #{list_type.inspect}\" unless tags\n tags[open_tag ? 0 : 1]\n end",
"def list_end_for(list_type)\n case list_type\n when :BULLET, :LALPHA, :NUMBER, :UALPHA then\n \"</li>\"... | [
"0.7109009",
"0.6928041",
"0.6865643",
"0.6837244",
"0.63912785",
"0.6338896",
"0.6283188",
"0.6267467",
"0.6267467",
"0.6168321",
"0.6157083",
"0.61380106",
"0.60980844",
"0.6064766",
"0.6056168",
"0.60055643",
"0.5985695",
"0.5929402",
"0.5921799",
"0.59053147",
"0.58971936... | 0.76508504 | 0 |
Returns the HTML endtag for +list_type+ | def list_end_for(list_type)
case list_type
when :BULLET, :LALPHA, :NUMBER, :UALPHA then
"</li>"
when :LABEL, :NOTE then
"</dd>"
else
raise RDoc::Error, "Invalid list type: #{list_type.inspect}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_list_end(list)\n @list.pop\n if tag = @in_list_entry.pop\n @res << tag\n end\n @res << html_list_name(list.type, false) << \"\\n\"\n end",
"def html_list_name list_type, open_tag\n ''\n end",
"def html_list_name(list_type, open_tag)\n tags = LIST_TYPE_TO_HTML[list_type]\n ... | [
"0.74681646",
"0.69648147",
"0.6806225",
"0.6751164",
"0.6641787",
"0.65580785",
"0.6450057",
"0.6392124",
"0.6375246",
"0.6317083",
"0.6304719",
"0.62390065",
"0.6217441",
"0.6207967",
"0.61950904",
"0.61813456",
"0.61721414",
"0.61241585",
"0.61191034",
"0.60336536",
"0.602... | 0.85403776 | 0 |
Returns true if text is valid ruby syntax | def parseable? text
verbose, $VERBOSE = $VERBOSE, nil
eval("BEGIN {return true}\n#{text}")
rescue SyntaxError
false
ensure
$VERBOSE = verbose
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?(text)\n res = @driver.checkSyntax([text])\n return res.first.valid\n end",
"def ruby_code?(str)\n checker = FoodCritic::ErrorChecker.new(str)\n checker.parse\n ! checker.error?\n end",
"def ruby_code?(str)\n str = str.to_s\n return false if str.empty?\n checke... | [
"0.71832675",
"0.6911695",
"0.68993074",
"0.66299635",
"0.65800416",
"0.6468388",
"0.63435316",
"0.6323202",
"0.6301715",
"0.6222301",
"0.6212737",
"0.62123704",
"0.61734813",
"0.61405843",
"0.61250794",
"0.6115977",
"0.6097987",
"0.6096287",
"0.6092571",
"0.60619205",
"0.600... | 0.7230397 | 0 |
Converts +item+ to HTML using RDoc::Textto_html | def to_html item
super convert_flow @am.flow item
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render(item)\n item.render({}, @site.site_payload)\n doc = Nokogiri::HTML(item.output)\n paragraphs = doc.search('//text()').map {|t| t.content }\n paragraphs = paragraphs.join(\" \").gsub(\"\\r\", \" \").gsub(\"\\n\", \" \").gsub(\"\\t\", \" \").gsub(/\\s+/, \" \")\n end",
"... | [
"0.6738186",
"0.6692772",
"0.6583856",
"0.6579748",
"0.6209614",
"0.61535203",
"0.61535203",
"0.61480373",
"0.6144531",
"0.60448885",
"0.590979",
"0.58987236",
"0.58262026",
"0.58209807",
"0.5751315",
"0.57166886",
"0.5700997",
"0.56993884",
"0.56612176",
"0.565455",
"0.56358... | 0.5549382 | 26 |
Creates a new formatter that will output (mostly) \RDoc markup | def initialize markup = nil
super nil, markup
@markup.add_regexp_handling(/\\\S/, :SUPPRESSED_CROSSREF)
@width = 78
init_tags
@headings = {}
@headings.default = []
@headings[1] = ['= ', '']
@headings[2] = ['== ', '']
@headings[3] = ['=== ', '']
@headings[4] = ['===... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatter(io)\n RDoc::Markup::ToRdoc.new\n end",
"def formatter\n return @formatter if defined? @formatter\n\n options = @store.rdoc.options\n this = RDoc::Context === self ? self : @parent\n\n @formatter = RDoc::Markup::ToHtmlCrossref.new options, this.path, this\n @formatter.code_object ... | [
"0.78565896",
"0.69105154",
"0.6329205",
"0.6210341",
"0.61680907",
"0.6072837",
"0.60660154",
"0.60644656",
"0.60644656",
"0.60644656",
"0.6049288",
"0.60204333",
"0.59690756",
"0.5953203",
"0.5953203",
"0.5920074",
"0.5901211",
"0.5901211",
"0.5895594",
"0.5874569",
"0.5844... | 0.0 | -1 |
Maps attributes to HTML sequences | def init_tags
add_tag :BOLD, "<b>", "</b>"
add_tag :TT, "<tt>", "</tt>"
add_tag :EM, "<em>", "</em>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_attributes(attr); end",
"def html_attributes(attr)\n return '' if attr.empty?\n\n attr.map do |k, v|\n v.nil? || (k == 'id' && v.strip.empty?) ? '' : \" #{k}=\\\"#{escape_html(v.to_s, :attribute)}\\\"\"\n end.join('')\n end",
"def attr_tag(text); end",
"def attribu... | [
"0.7886784",
"0.7188132",
"0.6940125",
"0.69291306",
"0.6705045",
"0.66999596",
"0.66792905",
"0.6557349",
"0.65492296",
"0.6545523",
"0.6545523",
"0.65012956",
"0.646729",
"0.64672166",
"0.64660746",
"0.6427043",
"0.6406302",
"0.64015806",
"0.63986504",
"0.6391099",
"0.63860... | 0.0 | -1 |
Adds +blank_line+ to the output | def accept_blank_line blank_line
@res << "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blank_line\n output \"\"\n end",
"def empty_line\n end",
"def empty_line\r\n puts \"\\n\"\r\n end",
"def print_empty_line\n print_in_same_line(\" \")\n end",
"def accept_blank_line(blank_line)\n # @res << ... | [
"0.83867013",
"0.79575413",
"0.79298115",
"0.76295817",
"0.75918937",
"0.745943",
"0.71074235",
"0.6943462",
"0.68982065",
"0.67824274",
"0.6764752",
"0.67471737",
"0.6721258",
"0.66603404",
"0.64678186",
"0.6462303",
"0.6458836",
"0.64288294",
"0.63712025",
"0.63294554",
"0.... | 0.8041081 | 1 |
Adds +paragraph+ to the output | def accept_block_quote block_quote
@indent += 2
block_quote.parts.each do |part|
@prefix = '> '
part.accept self
end
@indent -= 2
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.77183574",
"0.74457324",
"0.7417869",
"0.7411809",
"0.73260635",
"0.72802806",
"0.7252098",
"0.7210662",
"0.71857756",
"0.7047855",
"0.6984125",
"0.6931145",
"0.6907292",
"0.6875375",
"0.68681777",
"0.6852526",
"0.68250614",
"0.68149936",
"0.6790156",
"0.6778595",
"0.67772... | 0.0 | -1 |
Adds +heading+ to the output | def accept_heading heading
use_prefix or @res << ' ' * @indent
@res << @headings[heading.level][0]
@res << attributes(heading.text)
@res << @headings[heading.level][1]
@res << "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_heading(heading)\n table.heading = heading\n end",
"def accept_heading heading\n @res << \"<p>#{to_html heading.text}\\n\"\n\n add_paragraph\n end",
"def accept_heading heading\n level = [6, heading.level].min\n\n label = heading.label @code_object\n\n @res << if @options.output... | [
"0.7846888",
"0.7759619",
"0.7615676",
"0.7564427",
"0.7548784",
"0.7421498",
"0.7365909",
"0.73620343",
"0.73441917",
"0.7275133",
"0.71497077",
"0.7121561",
"0.71125054",
"0.7093277",
"0.7093277",
"0.69761133",
"0.69639635",
"0.6937303",
"0.6919448",
"0.69102937",
"0.689778... | 0.7305064 | 9 |
Finishes consumption of +list+ | def accept_list_end list
@list_index.pop
@list_type.pop
@list_width.pop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(list); end",
"def closed_end_list(list); end",
"def flush\n @lists = nil\n end",
"def saw_end_list(list); end",
"def finish_item(list_id:, id:)\n path = \"lists/#{list_id}/items/#{id}/finish\"\n request(method: :put, path: path)\n end",
"def final(list)\n\tputs \"Grocer... | [
"0.63480574",
"0.6280506",
"0.6153483",
"0.6075285",
"0.6070111",
"0.5965878",
"0.5864178",
"0.58611083",
"0.58583593",
"0.5790192",
"0.5736218",
"0.57052475",
"0.568907",
"0.566995",
"0.5664627",
"0.56635255",
"0.56402636",
"0.56378156",
"0.5619682",
"0.56174755",
"0.560082"... | 0.5467129 | 29 |
Finishes consumption of +list_item+ | 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"
2
... | {
"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.64725566",
"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.57890... | 0.0 | -1 |
Prepares the visitor for consuming +list_item+ | def accept_list_item_start list_item
type = @list_type.last
case type
when :NOTE, :LABEL then
bullets = Array(list_item.label).map do |label|
attributes(label).strip
end.join "\n"
bullets << ":\n" unless bullets.empty?
@prefix = ' ' * @indent
@indent += 2
@pref... | {
"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.6128728",
"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.550312... | 0.5392607 | 24 |
Prepares the visitor for consuming +list+ | def accept_list_start list
case list.type
when :BULLET then
@list_index << nil
@list_width << 1
when :LABEL, :NOTE then
@list_index << nil
@list_width << 2
when :LALPHA then
@list_index << 'a'
@list_width << list.items.length.to_s.length
when :NUMBER then
@l... | {
"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.6025577",
"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.557454... | 0.0 | -1 |
Adds +paragraph+ to the output | def accept_paragraph paragraph
text = paragraph.text @hard_break
wrap attributes 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.6548667 | 32 |
Adds +paragraph+ to the output | def accept_indented_paragraph paragraph
@indent += paragraph.indent
text = paragraph.text @hard_break
wrap attributes text
@indent -= paragraph.indent
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.5989338 | 61 |
Adds +raw+ to the output | def accept_raw raw
@res << raw.parts.join("\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw\n @lines.map(&:line).join(\"\\n\") << \"\\n\"\n end",
"def _raw\n @_raw\n end",
"def raw\n @raw ||= ''\n end",
"def raw\n #\n end",
"def raw; end",
"def raw; end",
"def raw; end",
"def raw; end",
"def raw\n @raw = true\n self\n end"... | [
"0.6964374",
"0.68529224",
"0.67803913",
"0.67715645",
"0.6685225",
"0.6685225",
"0.6685225",
"0.6685225",
"0.6674726",
"0.66521406",
"0.6444359",
"0.6412902",
"0.6392242",
"0.6199205",
"0.6115777",
"0.61020654",
"0.6064145",
"0.60355717",
"0.60347354",
"0.60168314",
"0.59483... | 0.7310405 | 0 |
Adds +rule+ to the output | def accept_rule rule
use_prefix or @res << ' ' * @indent
@res << '-' * (@width - @indent)
@res << "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_rule(rule)\n @rules << rule\n LOGGER.info \"Adding rule: #{rule.readable}\"\n end",
"def add(rule); end",
"def << rule\n rules << rule\n nil\n end",
"def add_rule(rule)\n @rulebook.add_rule rule\n end",
"def <<(rule); end",
"def add_rule(rule)\n new_rules = rules.du... | [
"0.77892935",
"0.7713253",
"0.75330955",
"0.7366223",
"0.73044795",
"0.7166375",
"0.7092946",
"0.69777125",
"0.69685084",
"0.69505453",
"0.69027686",
"0.68563205",
"0.68331397",
"0.6700858",
"0.6690519",
"0.66346276",
"0.6605905",
"0.660064",
"0.6600374",
"0.6600374",
"0.6600... | 0.63424915 | 31 |
Outputs +verbatim+ indented 2 columns | def accept_verbatim verbatim
indent = ' ' * (@indent + 2)
verbatim.parts.each do |part|
@res << indent unless part == "\n"
@res << part
end
@res << "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_spacer\n puts \"\\n\"\n end",
"def indent()\n #This is a stub, used for indexing\n end",
"def build_verbatim margin\n verbatim = super\n\n verbatim.format = :ruby if @section == 'Examples'\n\n verbatim\n end",
"def haml_indent\n ' ' * haml_... | [
"0.65109056",
"0.6429511",
"0.64142835",
"0.64142406",
"0.6405592",
"0.63976485",
"0.63976485",
"0.6352107",
"0.6352107",
"0.6352107",
"0.6352107",
"0.6352107",
"0.6314242",
"0.6301103",
"0.6294719",
"0.62817824",
"0.6259227",
"0.6249975",
"0.6225366",
"0.6224892",
"0.6218496... | 0.612285 | 39 |
Adds +table+ to the output | def accept_table header, body, aligns
widths = header.zip(body) do |h, b|
[h.size, b.size].max
end
aligns = aligns.map do |a|
case a
when nil
:center
when :left
:ljust
when :right
:rjust
end
end
@res << header.zip(widths, aligns) do |h, w, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put_table(table)\n table.each {|row| puts row.join(' ') }\nend",
"def add_table(table)\n return table if @tables.has_value? table\n @tables[table.name.to_s] = table\n table.owner= self\n table\n end",
"def table(header, values, io = $stdout)\n self.puts(io, MiGA.tabulate(header,... | [
"0.70779586",
"0.6807233",
"0.665756",
"0.66222733",
"0.6523024",
"0.6523024",
"0.6523024",
"0.6523024",
"0.65115494",
"0.6511226",
"0.65082145",
"0.64431936",
"0.6411115",
"0.6374209",
"0.6352903",
"0.6331902",
"0.63232154",
"0.63048327",
"0.62940174",
"0.62508005",
"0.62313... | 0.0 | -1 |
Applies attributespecific markup to +text+ using RDoc::AttributeManager | def attributes text
flow = @am.flow text.dup
convert_flow flow
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_tag(text); end",
"def set_attributes_as_text(node_id:, text:, name: nil)\n {\n method: \"DOM.setAttributesAsText\",\n params: { nodeId: node_id, text: text, name: name }.compact\n }\n end",
"def initialize\n @am = RDoc::Markup::AttributeManager.new\n @output ... | [
"0.65373975",
"0.6023729",
"0.6017948",
"0.58669436",
"0.5852039",
"0.5804761",
"0.57533395",
"0.5731706",
"0.573082",
"0.5618275",
"0.5599154",
"0.554258",
"0.55258435",
"0.5451365",
"0.5441609",
"0.54321986",
"0.5428133",
"0.5426721",
"0.5425351",
"0.5388003",
"0.5342132",
... | 0.5631428 | 9 |
Returns the generated output | def end_accepting
@res.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"... | [
"0.77311265",
"0.77311265",
"0.77311265",
"0.77311265",
"0.77311265",
"0.77311265",
"0.77311265",
"0.77311265",
"0.77311265",
"0.77311265",
"0.77311265",
"0.77311265",
"0.77311265",
"0.77311265",
"0.77311265",
"0.7493105",
"0.7471509",
"0.73898923",
"0.73623705",
"0.733282",
... | 0.0 | -1 |
Removes preceding \\ from the suppressed crossref +target+ | def handle_regexp_SUPPRESSED_CROSSREF target
text = target.text
text = text.sub('\\', '') unless in_tt?
text
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_CROSSREF target\n target.text.sub(/\\A\\\\/, '')\n end",
"def handle_regexp_CROSSREF(target)\n name = target.text\n\n return name if name =~ /@[\\w-]+\\.[\\w-]/ # labels that look like e... | [
"0.8238635",
"0.8049541",
"0.6732413",
"0.60452604",
"0.53991306",
"0.53805554",
"0.53268135",
"0.53081065",
"0.52531266",
"0.5242822",
"0.52201647",
"0.5218916",
"0.52103716",
"0.51680595",
"0.51590794",
"0.51482856",
"0.5117217",
"0.51164794",
"0.51090425",
"0.50905204",
"0... | 0.74166954 | 2 |
Adds a newline to the output | def handle_regexp_HARD_BREAK target
"\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def newline\n @results += nl\n end",
"def line_feed\n write_raw \"\\n\"\n end",
"def newline\n print \"\\n\"\n end",
"def fancy_newline\n @results += '|'\n newline\n end",
"def newline\n @printer.nl\n end",
"def output()\n add_newline if @linebreak\n @text... | [
"0.80261",
"0.79887086",
"0.7867862",
"0.7815782",
"0.7792112",
"0.7722391",
"0.7632728",
"0.7632728",
"0.75683856",
"0.7421348",
"0.7406515",
"0.7338735",
"0.7338735",
"0.72672224",
"0.720534",
"0.7166062",
"0.71340096",
"0.70730376",
"0.70190185",
"0.7004011",
"0.6995972",
... | 0.0 | -1 |
Prepares the visitor for text generation | def start_accepting
@res = [""]
@indent = 0
@prefix = nil
@list_index = []
@list_type = []
@list_width = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visit_Text(text, *rest)\n end",
"def accept(visitor); end",
"def accept(visitor); end",
"def finish_preparations\n munge\n @document.attributes['alternative_language_counter'] = @counter + 1\n @listing_text = @listing.convert\n @colist_text = @colist&.convert\n end",
"def so... | [
"0.5764863",
"0.56980884",
"0.56980884",
"0.5629763",
"0.5565271",
"0.5504113",
"0.5466755",
"0.5456021",
"0.5439147",
"0.5390395",
"0.5360831",
"0.5352435",
"0.5302356",
"0.52940613",
"0.5286382",
"0.5285246",
"0.52846324",
"0.52846324",
"0.52673686",
"0.52387875",
"0.522994... | 0.0 | -1 |
Adds the stored prefix to the output and clears it. Lists generate a prefix for later consumption. | def use_prefix
prefix, @prefix = @prefix, nil
@res << prefix if prefix
prefix
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n @is_echoed_prefix = true;\n @entries = []\n @curr_entry = nil\n @common_prefixes = []\n @common_prefix_entry = nil\n @curr_text = ''\n end",
"def prefix\n ''\n end",
"def prefix(new_prefix = nil)\n return @prefix if new_prefix.nil?\n @prefix = new_... | [
"0.6775582",
"0.6652128",
"0.66238135",
"0.6563057",
"0.6466612",
"0.6415056",
"0.64149404",
"0.6357436",
"0.633746",
"0.6287065",
"0.62861085",
"0.6241272",
"0.62332344",
"0.6162273",
"0.6144865",
"0.6114892",
"0.6051678",
"0.6051678",
"0.6051678",
"0.6051678",
"0.6051678",
... | 0.68351996 | 0 |
Wraps +text+ to width | def wrap text
return unless text && !text.empty?
text_len = @width - @indent
text_len = 20 if text_len < 20
re = /^(.{0,#{text_len}})[ \n]/
next_prefix = ' ' * @indent
prefix = @prefix || next_prefix
@prefix = nil
@res << prefix
while text.length > text_len
if text =~ re ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boxed_text(text, text_width) \n Structurograme.wrap_text(\n text.strip,\n (text_width.to_f / char_width).floor\n )\n end",
"def wrap_text(txt, col = 75)\n txt.wrap_text(col)\n end",
"def wrap_text(s, width=78) # {{{\n return nil unless s\n\ts.gsub(/(.{1,#{width}})(\\... | [
"0.8010534",
"0.79954594",
"0.7969891",
"0.77674073",
"0.7650882",
"0.7646513",
"0.76263446",
"0.7618484",
"0.7611977",
"0.75409055",
"0.7453641",
"0.7453169",
"0.74250865",
"0.7396005",
"0.73856837",
"0.73538923",
"0.7347689",
"0.7342305",
"0.73308533",
"0.73204595",
"0.7305... | 0.7669327 | 4 |
Creates a new Document with +parts+ | def initialize *parts
@parts = []
@parts.concat parts
@file = nil
@omit_headings_from_table_of_contents_below = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n parms = document_part_params.to_h.deep_dup.symbolize_keys\n parms[:document_id] = @document_section.document_id\n parms[:type] = 'DocumentPart::HtmlContent' if parms[:type].blank?\n @document_part = @document_section.parts.create(parms)\n redirect_to edit_admin_document_document_section... | [
"0.6628738",
"0.60849714",
"0.601462",
"0.60142136",
"0.5932573",
"0.59001905",
"0.5844491",
"0.5813177",
"0.58062494",
"0.57888186",
"0.57116514",
"0.56882215",
"0.559693",
"0.55441386",
"0.5530638",
"0.5497677",
"0.5484809",
"0.54837775",
"0.5459174",
"0.54278374",
"0.54137... | 0.5038557 | 48 |
Appends +part+ to the document | def << part
case part
when RDoc::Markup::Document then
unless part.empty? then
parts.concat part.parts
parts << RDoc::Markup::BlankLine.new
end
when String then
raise ArgumentError,
"expected RDoc::Markup::Document and friends, got String" unless
part.em... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_part(part)\n @parts ||= Array.new\n @parts << part\n end",
"def new_part\n self.parts << self.current_part if !self.current_part.nil?\n self.current_part = Rain::DocPart.new\n end",
"def append(part)\n # Don't write the part again if it already exists ya dummy\n ... | [
"0.72822565",
"0.72744894",
"0.69678867",
"0.69545656",
"0.68917453",
"0.64462984",
"0.6072662",
"0.5932468",
"0.58627844",
"0.5838437",
"0.58226305",
"0.574998",
"0.57491153",
"0.5723173",
"0.5715057",
"0.5672959",
"0.5642619",
"0.5642619",
"0.5642619",
"0.5642619",
"0.56426... | 0.7045219 | 2 |
Runs this document and all its items through +visitor+ | def accept visitor
visitor.start_accepting
visitor.accept_document self
visitor.end_accepting
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each(&block)\n documents.each(&block)\n end",
"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 each(&block)\n @document.each_page(&block)\n end",
"def ac... | [
"0.6057881",
"0.5978772",
"0.5872398",
"0.58498573",
"0.5848355",
"0.5815235",
"0.5815235",
"0.56403",
"0.5599869",
"0.5568918",
"0.55512625",
"0.55064815",
"0.5496382",
"0.54810166",
"0.546005",
"0.54412067",
"0.54412067",
"0.543211",
"0.54125345",
"0.53985715",
"0.53638476"... | 0.6213927 | 0 |
Concatenates the given +parts+ onto the document | def concat parts
self.parts.concat parts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def << part\n case part\n when RDoc::Markup::Document then\n unless part.empty? then\n parts.concat part.parts\n parts << RDoc::Markup::BlankLine.new\n end\n when String then\n raise ArgumentError,\n \"expected RDoc::Markup::Document and friends, got String\" unless... | [
"0.6051245",
"0.58461505",
"0.57877886",
"0.57847846",
"0.57477885",
"0.57126313",
"0.56811935",
"0.5617453",
"0.5553135",
"0.55228657",
"0.549023",
"0.54097134",
"0.53940135",
"0.53940135",
"0.53940135",
"0.5368961",
"0.53562003",
"0.53478247",
"0.5346377",
"0.53307384",
"0.... | 0.7165932 | 0 |
Enumerator for the parts of this document | def each &block
@parts.each(&block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parts\n @parts\n end",
"def parts\n @doc.content_types.parts Slide::CONTENT_TYPE\n end",
"def each(&block)\n return @parts.each(&block)\n end",
"def each\n enum = cursor.to_enum\n enum.each do |doc|\n yield doc\n end if block_given?\n enum\n e... | [
"0.6620014",
"0.63204753",
"0.6159318",
"0.6109236",
"0.6053383",
"0.6031662",
"0.5920521",
"0.5920521",
"0.5920521",
"0.5888359",
"0.5853363",
"0.5720959",
"0.56861156",
"0.5629366",
"0.5563782",
"0.55634856",
"0.55634856",
"0.54473335",
"0.54473335",
"0.542583",
"0.5386718"... | 0.5949603 | 6 |
Does this document have no parts? | def empty?
@parts.empty? or (@parts.length == 1 and merged? and @parts.first.empty?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plain_document?\n document.elements.empty?\n end",
"def parts?\n !parts.empty?\n end",
"def in_a_document?\n state = false\n state = true if document_lines.count > 0\n return state\n end",
"def empty?\n @parts.empty?\n end",
"def empty?\n @parts.empty?\n end",
"def e... | [
"0.7675366",
"0.7283011",
"0.7189961",
"0.7109223",
"0.7109223",
"0.7089354",
"0.70027035",
"0.69752216",
"0.6933552",
"0.6933552",
"0.6692296",
"0.6680229",
"0.65828395",
"0.6551242",
"0.65026444",
"0.64194655",
"0.6405539",
"0.64052963",
"0.63836986",
"0.63765126",
"0.63760... | 0.6578795 | 13 |
The file this Document was created from. | def file= location
@file = case location
when RDoc::TopLevel then
location.relative_name
else
location
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_filename (for_file = model.document.file)\n for_file\n end",
"def file\n FILE\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def filename\n ... | [
"0.7788807",
"0.77099997",
"0.7647207",
"0.76386726",
"0.76386726",
"0.76386726",
"0.76386726",
"0.7571428",
"0.74812114",
"0.74750304",
"0.74750304",
"0.74657655",
"0.7411401",
"0.7411401",
"0.73000103",
"0.7258211",
"0.7191456",
"0.71090746",
"0.71021754",
"0.71021754",
"0.... | 0.67744255 | 45 |
When this is a collection of documents (file is not set and this document contains only other documents as its direct children) merge replaces documents in this class with documents from +other+ when the file matches and adds documents from +other+ when the files do not. The information in +other+ is preferred over the... | def merge other
if empty? then
@parts = other.parts
return self
end
other.parts.each do |other_part|
self.parts.delete_if do |self_part|
self_part.file and self_part.file == other_part.file
end
self.parts << other_part
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_collections mine, other, other_files, &block # :nodoc:\n my_things = mine. group_by { |thing| thing.file }\n other_things = other.group_by { |thing| thing.file }\n\n remove_things my_things, other_files, &block\n add_things my_things, other_things, &block\n end",
"def merge!(other)\... | [
"0.69455296",
"0.6497439",
"0.60719234",
"0.59417796",
"0.59250265",
"0.5906628",
"0.5847451",
"0.5842198",
"0.58389974",
"0.5812994",
"0.57964337",
"0.5796423",
"0.57525593",
"0.57435477",
"0.57315797",
"0.5727293",
"0.57040405",
"0.5677725",
"0.56682163",
"0.5654119",
"0.56... | 0.6918517 | 1 |
Does this Document contain other Documents? | def merged?
RDoc::Markup::Document === @parts.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def documents_equal?(a, b)\n normalize_document(a) == normalize_document(b)\n end",
"def supporting_document_other?\n supporting_document_list.include?('OTHER')\n end",
"def contained?(other); end",
"def contained?(other); end",
"def contained?(other); end",
"def doc?(doc_hash)\n @... | [
"0.67523986",
"0.635997",
"0.62491965",
"0.62491965",
"0.62491965",
"0.62297726",
"0.62244934",
"0.6200665",
"0.61572987",
"0.61532116",
"0.61532116",
"0.61371386",
"0.6061448",
"0.6021924",
"0.59936476",
"0.59580135",
"0.5947574",
"0.59377813",
"0.59031427",
"0.59023464",
"0... | 0.5868735 | 21 |
Appends +parts+ to the document | def push *parts
self.parts.concat parts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concat parts\n self.parts.concat parts\n end",
"def << part\n @parts << part\n end",
"def new_part\n self.parts << self.current_part if !self.current_part.nil?\n self.current_part = Rain::DocPart.new\n end",
"def << part\n case part\n when RDoc::Markup::Document then\n unl... | [
"0.6949009",
"0.6633959",
"0.6477535",
"0.6464828",
"0.64441246",
"0.6396681",
"0.6396681",
"0.6396681",
"0.6395152",
"0.6035764",
"0.59824234",
"0.5794962",
"0.5792022",
"0.577387",
"0.5773446",
"0.57424927",
"0.56755185",
"0.5649731",
"0.56450564",
"0.5634812",
"0.56185967"... | 0.5869936 | 11 |
Returns an Array of headings in the document. Require 'rdoc/markup/formatter' before calling this method. | def table_of_contents
accept RDoc::Markup::ToTableOfContents.to_toc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def implicit_headings\n @implicit_headings ||= begin\n headings = []\n doc.css(\"[style]\").each do |element|\n headings.push element unless element.font_size.nil? || element.font_size < MIN_HEADING_SIZE\n end\n headings\n end\n end",
"def headings\n [ \n '',\n ... | [
"0.6858325",
"0.66565394",
"0.66228634",
"0.6462939",
"0.63479054",
"0.6072612",
"0.6062714",
"0.6057075",
"0.6040549",
"0.59723663",
"0.5967959",
"0.58728194",
"0.58493274",
"0.5771647",
"0.57398987",
"0.57376325",
"0.5700201",
"0.5644726",
"0.5642855",
"0.56186897",
"0.5614... | 0.0 | -1 |
Creates a new Parser. See also ::parse | def initialize
@binary_input = nil
@current_token = nil
@debug = false
@s = nil
@tokens = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parser\n @parser ||= Parser.new(self)\n end",
"def parser\n @parser ||= Parser.new(self)\n end",
"def parser\n Parser.new(self, :mode=>mode)\n end",
"def parser\n @parser ||= Parser.new(self)\n end",
"def initialize parser\n @parser = parser\n end",
"def pa... | [
"0.7445383",
"0.7445383",
"0.7397252",
"0.7329526",
"0.726806",
"0.72557133",
"0.67240715",
"0.67240715",
"0.67240715",
"0.67240715",
"0.66707337",
"0.6666743",
"0.6568896",
"0.6517118",
"0.6508107",
"0.64593154",
"0.6416704",
"0.6383697",
"0.6375915",
"0.6331114",
"0.6294418... | 0.0 | -1 |
Builds a Heading of +level+ | def build_heading level
type, text, = get
text = case type
when :TEXT then
skip :NEWLINE
text
else
unget
''
end
RDoc::Markup::Heading.new level, text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_heading level\n heading = RDoc::Markup::Heading.new level, text\n skip :NEWLINE\n\n heading\n end",
"def build_heading level\n heading = super\n\n @section = heading.text\n\n heading\n end",
"def heading(level, title)\n @io << @templates[:heading_3].result(binding) if level ... | [
"0.8584473",
"0.7992036",
"0.766331",
"0.72736394",
"0.7115193",
"0.7091424",
"0.70675504",
"0.68406266",
"0.6820763",
"0.67263156",
"0.6411727",
"0.64061326",
"0.6369527",
"0.6271758",
"0.6270927",
"0.6246594",
"0.62451506",
"0.61768943",
"0.61630785",
"0.61508495",
"0.61322... | 0.8417932 | 1 |
Builds a List flush to +margin+ | def build_list margin
p :list_start => margin if @debug
list = RDoc::Markup::List.new
label = nil
until @tokens.empty? do
type, data, column, = get
case type
when *LIST_TOKENS then
if column < margin || (list.type && list.type != type) then
unget
break
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_list margin\n p :list_start => margin if @debug\n\n list = RDoc::Markup::List.new\n\n until @tokens.empty? do\n type, data, column, = get\n\n case type\n when :BULLET, :LABEL, :LALPHA, :NOTE, :NUMBER, :UALPHA then\n list_type = type\n\n if column < margin then\n ... | [
"0.7472048",
"0.69740415",
"0.61458457",
"0.6004913",
"0.5907987",
"0.5869451",
"0.5826924",
"0.5822335",
"0.5781662",
"0.5740655",
"0.56006026",
"0.5591366",
"0.5539597",
"0.5505367",
"0.5485646",
"0.5469567",
"0.54691607",
"0.54654175",
"0.5457408",
"0.54252404",
"0.542524"... | 0.72637624 | 1 |
Builds a Paragraph that is flush to +margin+ | def build_paragraph margin
p :paragraph_start => margin if @debug
paragraph = RDoc::Markup::Paragraph.new
until @tokens.empty? do
type, data, column, = get
if type == :TEXT and column == margin then
paragraph << data
break if peek_token.first == :BREAK
data << ' ' if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_paragraph margin\n p :paragraph_start => margin if @debug\n\n paragraph = RDoc::Markup::Paragraph.new\n\n until @tokens.empty? do\n type, data, column, = get\n\n case type\n when :INDENT then\n next if data == margin and peek_token[0] == :TEXT\n\n unget\n brea... | [
"0.8040784",
"0.7077012",
"0.6331948",
"0.6310281",
"0.63017106",
"0.62282985",
"0.6197009",
"0.6139939",
"0.61095005",
"0.60806936",
"0.6039721",
"0.60332686",
"0.5999385",
"0.59649974",
"0.5960489",
"0.59318346",
"0.5919193",
"0.5900154",
"0.5900154",
"0.5900154",
"0.588458... | 0.828294 | 0 |
Builds a Verbatim that is indented from +margin+. The verbatim block is shifted left (the least indented lines start in column 0). Each part of the verbatim is one line of text, always terminated by a newline. Blank lines always consist of a single newline character, and there is never a single newline at the end of th... | def build_verbatim margin
p :verbatim_begin => margin if @debug
verbatim = RDoc::Markup::Verbatim.new
min_indent = nil
generate_leading_spaces = true
line = ''.dup
until @tokens.empty? do
type, data, column, = get
if type == :NEWLINE then
line << data
verbatim << l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_verbatim margin\n p :verbatim_begin => margin if @debug\n verbatim = RDoc::Markup::Verbatim.new\n\n until @tokens.empty? do\n type, data, column, = get\n\n case type\n when :INDENT then\n if margin >= data then\n unget\n break\n end\n\n inden... | [
"0.81848574",
"0.66133744",
"0.66052717",
"0.6573636",
"0.61909723",
"0.609386",
"0.6039648",
"0.59296364",
"0.5780269",
"0.5767001",
"0.5721109",
"0.5685482",
"0.56578875",
"0.56136537",
"0.5593022",
"0.5560398",
"0.5551193",
"0.5512571",
"0.5499691",
"0.54579353",
"0.545004... | 0.82889736 | 0 |
Pulls the next token from the stream. | def get
@current_token = @tokens.shift
p :get => @current_token if @debug
@current_token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next\n\t\tif @next_token\n\t\t\ttoken = @next_token\n\t\t\t@next_token = nil\n\t\t\treturn token\n\t\telse\n\t\t\ttoken = read_token\n\t\t\treturn token\n\t\tend\n\tend",
"def next\n token = next_token\n token = next_token while token&.empty?\n token\n end",
"def get_token\n @tokenbuf ... | [
"0.80374205",
"0.7607829",
"0.7580852",
"0.7458197",
"0.7431326",
"0.7334023",
"0.7309964",
"0.7282369",
"0.72726494",
"0.72726494",
"0.720337",
"0.7139261",
"0.7130224",
"0.7061388",
"0.69352496",
"0.69222224",
"0.68793917",
"0.6832228",
"0.68298364",
"0.68203497",
"0.678653... | 0.6346298 | 32 |
Parses the tokens into an array of RDoc::Markup::XXX objects, and appends them to the passed +parent+ RDoc::Markup::YYY object. Exits at the end of the token stream, or when it encounters a token in a column less than +indent+ (unless it is a NEWLINE). Returns +parent+. | def parse parent, indent = 0
p :parse_start => indent if @debug
until @tokens.empty? do
type, data, column, = get
case type
when :BREAK then
parent << RDoc::Markup::BlankLine.new
skip :NEWLINE, false
next
when :NEWLINE then
# trailing newlines are skippe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse indent = 0\n p :parse_start => indent if @debug\n\n document = []\n\n until @tokens.empty? do\n type, data, column, = get\n\n if type != :INDENT and column < indent then\n unget\n break\n end\n\n case type\n when :HEADER then\n document << build_head... | [
"0.55293214",
"0.5464745",
"0.50161165",
"0.4939823",
"0.4721992",
"0.4713617",
"0.46593088",
"0.46254602",
"0.45948347",
"0.45829064",
"0.45537615",
"0.45525312",
"0.45494607",
"0.4483735",
"0.44617486",
"0.4448153",
"0.44469875",
"0.43879077",
"0.43853855",
"0.43813953",
"0... | 0.7246042 | 0 |
Small hook that is overridden by RDoc::TomDoc | def parse_text parent, indent # :nodoc:
parent << build_paragraph(indent)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doc=(_arg0); end",
"def doc=(_arg0); end",
"def doc=(_arg0); end",
"def doc; end",
"def doc; end",
"def doc; end",
"def doc; end",
"def base_docstring; end",
"def pre #:doc:\n end",
"def docs=(_arg0); end",
"def link_documentation; end",
"def docstring; end",
"def docstring; end",
"d... | [
"0.71022785",
"0.71022785",
"0.71022785",
"0.6941714",
"0.6941714",
"0.6941714",
"0.6941714",
"0.69180447",
"0.6831505",
"0.6817366",
"0.673971",
"0.67128867",
"0.67128867",
"0.65972894",
"0.6559017",
"0.64705414",
"0.64705414",
"0.64705414",
"0.64705414",
"0.64705414",
"0.64... | 0.0 | -1 |
Returns the next token on the stream without modifying the stream | def peek_token
token = @tokens.first || []
p :peek => token if @debug
token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next\n\t\tif @next_token\n\t\t\ttoken = @next_token\n\t\t\t@next_token = nil\n\t\t\treturn token\n\t\telse\n\t\t\ttoken = read_token\n\t\t\treturn token\n\t\tend\n\tend",
"def next\n token = next_token\n token = next_token while token&.empty?\n token\n end",
"def next_token\n tokens.sh... | [
"0.8332876",
"0.80467963",
"0.7955034",
"0.7954132",
"0.79513747",
"0.7866707",
"0.7755758",
"0.7742991",
"0.76905787",
"0.7653205",
"0.76486",
"0.7551597",
"0.75150716",
"0.73619646",
"0.7355825",
"0.72566706",
"0.72470903",
"0.72424835",
"0.7221907",
"0.71813124",
"0.714040... | 0.6509945 | 46 |
Skips the next token if its type is +token_type+. Optionally raises an error if the next token is not of the expected type. | def skip token_type, error = true
type, = get
return unless type # end of stream
return @current_token if token_type == type
unget
raise ParseError, "expected #{token_type} got #{@current_token.inspect}" if error
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip token_type, error = true\n type, data, = get\n\n return unless type # end of stream\n\n return @current_token if token_type == type\n\n unget\n\n raise ParseError, \"expected #{token_type} got #{@current_token.inspect}\" if\n error\n end",
"def pop(expected_type, expected_tokens = [... | [
"0.78967005",
"0.5902834",
"0.5698899",
"0.5698241",
"0.5670721",
"0.56042415",
"0.5571739",
"0.55390126",
"0.53715706",
"0.537004",
"0.5309509",
"0.5272074",
"0.52557725",
"0.5126975",
"0.5102745",
"0.50964105",
"0.50458616",
"0.5035098",
"0.49202693",
"0.49161243",
"0.48623... | 0.8027373 | 0 |
Turns text +input+ into a stream of tokens | def tokenize input
setup_scanner input
until @s.eos? do
pos = @s.pos
# leading spaces will be reflected by the column of the next token
# the only thing we loose are trailing spaces at the end of the file
next if @s.scan(/ +/)
# note: after BULLET, LABEL, etc.,
# indent wi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokens\n @tokens ||= scanner.tokenize(input)\n end",
"def process(input_stream)\n debug 'Beginning tokenization of input'\n\n @stream = input_stream\n @stream_char = 1\n\n @output = [] if @state == :root\n\n until @stream.strip.empty?\n tk = tokenize\n @output.append(tk) if t... | [
"0.75584966",
"0.7391107",
"0.7316853",
"0.72128594",
"0.7203937",
"0.7142253",
"0.7142253",
"0.69663405",
"0.6958009",
"0.6958009",
"0.69164616",
"0.69164616",
"0.68137854",
"0.66301787",
"0.66245806",
"0.6604202",
"0.6573046",
"0.6534405",
"0.6475245",
"0.6475245",
"0.64352... | 0.67749774 | 13 |
Returns the current token to the token stream | def unget
token = @current_token
p :unget => token if @debug
raise Error, 'too many #ungets' if token == @tokens.first
@tokens.unshift token if token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_token\n @stream.current_token\n end",
"def get_token\n @tokenbuf << read_token if @tokenbuf.length == 0\n return @tokenbuf.shift\n end",
"def current_token\n @current_token\n end",
"def token_stream # :nodoc:\n end",
"def current_token\n @tokens[@token_index... | [
"0.8222359",
"0.7535142",
"0.75247467",
"0.7510458",
"0.7466446",
"0.7304768",
"0.72642374",
"0.7229252",
"0.72268516",
"0.71671927",
"0.7121356",
"0.7121356",
"0.71060824",
"0.70535344",
"0.7013212",
"0.69674164",
"0.6952804",
"0.6948121",
"0.693044",
"0.6900826",
"0.6897974... | 0.0 | -1 |
:nodoc: Creates a new formatter that will output HTMLsafe labels | def initialize markup = nil
super nil, markup
@markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
@markup.add_regexp_handling(/(((\{.*?\})|\b\S+?)\[\S+?\])/, :TIDYLINK)
add_tag :BOLD, '', ''
add_tag :TT, '', ''
add_tag :EM, '', ''
@res = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_simple\n HtmlFormatter.new(self, options).to_s\n end",
"def html\n HtmlFormatter.new(self, options.merge(:highlight_words => true)).to_s\n end",
"def format_with_label(field, options, tag_output, &block)\n # see if we have an error on the field\n errors_on = object.send(:erro... | [
"0.6817495",
"0.64679796",
"0.63605493",
"0.63235164",
"0.6173182",
"0.6171651",
"0.6167253",
"0.6167253",
"0.61569774",
"0.6156435",
"0.61104536",
"0.6048164",
"0.6048164",
"0.6048164",
"0.599908",
"0.5998387",
"0.5993822",
"0.59805936",
"0.59567124",
"0.594933",
"0.59430844... | 0.0 | -1 |
Converts +text+ to an HTMLsafe label | def convert text
label = convert_flow @am.flow text
CGI.escape(label).gsub('%', '-').sub(/^-/, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_plain\n Redcap::Utilities.html_to_plain_text label\n end",
"def render\n content_tag(:span, text, class: \"label #{dom_label_class}\")\n end",
"def render\n content_tag(:span, text, class: \"label #{dom_label_class}\")\n end",
"def inline_label(text)\n @template.conte... | [
"0.73678976",
"0.7081398",
"0.7081398",
"0.7051183",
"0.6922925",
"0.68620765",
"0.6761767",
"0.6694688",
"0.66178113",
"0.65765136",
"0.657125",
"0.65479994",
"0.65479994",
"0.6546192",
"0.6544437",
"0.65430796",
"0.6538059",
"0.6531815",
"0.647341",
"0.64569634",
"0.6447941... | 0.6790784 | 6 |
Converts the CROSSREF +target+ to plain text, removing the suppression marker, if any | def handle_regexp_CROSSREF target
text = target.text
text.sub(/^\\/, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 target.text.sub(/\\A\\\\/, '')\n end",
"def handle_regexp_CROSSREF(target)\n name = target.text\n\n return name if name =~ /@[\\w... | [
"0.7122579",
"0.69326496",
"0.6575382",
"0.58920115",
"0.5729048",
"0.5639155",
"0.5634837",
"0.5625841",
"0.56104785",
"0.5560582",
"0.54875404",
"0.5476871",
"0.5264924",
"0.5264924",
"0.52620345",
"0.52467597",
"0.5212609",
"0.5212609",
"0.5193417",
"0.5192484",
"0.5173458... | 0.70233715 | 1 |
Converts the TIDYLINK +target+ to just the text part | def handle_regexp_TIDYLINK target
text = target.text
return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
$1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_target\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 13 )\n value = nil\n target22 = nil\n\n begin\n # at line 107:32: ( WS )? '<' target '>'\n # at line 107:32: ( WS )?\n alt_22 = 2\n look_22_0 = @input.peek(1... | [
"0.68796545",
"0.6837281",
"0.64087516",
"0.63818437",
"0.636331",
"0.63617426",
"0.6359646",
"0.6348984",
"0.63085204",
"0.60058635",
"0.5952864",
"0.5949795",
"0.5947428",
"0.59409034",
"0.5934299",
"0.5918801",
"0.58957225",
"0.5895377",
"0.5895377",
"0.5881187",
"0.582271... | 0.69481504 | 0 |
Creates a new RDoc::RD::BlockParser. Use parse to parse an rdformat document. | def initialize
@inline_parser = RDoc::RD::InlineParser.new self
@include_path = []
# for testing
@footnotes = []
@labels = {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse\n _build_document\n _close_open_block_commands\n @document\n end",
"def initialize block_parser\n @block_parser = block_parser\nend",
"def new\n\t\t@block = Block.new\n\tend",
"def parser( &block )\n nested_class( 'Parser', Yacl::Define::Cli::Parser, &block )\n end",
... | [
"0.6543517",
"0.6084199",
"0.5986111",
"0.5874141",
"0.5523556",
"0.53910464",
"0.5371847",
"0.5344353",
"0.533635",
"0.532994",
"0.5292503",
"0.52128994",
"0.5203164",
"0.51911014",
"0.517481",
"0.5168474",
"0.51649815",
"0.5153783",
"0.51144075",
"0.5099908",
"0.5084067",
... | 0.0 | -1 |
Parses +src+ and returns an RDoc::Markup::Document. | def parse src
@src = src
@src.push false
@footnotes = []
@labels = {}
# @i: index(line no.) of src
@i = 0
# stack for current indentation
@indent_stack = []
# how indented.
@current_indent = @indent_stack.join("")
# RDoc::RD::BlockParser for tmp src
@subparser = nil
# which part is in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doc_src\n @doc_src ||= unless doc_place\n \"no documentation available\" \n else\n file, line = doc_place\n RubyTools::extract_file_rdoc(file, line, true)\n end\n end",
"def parse(src)\n raise RubyRTF::InvalidDocument.new(\"Opening \\\\rtf1 missing\")... | [
"0.65480196",
"0.62619096",
"0.6179573",
"0.617751",
"0.6083683",
"0.6048019",
"0.5977378",
"0.58777285",
"0.586985",
"0.5818356",
"0.5785428",
"0.5751583",
"0.5737871",
"0.57337403",
"0.5719852",
"0.5697936",
"0.56806886",
"0.5662891",
"0.5661738",
"0.5624028",
"0.5609118",
... | 0.7609881 | 0 |
Returns the next token from the document | def next_token # :nodoc:
# preprocessing
# if it is not in RD part
# => method
while @in_part != "rd"
line = @src[@i]
@i += 1 # next line
case line
# src end
when false
return [false, false]
# RD part begin
when /^=begin\s*(?:\bRD\b.*)?\s*$/
if @in_part # if in non-RD pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next\n\t\tif @next_token\n\t\t\ttoken = @next_token\n\t\t\t@next_token = nil\n\t\t\treturn token\n\t\telse\n\t\t\ttoken = read_token\n\t\t\treturn token\n\t\tend\n\tend",
"def next_token\n\t\t@tokens.next_token\n\tend",
"def next_token; end",
"def next_token\n @tokens.shift\n end",
"def next_token\... | [
"0.8341855",
"0.82767206",
"0.81931883",
"0.8142229",
"0.80910224",
"0.7977011",
"0.78619355",
"0.76889664",
"0.76857746",
"0.7655969",
"0.7641855",
"0.7506811",
"0.7395466",
"0.7370169",
"0.73136806",
"0.72310114",
"0.7112426",
"0.7095385",
"0.7046915",
"0.70456827",
"0.7040... | 0.0 | -1 |
Yields to the given block if +indent+ matches the current indent, otherwise an indentation token is processed. | def if_current_indent_equal(indent)
indent = indent.sub(/\t/, "\s" * 8)
if @current_indent == indent
@i += 1 # next line
yield
elsif indent.index(@current_indent) == 0
@indent_stack.push(indent[@current_indent.size .. -1])
[:INDENT, ":INDENT"]
else
@indent_stack.pop
[:DEDENT, ":DEDENT"]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nest(indent)\n @indent += indent\n begin\n yield\n ensure\n @indent -= indent\n end\n end",
"def nest(indent)\n @indent += indent\n begin\n yield\n ensure\n @indent -= indent\n end\n end",
"def nest(indent)\n @indent += indent\n begin\n yield\n en... | [
"0.7059815",
"0.7059815",
"0.7059815",
"0.67183626",
"0.6629845",
"0.6620066",
"0.6438988",
"0.631922",
"0.6176943",
"0.6157803",
"0.6002083",
"0.59827703",
"0.59519696",
"0.5904833",
"0.5818695",
"0.57634175",
"0.5712155",
"0.5664642",
"0.5642565",
"0.55718046",
"0.5568205",... | 0.7646044 | 0 |
Cuts off excess whitespace in +src+ | def cut_off(src)
ret = []
whiteline_buf = []
line = src.shift
/^\s*/ =~ line
indent = Regexp.quote($&)
ret.push($')
while line = src.shift
if /^(\s*)$/ =~ line
whiteline_buf.push(line)
elsif /^#{indent}/ =~ line
unless whiteline_buf.empty?
ret.concat(whiteline_buf)
w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_source(source)\n source.chop.gsub(/\\s*\\n\\s*/, ' ')\n end",
"def trim(s)\n s = s.gsub(/^#{$srcdir}\\//, '')\n s = s.gsub(/(\\.adoc)/, '')\nend",
"def remove_trailing_spaces(source)\n for_outstrings_of(source) do |str|\n str.gsub! /\\s+/im, ' '\n str.gsub! /\\s*(=|\\+|... | [
"0.6863609",
"0.64667296",
"0.61415905",
"0.6064656",
"0.602098",
"0.59743875",
"0.59634906",
"0.5934588",
"0.5880243",
"0.5851833",
"0.58154774",
"0.5806938",
"0.57595986",
"0.57531244",
"0.57355714",
"0.57336587",
"0.57258475",
"0.57073283",
"0.5676572",
"0.5676213",
"0.567... | 0.7095374 | 0 |
Retrieves the content for +file+ from the include_path | def get_included(file)
included = []
@include_path.each do |dir|
file_name = File.join dir, file
if File.exist? file_name then
included = IO.readlines file_name
break
end
end
included
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_content(template_file)\n File.read(File.expand_path(find_in_source_paths(template_file)))\n end",
"def get_file_contents(file_path)\n input_file = File.open(file_path, 'r')\n input_file_contents = input_file.read\n input_file.close\n input_file_contents\n end... | [
"0.6897317",
"0.6808",
"0.66769",
"0.66769",
"0.66277456",
"0.6545789",
"0.649434",
"0.6460766",
"0.6438205",
"0.6432182",
"0.6406316",
"0.6399555",
"0.63819456",
"0.63757086",
"0.6374046",
"0.6370446",
"0.63654286",
"0.6315469",
"0.63145614",
"0.63017756",
"0.62672013",
"0... | 0.69321984 | 0 |
Formats line numbers +line_numbers+ prettily | def format_line_num(*line_numbers)
width = line_numbers.collect{|i| i.to_s.length }.max
line_numbers.collect{|i| sprintf("%#{width}d", i) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_number_style\n if opts.present?(:'base-one')\n :'base-one'\n elsif opts.present?(:'line-numbers')\n :'line-numbers'\n else\n nil\n end\n end",
"def lineno_format(curline=false)\n t = @editor&.mode&.theme&.other_styles rescue nil\n\n fgcol = hexcol(get_st... | [
"0.73889714",
"0.725329",
"0.69942975",
"0.6954201",
"0.69511175",
"0.68830246",
"0.6879884",
"0.67806464",
"0.67361766",
"0.66300046",
"0.6620251",
"0.6552083",
"0.65169376",
"0.6344584",
"0.6310172",
"0.62570214",
"0.62318456",
"0.6206277",
"0.61229515",
"0.6085826",
"0.606... | 0.79247314 | 0 |
Retrieves the content of +values+ as a single String | def content values
values.map { |value| value.content }.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n values.to_s\n end",
"def to_s\n values.to_s\n end",
"def to_s\n values.inspect\n end",
"def values_to_s\n end",
"def to_s\n values.inspect\n end",
"def values_to_s\n string_of_values = String.new\n @store.length.times do |i|\n string_of... | [
"0.71632206",
"0.71632206",
"0.71499145",
"0.71102595",
"0.7108027",
"0.70744014",
"0.70744014",
"0.7013005",
"0.6870206",
"0.68103707",
"0.64654076",
"0.64370203",
"0.6353299",
"0.6310423",
"0.62726724",
"0.6267439",
"0.62545496",
"0.62216985",
"0.6171111",
"0.613382",
"0.61... | 0.68158144 | 9 |
Creates a paragraph for +value+ | def paragraph value
content = cut_off(value).join(' ').rstrip
contents = @inline_parser.parse content
RDoc::Markup::Paragraph.new(*contents)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text(value)\n if value.is_a? Widget\n widget value\n else\n output.concat(value.html_escape)\n end\n @at_start_of_line = false\n nil\n end",
"def text(value)\n @doc << {:type => :text, :value => value}\n nil\n end",
"def paragraph(text)\n \"<p>#{tex... | [
"0.6665448",
"0.647664",
"0.6459987",
"0.6344707",
"0.61331856",
"0.6120662",
"0.6093801",
"0.60470843",
"0.6014228",
"0.60127735",
"0.5987047",
"0.5903152",
"0.5876198",
"0.58320177",
"0.5826309",
"0.58001995",
"0.57773674",
"0.57741326",
"0.574933",
"0.57451046",
"0.5738335... | 0.6854209 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.