gets the language for this block of code

@param {Element} block
@returns {string|null}
971484
function _getLanguageForBlock(block) {

        // if this doesn't have a language but the parent does then use that
        // this means if for example you have: <pre data-language="php">
        // with a bunch of <code> blocks inside then you do not have
        // to specify the language for each block
        var language = _attr(block, 'data-language') || _attr(block.parentNode, 'data-language');

        // this adds support for specifying language via a css class
        // you can use the Google Code Prettify style: <pre class="lang-php">
        // or the HTML5 style: <pre><code class="language-php">
        if (!language) {
            var pattern = /\blang(?:uage)?-(\w+)/,
                match = block.className.match(pattern) || block.parentNode.className.match(pattern);

            if (match) {
                language = match[1];
            }
        }

        return language;
    }
619101
protected Block visitBlock(Block block) {
        if (block == null) {
            return null;
        }

        Statement stmt = (Statement)block.accept(this);

        if (stmt instanceof Block) {
            return (Block)stmt;
        }
        else if (stmt != null) {
            return new Block(stmt);
        }
        else {
            return new Block(block.getSourceInfo());
        }
    }
1360997
function getBlock(handle) {
			var block = {
				handle: handle,
				rows: []
			};
			blocks.push(block);
			return block;
		}
71828
function _getLanguageForMode(mode) {
        var language = _modeToLanguageMap[mode];
        if (language) {
            return language;
        }

        // In case of unsupported languages
        console.log("Called LanguageManager._getLanguageForMode with a mode for which no language has been registered:", mode);
        return _fallbackLanguage;
    }
776183
function updateLanguage() {
  var rootBlock = getRootBlock();
  if (!rootBlock) {
    return;
  }
  var blockType = rootBlock.getFieldValue('NAME').trim().toLowerCase();
  if (!blockType) {
    blockType = UNNAMED;
  }
  blockType = blockType.replace(/\W/g, '_').replace(/^(\d)/, '_\\1');
  switch (document.getElementById('format').value) {
    case 'JSON':
      var code = formatJson_(blockType, rootBlock);
      break;
    case 'JavaScript':
      var code = formatJavaScript_(blockType, rootBlock);
      break;
  }
  injectCode(code, 'languagePre');
  updatePreview();
}
418577
public static PropertyDirection getProperty(Block block)
	{
		DirectionalComponent dc = IComponent.getComponent(DirectionalComponent.class, block);
		return dc != null ? dc.getProperty() : null;
	}
1143813
function(block){
    var escapePrettyMode = this.escapePrettyMode;
    var pp = this.pp;
    var ast = [];
    // Pretty print multi-line text
    if (pp && block.nodes.length > 1 && !escapePrettyMode &&
        block.nodes[0].type === 'Text' && block.nodes[1].type === 'Text' ) {
      push.apply(ast, this.prettyIndent(1, true));
    }
    for (var i = 0; i < block.nodes.length; ++i) {
      // Pretty print text
      if (pp && i > 0 && !escapePrettyMode &&
          block.nodes[i].type === 'Text' && block.nodes[i-1].type === 'Text' &&
          /\n$/.test(block.nodes[i - 1].val)) {
        push.apply(ast,this.prettyIndent(1, false));
      }
      push.apply(ast, this.visit(block.nodes[i], block));
    }
    return ast;
  }
344725
def get_codeblock(language, text):
    
    rst = "\n\n.. code-block:: " + language + "\n\n"
    for line in text.splitlines():
        rst += "\t" + line + "\n"

    rst += "\n"
    return rst
396734
function getBlock (queryOptions, { height }) {
  return sendQuery(
    queryOptions,
    queryHelper.addQuery(
      queryHelper.emptyQuery(),
      'getBlock',
      {
        height
      }
    ),
    (resolve, reject, responseName, response) => {
      if (responseName !== 'BLOCK_RESPONSE') {
        const error = JSON.stringify(response.toObject().errorResponse)
        return reject(new Error(`Query response error: expected=BLOCK_RESPONSE, actual=${responseName}\nReason: ${error}`))
      }

      const block = response.getBlockResponse()
      resolve(block)
    }
  )
}
319593
function handleBlocks (config) {
  let blocks = []
  let blocksObj = config.blocks
  for (let i in blocksObj) {
    if (blocksObj.hasOwnProperty(i)) {
      if (isLanguage(blocksObj[i])) {
        blocks.push(_getBlock(config, 'language', true))
      } else {
        blocks.push(_getBlock(config, i))
      }
    }
  }
  return blocks
}
775567
function findLanguageNameFromCode( languageCode ) {
  var a = 0;
  var b = LANGUAGES.length;
  var m = b;
  var item, code, name;

  languageCode = languageCode.toLowerCase();

  while( b - a > 1 ) {
    m = Math.floor( (a + b) / 2 );
    item = LANGUAGES[m];
    code = item[0];
    name = item[1];
    if( code == languageCode ) return name;
    if( languageCode < code ) b = m;
    else a = m;
  }
  return null;
}
1290250
def translation_activate_block(function=None, language=None):
    

    def _translation_activate_block(function):
        def _decorator(*args, **kwargs):
            tmp_language = translation.get_language()
            try:
                translation.activate(language or settings.LANGUAGE_CODE)
                return function(*args, **kwargs)
            finally:
                translation.activate(tmp_language)
        return wraps(function)(_decorator)

    if function:
        return _translation_activate_block(function)
    else:
        return _translation_activate_block
534352
function getBlock() {
  const type = NodeType.BlockType;
  const token = tokens[pos];
  const line = token.ln;
  const column = token.col;
  const end = tokens[pos].right;
  let content = [];

  // Skip `{`.
  pos++;

  while (pos < end) {
    if (checkBlockdecl(pos)) content = content.concat(getBlockdecl());
    else throwError(pos);
  }

  const end_ = getLastPosition(content, line, column, 1);
  pos = end + 1;

  return newNode(type, content, line, column, end_);
}
387695
def visit_literal_block(self, node):
        
        language = node.attributes.get("language", "")
        test_type = node.attributes.get("testnodetype", "")
        if test_type != "doctest":
            if language.lower() in ("", "python"):
                msg = _LITERAL_ERR_TEMPLATE.format(
                    node.rawsource, language, test_type
                )
                raise errors.ExtensionError(msg)

        # The base classes are not new-style, so we can't use super().
        return html.HTMLTranslator.visit_literal_block(self, node)
894421
function (line, block) {
    if (!block.template) {
        return;
    }

    var regex = getRegExp(block.template);
    var match = regex.exec(line);
    return match ? match[1] : match;
}
559250
function block(node) {
  var self = this
  var options = self.options
  var fences = options.fences
  var gap = options.commonmark ? comment : triple
  var values = []
  var children = node.children
  var length = children.length
  var index = -1
  var prev
  var child

  while (++index < length) {
    prev = child
    child = children[index]

    if (prev) {
      // A list preceding another list that are equally ordered, or a
      // list preceding an indented code block, need a gap between them,
      // so as not to see them as one list, or content of the list,
      // respectively.
      //
      // In commonmark, only something that breaks both up can do that,
      // so we opt for an empty, invisible comment.  In other flavours,
      // two blank lines are fine.
      if (
        prev.type === 'list' &&
        ((child.type === 'list' && prev.ordered === child.ordered) ||
          (child.type === 'code' && (!child.lang && !fences)))
      ) {
        values.push(gap)
      } else {
        values.push(blank)
      }
    }

    values.push(self.visit(child, node))
  }

  return values.join('')
}
1126232
function InstructionBuilder(block) {
	var result
	if (Object.keys(Grammar).some(function(name){
		var r = Grammar[name]
		var m = r.header.exec(block.headerLine.content)
		if (m == null) return false
		//console.log(name, block.headerLine.content, m)
		result = r.parse(m, block.bodyLines)
		if (result.name == null) result.name = name
		return true
	})) {
		//console.log(result)
		return result
	} else throw 'Unknown structure:' + block.headerLine.content
}