Sha256: d6ecd61dae7cfd62886b3588f036dcf94a283699f9dd6449937fe9af92bd4854

Contents?: true

Size: 1.33 KB

Versions: 7

Compression:

Stored size: 1.33 KB

Contents

<script type="text/javascript">
  $('h2.api_method_name').each(function(i, el) {
    var subtopic = $(el).data('subtopic');
    var $a = $(el).find('a');
    var anchorText = $.trim($a[0].innerHTML);

    if (anchorText === '') {
      return;
    }

    var $row = $('#quicklinks');
    var $link = $('<a/>', {
      href: '#'+$(el).attr('name')
    }).html(anchorText);

    $('<li>').append($link).appendTo($row);
  });

  // Highlight the current page in the sidebar
  $(function() {
    var currentPage = location.pathname.match(/\/([^\/]+)$/)[1];
    var $page = $('#sidebar [href="' + currentPage + '"]');

    if (!currentPage) {
      return;
    }

    // if ($page.length === 0) {
    //   $page = $('#sidebar a[href=""]');
    // }

    // $page.addClass('active');
    console.log('Highlighting current page:', $page, currentPage);
  });

  $('#content pre').each(function(i, block) {
    var code;
    var $block = $(block);
    var $codeEl = $block.find('> code');

    // RedCarpet markdown renderer will convert fenced code blocks into
    // <pre><code>...</code></pre> and we want to remove that <code /> el and
    // use a plain <pre /> instead:
    if ($block.children().length === 1 && $codeEl.length) {
      code = $codeEl.text();
      $codeEl.remove();
      $block.html(code);
    }

    hljs.highlightBlock(block);
  });
</script>

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
yard-api-0.2.2 templates/api/layout/html/scripts.erb
yard-api-0.2.1 templates/api/layout/html/scripts.erb
yard-api-0.1.10 templates/api/layout/html/scripts.erb
yard-api-0.1.8 templates/api/layout/html/scripts.erb
yard-api-0.1.7 templates/api/layout/html/scripts.erb
yard-api-0.1.6 templates/api/layout/html/scripts.erb
yard-api-0.1.5 templates/api/layout/html/scripts.erb