<commit_before>include ../mixins/header-docs.jade
include ../mixins/footer-docs.jade

//- XXX - This needs to be refactored.
- var path = locals.nav_path.split('/')
- var findPath = function (childPath) { return path.find(function(item) { return item === childPath}) };
- var stripExtname = function(file) {
-   if(file.substr(file.length-10, file.length) === 'index.html') return file.substr(0, file.length-10);
-   return file.substr(file.length-5, file.length) === '.html' ? file.substr(0, file.length-5) + "/" : file;
- }
- var routeForIndexPath = function(child) { return child.children.find(function(n) { return n.name === 'index.html'}) ? `/docs/latest/${child.path}/` : '#' }
- var nameForIndexPath = function(child) {
-   var result = child.children.find(function(n) { return n.name === 'index.html'});
-   if(result) return result.file.post_title;
-   return child.name;
- }

mixin renderMenu(tree)
  ul
    each child in tree
      if(child.path.substr(child.path.length-10, child.path.length) !== 'index.html')
        if(child.file)
          if(findPath(child.path))
            li.docs-nav__item.docs-nav__item_file
              if(locals.nav_path === child.path)
                img(src='/assets/images/icons/docs-file-active.svg')
                a.docs-nav__item__title(href='/docs/latest/#{stripExtname(child.path)}').active #{child.file.post_title}
              else
                a.docs-nav__item__title(href='/docs/latest/#{stripExtname(child.path)}') #{child.file.post_title}
              if(child.children)
                +renderMenu(child.children)
          else
            li.docs-nav__item.docs-nav__item_file.docs-nav__item--closed
              if(locals.nav_path === child.path)
                
                a.docs-nav__item__title(href='/docs/latest/#{stripExtname(child.path)}').active #{child.file.post_title}
              else
                a.docs-nav__item__title(href='/docs/latest/#{stripExtname(child.path)}') #{child.file.post_title}
              if(child.children)
                +renderMenu(child.children)

        else
          if(findPath(child.name))
            if(child.name !== 'img')
              li.docs-nav__item.docs-nav__item_folder
                a.docs-nav__item__arrow(href='#')
                  img(src='/assets/images/icons/arrow-down-docs.svg')
                if(findPath(child.path.split('/').pop()))
                  a.docs-nav__item__title(href='#{routeForIndexPath(child)}', data-path='#{child.name}').active #{nameForIndexPath(child)}
                else
                  a.docs-nav__item__title(href='#{routeForIndexPath(child)}', data-path='#{child.name}') #{nameForIndexPath(child)}
                if(child.children)
                  +renderMenu(child.children)
          else
            if(child.name !== 'img')
              li.docs-nav__item.docs-nav__item_folder.docs-nav__item--closed
                a.docs-nav__item__arrow(href='#')
                  img(src='/assets/images/icons/arrow-right-docs.svg')
                if(findPath(child.path.split('/').pop()))
                  a.docs-nav__item__title(href='#{routeForIndexPath(child)}', data-path='#{child.name}').active #{nameForIndexPath(child)}
                else
                  a.docs-nav__item__title(href='#{routeForIndexPath(child)}', data-path='#{child.name}') #{nameForIndexPath(child)}
                if(child.children)
                  +renderMenu(child.children)

<!doctype html>
html
  head
    link(rel='stylesheet', type='text/css', href='/styles/index.css')
    meta(name="viewport" content="width=device-width, initial-scale=1")
    link(rel='stylesheet', href='//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.3.0/styles/railscasts.min.css')
    script(src='//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.3.0/highlight.min.js')
    link(rel="shortcut icon" type="image/x-icon" href="/assets/images/icons/favicon/favicon.ico")
    link(rel="apple-touch-icon" href="/assets/images/icons/favicon/favicon-apple-57x57.png")
    link(rel="apple-touch-icon" sizes="72x72" href="/assets/images/icons/favicon/favicon-apple-72x72.png")
    link(rel="apple-touch-icon" sizes="114x114" href="/assets/images/icons/favicon/favicon-apple-114x114.png")
    link(rel="apple-touch-icon" sizes="144x144" href="/assets/images/icons/favicon/favicon-apple-144x144.png")
    link(rel="apple-touch-icon-precomposed" href="/assets/images/icons/favicon/favicon-apple-57x57.png")
    link(rel="apple-touch-icon-precomposed" sizes="72x72" href="/assets/images/icons/favicon/favicon-apple-72x72.png")
    link(rel="apple-touch-icon-precomposed" sizes="114x114" href="/assets/images/icons/favicon/favicon-apple-114x114.png")
    link(rel="apple-touch-icon-precomposed" sizes="144x144" href="/assets/images/icons/favicon/favicon-apple-144x144.png")
    link(rel="apple-touch-icon" sizes="60x60" href="/assets/images/icons/favicon/favicon-apple-60x60.png")
    link(rel="apple-touch-icon" sizes="76x76" href="/assets/images/icons/favicon/favicon-apple-76x76.png")
    link(rel="apple-touch-icon" sizes="120x120" href="/assets/images/icons/favicon/favicon-apple-120x120.png")
    link(rel="apple-touch-icon" sizes="152x152" href="/assets/images/icons/favicon/favicon-apple-152x152.png")
    link(rel="apple-touch-icon-precomposed" sizes="60x60" href="/assets/images/icons/favicon/favicon-apple-60x60.png")
    link(rel="apple-touch-icon-precomposed" sizes="76x76" href="/assets/images/icons/favicon/favicon-apple-76x76.png")
    link(rel="apple-touch-icon-precomposed" sizes="120x120" href="/assets/images/icons/favicon/favicon-apple-120x120.png")
    link(rel="apple-touch-icon-precomposed" sizes="152x152" href="/assets/images/icons/favicon/favicon-apple-152x152.png")

    script.
      var __dcos_docs = !{JSON.stringify(locals.navs.json)};

    block head
      title!= post_title

  body
    block content
      .container.container--docs-header
        +header

      .container
        .container__content.docs-layout
          .docs-layout__docs-nav
            .docs-search
              input(type='search').docs-search__input
            +renderMenu(locals.navs.header)

          // Search results
          .docs-layout__docs-content.docs-layout__docs-results(style='display: none;')


          .docs-layout__docs-content.docs-layout__docs-article
            article!= contents

            .docs-content__footer
              ul.docs-content__footer__actions
                li.docs-content__footer__action
                  a(href='#').addthis_button_expanded
                    img.docs-content__footer__share-icon(src='/assets/images/icons/share.svg')
                    span Share

              ul.docs-content__footer__actions
                li.docs-content__footer__action
                  img.docs-content__footer__feedback-icon(src='/assets/images/icons/feedback.svg')
                  a(href='https://github.com/dcos/dcos-docs/issues/new' id='submit-feedback' target='blank') Submit feedback

      .container
        +footer

  script(src='/scripts/main.js')
  script(src='/assets/scripts/lunr.min.js')
  script(src='/scripts/docs.js')
  script(src='/scripts/overlay.js')
  script(src='//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-570558ee2719a9f0')
<commit_msg>fix #316<commit_after>include ../mixins/header-docs.jade
include ../mixins/footer-docs.jade

//- XXX - This needs to be refactored.
- var path = locals.nav_path.split('/')
- var findPath = function (childPath) { return path.find(function(item) { return item === childPath}) };
- var stripExtname = function(file) {
-   if(file.substr(file.length-10, file.length) === 'index.html') return file.substr(0, file.length-10);
-   return file.substr(file.length-5, file.length) === '.html' ? file.substr(0, file.length-5) + "/" : file;
- }
- var routeForIndexPath = function(child) { return child.children.find(function(n) { return n.name === 'index.html'}) ? `/docs/latest/${child.path}/` : '#' }
- var nameForIndexPath = function(child) {
-   var result = child.children.find(function(n) { return n.name === 'index.html'});
-   if(result) return result.file.post_title;
-   return child.name;
- }

mixin renderMenu(tree)
  ul
    each child in tree
      if(child.path.substr(child.path.length-10, child.path.length) !== 'index.html')
        if(child.file)
          if(findPath(child.path))
            li.docs-nav__item.docs-nav__item_file
              if(locals.nav_path === child.path)
                img(src='/assets/images/icons/docs-file-active.svg')
                a.docs-nav__item__title(href='/docs/latest/#{stripExtname(child.path)}').active #{child.file.post_title}
              else
                a.docs-nav__item__title(href='/docs/latest/#{stripExtname(child.path)}') #{child.file.post_title}
              if(child.children)
                +renderMenu(child.children)
          else
            li.docs-nav__item.docs-nav__item_file.docs-nav__item--closed
              if(locals.nav_path === child.path)
                
                a.docs-nav__item__title(href='/docs/latest/#{stripExtname(child.path)}').active #{child.file.post_title}
              else
                a.docs-nav__item__title(href='/docs/latest/#{stripExtname(child.path)}') #{child.file.post_title}
              if(child.children)
                +renderMenu(child.children)

        else
          if(findPath(child.name))
            if(child.name !== 'img')
              li.docs-nav__item.docs-nav__item_folder
                a.docs-nav__item__arrow(href='#')
                  img(src='/assets/images/icons/arrow-down-docs.svg')
                if(findPath(child.path.split('/').pop()))
                  a.docs-nav__item__title(href='#{routeForIndexPath(child)}', data-path='#{child.name}').active #{nameForIndexPath(child)}
                else
                  a.docs-nav__item__title(href='#{routeForIndexPath(child)}', data-path='#{child.name}') #{nameForIndexPath(child)}
                if(child.children)
                  +renderMenu(child.children)
          else
            if(child.name !== 'img')
              li.docs-nav__item.docs-nav__item_folder.docs-nav__item--closed
                a.docs-nav__item__arrow(href='#')
                  img(src='/assets/images/icons/arrow-right-docs.svg')
                if(findPath(child.path.split('/').pop()))
                  a.docs-nav__item__title(href='#{routeForIndexPath(child)}', data-path='#{child.name}').active #{nameForIndexPath(child)}
                else
                  a.docs-nav__item__title(href='#{routeForIndexPath(child)}', data-path='#{child.name}') #{nameForIndexPath(child)}
                if(child.children)
                  +renderMenu(child.children)

<!doctype html>
html
  head
    link(rel='stylesheet', type='text/css', href='/styles/index.css')
    meta(name="viewport" content="width=device-width, initial-scale=1")
    link(rel='stylesheet', href='//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.3.0/styles/railscasts.min.css')
    script(src='//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.3.0/highlight.min.js')
    link(rel="shortcut icon" type="image/x-icon" href="/assets/images/icons/favicon/favicon.ico")
    link(rel="apple-touch-icon" href="/assets/images/icons/favicon/favicon-apple-57x57.png")
    link(rel="apple-touch-icon" sizes="72x72" href="/assets/images/icons/favicon/favicon-apple-72x72.png")
    link(rel="apple-touch-icon" sizes="114x114" href="/assets/images/icons/favicon/favicon-apple-114x114.png")
    link(rel="apple-touch-icon" sizes="144x144" href="/assets/images/icons/favicon/favicon-apple-144x144.png")
    link(rel="apple-touch-icon-precomposed" href="/assets/images/icons/favicon/favicon-apple-57x57.png")
    link(rel="apple-touch-icon-precomposed" sizes="72x72" href="/assets/images/icons/favicon/favicon-apple-72x72.png")
    link(rel="apple-touch-icon-precomposed" sizes="114x114" href="/assets/images/icons/favicon/favicon-apple-114x114.png")
    link(rel="apple-touch-icon-precomposed" sizes="144x144" href="/assets/images/icons/favicon/favicon-apple-144x144.png")
    link(rel="apple-touch-icon" sizes="60x60" href="/assets/images/icons/favicon/favicon-apple-60x60.png")
    link(rel="apple-touch-icon" sizes="76x76" href="/assets/images/icons/favicon/favicon-apple-76x76.png")
    link(rel="apple-touch-icon" sizes="120x120" href="/assets/images/icons/favicon/favicon-apple-120x120.png")
    link(rel="apple-touch-icon" sizes="152x152" href="/assets/images/icons/favicon/favicon-apple-152x152.png")
    link(rel="apple-touch-icon-precomposed" sizes="60x60" href="/assets/images/icons/favicon/favicon-apple-60x60.png")
    link(rel="apple-touch-icon-precomposed" sizes="76x76" href="/assets/images/icons/favicon/favicon-apple-76x76.png")
    link(rel="apple-touch-icon-precomposed" sizes="120x120" href="/assets/images/icons/favicon/favicon-apple-120x120.png")
    link(rel="apple-touch-icon-precomposed" sizes="152x152" href="/assets/images/icons/favicon/favicon-apple-152x152.png")

    script.
      var __dcos_docs = !{JSON.stringify(locals.navs.json)};

    block head
      title!= locals.post_title

  body
    block content
      .container.container--docs-header
        +header

      .container
        .container__content.docs-layout
          .docs-layout__docs-nav
            .docs-search
              input(type='search').docs-search__input
            +renderMenu(locals.navs.header)

          // Search results
          .docs-layout__docs-content.docs-layout__docs-results(style='display: none;')


          .docs-layout__docs-content.docs-layout__docs-article
            h1!= locals.post_title
            article!= contents

            .docs-content__footer
              ul.docs-content__footer__actions
                li.docs-content__footer__action
                  a(href='#').addthis_button_expanded
                    img.docs-content__footer__share-icon(src='/assets/images/icons/share.svg')
                    span Share

              ul.docs-content__footer__actions
                li.docs-content__footer__action
                  img.docs-content__footer__feedback-icon(src='/assets/images/icons/feedback.svg')
                  a(href='https://github.com/dcos/dcos-docs/issues/new' id='submit-feedback' target='blank') Submit feedback

      .container
        +footer

  script(src='/scripts/main.js')
  script(src='/assets/scripts/lunr.min.js')
  script(src='/scripts/docs.js')
  script(src='/scripts/overlay.js')
  script(src='//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-570558ee2719a9f0')

{'fraction_non_alphanumeric': 0.1616321475263194, 'fraction_numerical': 0.025734535195761372, 'mean_word_length': 2.8674827035657264, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3662463', 'n_tokens_mistral': 5067, 'n_tokens_neox': 4692, 'n_words': 481}