<commit_before>mixin search()
  form#search
    input(type='search', size='20', title='Search', placeholder='Search')
  ul#search-results.menu

mixin menu()
  ul.menu
    for obj in tree.children
      mixin menu_item(obj, 0)

mixin menu_item(obj, level, parent)
  if typeof obj === 'string'
    obj = list[obj]

  composite = (obj.type === 'section' || obj.type === 'utility' || obj.type === 'namespace' || obj.type === 'class' || obj.type === 'mixin')
  hidden = !( level <= 1 || composite )
  //-li(class=hidden ? 'hidden' : '')
  li
    .menu-item
      short = level === 0 || parent.type === 'section' || !composite
      mixin link(obj, short, [obj.type.replace(/ /g, '-'), obj.deprecated && 'deprecated', obj.chainable && 'chainable', obj.internal && 'internal', obj.readonly && 'readonly'].filter(function(x){return !!x;}))
    if obj.children.length
      ul(class=hidden ? 'hidden' : '')
        for child in obj.children.filter(function(x){return x.type === 'utility'})
          mixin menu_item(child, level + 1, obj)
        for child in obj.children.filter(function(x){return x.type === 'constructor'})
          mixin menu_item(child, level + 1, obj)
        for child in obj.children.filter(function(x){return x.type === 'namespace' || x.type === 'class' || x.type === 'mixin'})
          mixin menu_item(child, level + 1, obj)
        for child in obj.children.filter(function(x){return x.type === 'class method'})
          mixin menu_item(child, level + 1, obj)
        for child in obj.children.filter(function(x){return x.type === 'class property'})
          mixin menu_item(child, level + 1, obj)
        for child in obj.children.filter(function(x){return x.type === 'instance method'})
          mixin menu_item(child, level + 1, obj)
        for child in obj.children.filter(function(x){return x.type === 'instance property'})
          mixin menu_item(child, level + 1, obj)
        for child in obj.children.filter(function(x){return x.type === 'constant'})
          mixin menu_item(child, level + 1, obj)


mixin argument(arg)
  li.argument
    ul.argument-details
      li.argument-name= arg.name
      if arg.types
        li.argument-types
          ul
            for type, i in arg.types
              li.argument-type= type
      if arg.description
        li.argument-description
          mixin markdown(arg.description)


mixin title(obj, parents)
  header

    //- breadcrumbs

    ul.breadcrumbs
      li
        a(href='#home') Home
      for crumb in parents
        if crumb.id
          li
            mixin link(crumb, true)
      li
        mixin link(obj, true)

    h2
      span.type #{obj.type}
      if obj.type === 'section'
        span.name #{obj.name} section
      else
        span.name #{obj.id}

    if obj.href
      .source
        a(href=obj.href) #{viewSourceLabel}



mixin article(obj, parents)
  if typeof obj === 'string'
    obj = list[obj]

  title = obj.id + (obj.type ? ' (' + obj.type + ')' : '')
  article.article(id=obj.path, data-title=title, class=[obj.deprecated && 'deprecated'].filter(function(x){return !!x;}))

    mixin title(obj, parents)

    if obj.deprecated
      .deprecated-note
        | Deprecated
        if obj.deprecated.since
          | &nbsp;since #{obj.deprecated.since}
          if obj.deprecated.off
            | &nbsp;and will be removed on #{obj.deprecated.off}

    if obj.type === 'section' || obj.type === 'namespace' || obj.type === 'class' || obj.type === 'mixin'

      if obj.description
        .section.description
          h3 Description
          .content
            mixin markdown(obj.description)

      collection = obj.children.filter(function(x){return x.type === 'namespace'});
      if collection.length
        .section.namespaces
          h3 Namespaces
          .content
            mixin short_description_list(collection)

      collection = obj.children.filter(function(x){return x.type === 'class'});
      if collection.length
        .section.classes
          h3 Classes
          .content
            mixin short_description_list(collection)

      collection = obj.children.filter(function(x){return x.type === 'mixin'});
      if collection.length
        .section.mixins
          h3 Mixins
          .content
            mixin short_description_list(collection)

      if obj.type === 'class'

        if obj.superclass
          .section.superclass
            h3 Superclass
            .content
              mixin link(obj.superclass)

        if obj.subclasses.length
          .section.subclasses
            h3 Subclasses
            .content
              mixin links(obj.subclasses)

      if obj.included_mixins
        .section.mixins
          h3 Includes
          .content
            mixin links(obj.included_mixins)

      collection = obj.children.filter(function(x){return x.type === 'utility'})
      if collection.length
        .section.utilities
          h3 Utilities
          .content
            mixin links(collection)

      collection = obj.children.filter(function(x){return x.type === 'constructor'})
      if collection.length
        .section.constructor
          h3 Constructor
          .content
          ul.method-list
            li
              mixin link(collection[0])

      //-console.log('HERE', obj.id, obj.children.length)
      for selector, title in {'Class methods': ['class method', 'class_methods'], 'Class properties': ['class property', 'class_properties'], 'Instance methods': ['instance method', 'instance_methods'], 'Instance properties': ['instance property', 'instance_properties'], 'Constants': ['constant', 'constants']}
        methods = obj.children.filter(function(x){return x.type === selector[0]})
        if methods.length
          .section(class='#{selector[1]}')
            h3 #{title}
            .content
              ul.method-list
                for x in methods
                  li
                    mixin link(x, true)

    else

      .section.method(class=[obj.chainable && 'chainable', obj.internal && 'internal', obj.readonly && 'readonly'].filter(function(x){return !!x;}))
        .content
          if obj.signatures
            ul.signatures
              for sig in obj.signatures
                li.signature
                  ul
                    li.signature-call
                      != signature(obj, sig)
                    if sig.returns
                      li.signature-returns
                        ul.argument-types
                          for ret in sig.returns
                            //- N.B: type can be array. E.g. [ Element... ]
                            //- N.B: type can be array. E.g. [ Element1, Element2 ]
                            text = ''
                            if (typeof ret.type !== 'string')
                              - text = ret.type.map(function(r){ return link(r || '?', true, ['link-short']);}).join(', ');
                            else
                              text = link(ret.type || '?', true, ['link-short'])
                            if ret.ellipsis
                              text = text + '...'
                            if ret.array
                              text = '[ ' + text + ' ]'
                            li.argument-type!= text

          if obj.arguments
            ul.argument-list
              for arg in obj.arguments
                mixin argument(arg)

          mixin markdown(obj.description)

          if obj.bound && ~obj.bound.indexOf('#')
            p.note.methodized
              | This method can be called <em>either</em> as an 
              != link(obj.bound, 'instance method', ['link-short'])
              |  <em>or</em> as a generic method. If calling as generic, pass the instance in as the first argument.
          else if obj.bound && !~obj.bound.indexOf('#')
            p.note.functionalized
              | This method can be called <em>either</em> as an instance method <em>or</em> as a 
              != link(obj.bound, 'generic method', ['link-short'])
              |. If calling as generic, pass the instance in as the first argument.

    if obj.aliases && obj.aliases.length
      .alias.aliases
        | Aliased as:
        ul
          for alias in obj.aliases
            li
              mixin link(alias)

    if obj.alias_of
      .alias.alias-of
        | Alias of:
        ul
          li
            mixin link(obj.alias_of)

    if obj.related_to
      .related-to
        | Related to:
        mixin link(obj.related_to)

  //- children
  for child in obj.children.filter(function(x){return x.type === 'section'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'utility'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'constructor'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'namespace' || x.type === 'class' || x.type === 'mixin'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'class method'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'class property'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'instance method'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'instance property'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'constant'})
    mixin article(child, parents.concat(obj))



mixin api()
  for obj in tree.children
    mixin article(obj, [])



mixin short_description_list(collection)
  ul.method-details-list
    for obj in collection
      if typeof obj === 'string'
        obj = list[obj]
      li.method-description
        h4
          mixin link(obj)
        if obj.short_description
          mixin markdown(obj.short_description)



mixin link(obj, short, classes)
  != link(obj, short, classes)



mixin markdown(text, inline)
  html = markdown(text, inline)
  != html



mixin links(collection)
  ul.method-list
    for obj in collection
      li
        mixin link(obj)
<commit_msg>signatures are escaped as well<commit_after>mixin search()
  form#search
    input(type='search', size='20', title='Search', placeholder='Search')
  ul#search-results.menu

mixin menu()
  ul.menu
    for obj in tree.children
      mixin menu_item(obj, 0)

mixin menu_item(obj, level, parent)
  if typeof obj === 'string'
    obj = list[obj]

  composite = (obj.type === 'section' || obj.type === 'utility' || obj.type === 'namespace' || obj.type === 'class' || obj.type === 'mixin')
  hidden = !( level <= 1 || composite )
  //-li(class=hidden ? 'hidden' : '')
  li
    .menu-item
      short = level === 0 || parent.type === 'section' || !composite
      mixin link(obj, short, [obj.type.replace(/ /g, '-'), obj.deprecated && 'deprecated', obj.chainable && 'chainable', obj.internal && 'internal', obj.readonly && 'readonly'].filter(function(x){return !!x;}))
    if obj.children.length
      ul(class=hidden ? 'hidden' : '')
        for child in obj.children.filter(function(x){return x.type === 'utility'})
          mixin menu_item(child, level + 1, obj)
        for child in obj.children.filter(function(x){return x.type === 'constructor'})
          mixin menu_item(child, level + 1, obj)
        for child in obj.children.filter(function(x){return x.type === 'namespace' || x.type === 'class' || x.type === 'mixin'})
          mixin menu_item(child, level + 1, obj)
        for child in obj.children.filter(function(x){return x.type === 'class method'})
          mixin menu_item(child, level + 1, obj)
        for child in obj.children.filter(function(x){return x.type === 'class property'})
          mixin menu_item(child, level + 1, obj)
        for child in obj.children.filter(function(x){return x.type === 'instance method'})
          mixin menu_item(child, level + 1, obj)
        for child in obj.children.filter(function(x){return x.type === 'instance property'})
          mixin menu_item(child, level + 1, obj)
        for child in obj.children.filter(function(x){return x.type === 'constant'})
          mixin menu_item(child, level + 1, obj)


mixin argument(arg)
  li.argument
    ul.argument-details
      li.argument-name= arg.name
      if arg.types
        li.argument-types
          ul
            for type, i in arg.types
              li.argument-type= type
      if arg.description
        li.argument-description
          mixin markdown(arg.description)


mixin title(obj, parents)
  header

    //- breadcrumbs

    ul.breadcrumbs
      li
        a(href='#home') Home
      for crumb in parents
        if crumb.id
          li
            mixin link(crumb, true)
      li
        mixin link(obj, true)

    h2
      span.type #{obj.type}
      if obj.type === 'section'
        span.name #{obj.name} section
      else
        span.name #{obj.id}

    if obj.href
      .source
        a(href=obj.href) #{viewSourceLabel}



mixin article(obj, parents)
  if typeof obj === 'string'
    obj = list[obj]

  title = obj.id + (obj.type ? ' (' + obj.type + ')' : '')
  article.article(id=obj.path, data-title=title, class=[obj.deprecated && 'deprecated'].filter(function(x){return !!x;}))

    mixin title(obj, parents)

    if obj.deprecated
      .deprecated-note
        | Deprecated
        if obj.deprecated.since
          | &nbsp;since #{obj.deprecated.since}
          if obj.deprecated.off
            | &nbsp;and will be removed on #{obj.deprecated.off}

    if obj.type === 'section' || obj.type === 'namespace' || obj.type === 'class' || obj.type === 'mixin'

      if obj.description
        .section.description
          h3 Description
          .content
            mixin markdown(obj.description)

      collection = obj.children.filter(function(x){return x.type === 'namespace'});
      if collection.length
        .section.namespaces
          h3 Namespaces
          .content
            mixin short_description_list(collection)

      collection = obj.children.filter(function(x){return x.type === 'class'});
      if collection.length
        .section.classes
          h3 Classes
          .content
            mixin short_description_list(collection)

      collection = obj.children.filter(function(x){return x.type === 'mixin'});
      if collection.length
        .section.mixins
          h3 Mixins
          .content
            mixin short_description_list(collection)

      if obj.type === 'class'

        if obj.superclass
          .section.superclass
            h3 Superclass
            .content
              mixin link(obj.superclass)

        if obj.subclasses.length
          .section.subclasses
            h3 Subclasses
            .content
              mixin links(obj.subclasses)

      if obj.included_mixins
        .section.mixins
          h3 Includes
          .content
            mixin links(obj.included_mixins)

      collection = obj.children.filter(function(x){return x.type === 'utility'})
      if collection.length
        .section.utilities
          h3 Utilities
          .content
            mixin links(collection)

      collection = obj.children.filter(function(x){return x.type === 'constructor'})
      if collection.length
        .section.constructor
          h3 Constructor
          .content
          ul.method-list
            li
              mixin link(collection[0])

      //-console.log('HERE', obj.id, obj.children.length)
      for selector, title in {'Class methods': ['class method', 'class_methods'], 'Class properties': ['class property', 'class_properties'], 'Instance methods': ['instance method', 'instance_methods'], 'Instance properties': ['instance property', 'instance_properties'], 'Constants': ['constant', 'constants']}
        methods = obj.children.filter(function(x){return x.type === selector[0]})
        if methods.length
          .section(class='#{selector[1]}')
            h3 #{title}
            .content
              ul.method-list
                for x in methods
                  li
                    mixin link(x, true)

    else

      .section.method(class=[obj.chainable && 'chainable', obj.internal && 'internal', obj.readonly && 'readonly'].filter(function(x){return !!x;}))
        .content
          if obj.signatures
            ul.signatures
              for sig in obj.signatures
                li.signature
                  ul
                    li.signature-call
                      = signature(obj, sig)
                    if sig.returns
                      li.signature-returns
                        ul.argument-types
                          for ret in sig.returns
                            //- N.B: type can be array. E.g. [ Element... ]
                            //- N.B: type can be array. E.g. [ Element1, Element2 ]
                            text = ''
                            if (typeof ret.type !== 'string')
                              - text = ret.type.map(function(r){ return link(r || '?', true, ['link-short']);}).join(', ');
                            else
                              text = link(ret.type || '?', true, ['link-short'])
                            if ret.ellipsis
                              text = text + '...'
                            if ret.array
                              text = '[ ' + text + ' ]'
                            li.argument-type!= text

          if obj.arguments
            ul.argument-list
              for arg in obj.arguments
                mixin argument(arg)

          mixin markdown(obj.description)

          if obj.bound && ~obj.bound.indexOf('#')
            p.note.methodized
              | This method can be called <em>either</em> as an 
              != link(obj.bound, 'instance method', ['link-short'])
              |  <em>or</em> as a generic method. If calling as generic, pass the instance in as the first argument.
          else if obj.bound && !~obj.bound.indexOf('#')
            p.note.functionalized
              | This method can be called <em>either</em> as an instance method <em>or</em> as a 
              != link(obj.bound, 'generic method', ['link-short'])
              |. If calling as generic, pass the instance in as the first argument.

    if obj.aliases && obj.aliases.length
      .alias.aliases
        | Aliased as:
        ul
          for alias in obj.aliases
            li
              mixin link(alias)

    if obj.alias_of
      .alias.alias-of
        | Alias of:
        ul
          li
            mixin link(obj.alias_of)

    if obj.related_to
      .related-to
        | Related to:
        mixin link(obj.related_to)

  //- children
  for child in obj.children.filter(function(x){return x.type === 'section'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'utility'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'constructor'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'namespace' || x.type === 'class' || x.type === 'mixin'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'class method'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'class property'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'instance method'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'instance property'})
    mixin article(child, parents.concat(obj))
  for child in obj.children.filter(function(x){return x.type === 'constant'})
    mixin article(child, parents.concat(obj))



mixin api()
  for obj in tree.children
    mixin article(obj, [])



mixin short_description_list(collection)
  ul.method-details-list
    for obj in collection
      if typeof obj === 'string'
        obj = list[obj]
      li.method-description
        h4
          mixin link(obj)
        if obj.short_description
          mixin markdown(obj.short_description)



mixin link(obj, short, classes)
  != link(obj, short, classes)



mixin markdown(text, inline)
  html = markdown(text, inline)
  != html



mixin links(collection)
  ul.method-list
    for obj in collection
      li
        mixin link(obj)

{'fraction_non_alphanumeric': 0.1281567489114659, 'fraction_numerical': 0.002902757619738752, 'mean_word_length': 2.003196280691559, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7036851', 'n_tokens_mistral': 5948, 'n_tokens_neox': 5825, 'n_words': 1488}