FIXME: this and the --include-all doesn't seem to be very happy, redefine one one queries different types of pages
203
private Predicate<HelpPage> query(final Predicate<HelpPage> predicate) {
    Predicate<HelpPage> query = predicate;

    if (includeAll == null || !includeAll) {
      if (includeAliases != null && !includeAliases) {
        query = query.and(TypePredicate.of(AliasHelpPage.class).negate());
      }
      if (includeMeta != null && !includeMeta) {
        query = query.and(TypePredicate.of(MetaHelpPage.class).negate());
      }
      if (includeCommands != null && !includeCommands) {
        query = query.and(TypePredicate.of(CommandHelpPage.class).negate());
      }
      if (includeGroups != null && !includeGroups) {
        query = query.and(TypePredicate.of(GroupHelpPage.class).negate());
      }
    }

    return query;
  }
124653
function(req){
    var params = req.params.all();
    _.merge(params, req.headers);
    return _.merge(params, req.query);
  }
738548
function () {
                var items = this.items;
                var itemsLength = items.length;
                var pageSize = this.pageSize;
                if (pageSize <= 0) {
                    pageSize = -1;
                }
                var pages = [], pageLength = 0;
                var pageIndex = 0;
                var nbElementsInPage = 0;
                var firstElement = -1;
                for (var i = 0; i < itemsLength; i++) {
                    var elt = items[i];
                    if (elt.filteredIn) {
                        if (nbElementsInPage === 0) {
                            firstElement = i;
                        }
                        nbElementsInPage++;
                        elt.pageIndex = pageIndex;
                        if (nbElementsInPage == pageSize) {
                            pages[pageLength++] = {
                                pageIndex : pageIndex,
                                pageNumber : pageIndex + 1,
                                firstItemIndex : firstElement,
                                lastItemIndex : i,
                                firstItemNumber : pageIndex * pageSize + 1,
                                lastItemNumber : (pageIndex + 1) * pageSize
                            };
                            pageIndex++;
                            nbElementsInPage = 0;
                        }
                    } else {
                        elt.pageIndex = -1;
                    }
                }
                this._currentState.pageSize = pageSize;
                this.pageMode = (pageSize > 0);
                this.filteredInCount = pageIndex * pageSize + nbElementsInPage; // true even when pageMode == false (as
                // pageIndex == 0)
                if (nbElementsInPage > 0) {
                    pages[pageLength++] = {
                        pageIndex : pageIndex,
                        pageNumber : pageIndex + 1,
                        firstItemIndex : firstElement,
                        lastItemIndex : itemsLength - 1,
                        firstItemNumber : pageIndex * pageSize + 1,
                        lastItemNumber : this.filteredInCount
                    };
                }
                if (pageLength === 0) {
                    // there always must be at least one page
                    pages = this.EMPTY_PAGES;
                }
                this.pages = pages;
            }
1285143
public void addInclude(String include) {

        include = normalizePath(include);
        m_includes.add(include);
        m_allPaths.add(include);
    }
873872
function(allOfList, definitions) {
    var length = allOfList.length,
        index = -1,
        result = {};

    while (++index < length) {
      var item = allOfList[index];

      item = (typeof item.$ref !== 'undefined') ? getLocalRef(item.$ref, definitions) : item;

      result = merge(result, item);
    }

    return result;
  }
354753
def query_all():
        '''
        
        '''
        recs = TabPost2Tag.select(
            TabPost2Tag,
            TabTag.kind.alias('tag_kind'),
        ).join(
            TabTag,
            on=(TabPost2Tag.tag_id == TabTag.uid)
        )
        return recs
1102212
function includeReferences(include, doc) {
  _.each(include, function (keypath) {
    var parts = keypath.split('.')
    var key = parts.shift()

    if (_.has(doc, key) && _.isString(doc[key])) {
      var ref = doc[key].split(':')
      doc[key] = getDocument({ collection: ref[0], id: ref[1] })

      if (parts.length > 0) {
        includeReferences(parts.slice(1), doc[key])
      }
    }
  })
}
1222673
def addReplaceDBPage( dbid, pageid, pagename, pagetype, pagebody, ignoreError = nil )

      @dbid, @pageid, @pagename, @pagetype, @pagebody, @ignoreError = dbid, pageid, pagename, pagetype, pagebody, ignoreError

      if pageid
         xmlRequestData = toXML( :pageid, @pageid )
      elsif pagename
         xmlRequestData = toXML( :pagename, @pagename )
      else
         raise "addReplaceDBPage: missing pageid or pagename"
      end

      xmlRequestData << toXML( :pagetype, @pagetype )
      xmlRequestData << toXML( :pagebody, encodeXML( @pagebody ) )
      xmlRequestData << toXML( :ignoreError, "1" ) if @ignoreError

      sendRequest( :addReplaceDBPage, xmlRequestData )

      @pageid = getResponseValue( :pageid )
      @pageid ||= getResponseValue( :pageID ) # temporary

      return self if @chainAPIcalls
      @pageid
    end
551204
void recomposeIncludes(Stylesheet including)
  {

    int n = including.getIncludeCount();

    if (n > 0)
    {
      if (null == m_includesComposed)
        m_includesComposed = new Vector();

      for (int i = 0; i < n; i++)
      {
        Stylesheet included = including.getInclude(i);
        m_includesComposed.addElement(included);
        recomposeIncludes(included);
      }
    }
  }
671620
function atpage() {
    var pos = position();
    var m = match(/^@page */);
    if (!m) return;

    var sel = selector() || [];

    if (!open()) return error("@page missing '{'");
    var decls = comments();

    // declarations
    var decl;
    while (decl = declaration()) {
      decls.push(decl);
      decls = decls.concat(comments());
    }

    if (!close()) return error("@page missing '}'");

    return pos({
      type: 'page',
      selectors: sel,
      declarations: decls
    });
  }
116471
function reduceIncludes(includes) {
	return includes.reduce((res, el) => {
		if (
			!res.length ||
			!res[res.length - 1].actualNode.contains(el.actualNode)
		) {
			res.push(el);
		}
		return res;
	}, []);
}
755442
function fixAnchors (hook) {

  hook.afterEach(function (html, next) {

    // find all headings and replace them
    html = html.replace(/<(h\d).+?<\/\1>/g, function (html) {

      // create temp node
      var div = document.createElement('div')
      div.innerHTML = html

      // get anchor
      var link = div.querySelector('a[href*="?id"]')

      if (!link) {
        return html
      }

      // work out id
      var text = link.innerText
      var id = text
        .split('(')
        .shift()
        .toLowerCase()
        .replace(/\W+/g, '-')
        .replace(/^-+|-+$/g, '')
      var href = link.getAttribute('href')
        .replace(/\?id=.+/, '?id=' + id)

      // update dom
      link.setAttribute('href', href)
      link.setAttribute('data-id', id)
      link.parentElement.setAttribute('id', id)

      // return html
      return div.innerHTML
    })

    // continue
    next(html)
  })
}
85135
def included(base = nil, &block)
      if base.nil?
        if instance_variable_defined?(:@_included_block)
          if @_included_block.source_location != block.source_location
            raise MultipleIncludedBlocks
          end
        else
          @_included_block = block
        end
      else
        super
      end
    end
204309
function(result, child_config, include_name_stack, properties) {

		if (include_name_stack.indexOf(child_config.name) != -1) Lava.t("Infinite include recursion");
		var include = Lava.view_manager.getInclude(this._parent_view, child_config);
		if (Lava.schema.DEBUG && include == null) Lava.t("Include not found: " + child_config.name);

		include_name_stack.push(child_config.name);
		this._createChildren(result, include, include_name_stack, properties);
		include_name_stack.pop();

	}
1335758
function (searchParams, otherParams) {
                var mergedParams = extend(searchParams, otherParams),
                    paramKey,
                    searchString = '';
                
                for (paramKey in mergedParams) {
                    if (mergedParams.hasOwnProperty(paramKey)) {
                        if (!searchString) {
                            searchString += '?' + paramKey + '=' + mergedParams[paramKey];
                        } else {
                            searchString += '&' + paramKey + '=' + mergedParams[paramKey];
                        }
                    }
                }
                
                return searchString;
            }
758944
function handleIncludes (resp, includes, relations, options) {
  var app = options.app

  relations = utils.setIncludedRelations(relations, app)

  var resources = _.isArray(resp.data) ? resp.data : [resp.data]

  if (typeof includes === 'string') {
    includes = [includes]
  }

  if (!_.isArray(includes)) {
    throw RelUtils.getInvalidIncludesError(
      'JSON API unable to detect valid includes'
    )
  }

  var embedded = resources.map(function subsituteEmbeddedForIds (resource) {
    return includes.map(function (include) {
      var relation = relations[include]
      var includedRelations = relations[include].relations
      var propertyKey = relation.keyFrom
      var plural = ''
      if (relation.polymorphic && utils.relationFkOnModelFrom(relation)) {
        var descriminator = relation.polymorphic.discriminator
        var discriminator = resource.attributes[descriminator]
        plural = utils.pluralForModel(app.models[discriminator])
      } else {
        plural = utils.pluralForModel(relation.modelTo)
      }
      var embeds = []

      // If relation is belongsTo then pk and fk are the other way around
      if (utils.relationFkOnModelFrom(relation)) {
        propertyKey = relation.keyTo
      }

      if (!relation) {
        throw RelUtils.getInvalidIncludesError(
          'Can\'t locate relationship "' + include + '" to include'
        )
      }

      resource.relationships[include] = resource.relationships[include] || {}

      if (resource.relationships[include] && resource.attributes[include]) {
        if (_.isArray(resource.attributes[include])) {
          embeds = resource.attributes[include].map(function (rel) {
            rel = utils.clone(rel)
            return createCompoundIncludes(
              rel,
              propertyKey,
              relation.keyTo,
              plural,
              includedRelations,
              options
            )
          })
          embeds = _.compact(embeds)
          const included = resource.attributes[include]
          resource.relationships[include].data = included.map(relData => {
            return {
              id: String(relData[propertyKey]),
              type: plural
            }
          })
        } else {
          var rel = utils.clone(resource.attributes[include])
          var compoundIncludes = createCompoundIncludes(
            rel,
            propertyKey,
            relation.keyFrom,
            plural,
            includedRelations,
            options
          )

          resource.relationships[include].data = {
            id: String(resource.attributes[include][propertyKey]),
            type: plural
          }
          embeds.push(compoundIncludes)
        }
        delete resource.attributes[relation.keyFrom]
        delete resource.attributes[relation.keyTo]
        delete resource.attributes[include]
      }
      return embeds
    })
  })

  if (embedded.length) {
    // This array may contain duplicate models if the same item is referenced multiple times in 'data'
    var duplicate = _.flattenDeep(embedded)
    // So begin with an empty array that will only contain unique items
    var unique = []
    // Iterate through each item in the first array
    duplicate.forEach(function (d) {
      // Count the number of items in the unique array with matching 'type' AND 'id'
      // Since we're adhering to the JSONAPI spec, both 'type' and 'id' can assumed to be present
      // Both 'type' and 'id' are needed for comparison because we could theoretically have objects of different
      // types who happen to have the same 'id', and those would not be considered duplicates
      var count = unique.filter(function (u) {
        return u.type === d.type && u.id === d.id
      }).length
      // If there are no matching entries, then add the item to the unique array
      if (count === 0) {
        unique.push(d)
      }
    })
    resp.included = unique
  }
}
196489
function fixAllLinks(htmlFiles) {
  const writePromises = [];
  htmlFiles.forEach(file => {
    // Update links in each html file to match flattened file structure.
    writePromises.push(fixLinks(`${docPath}/${file}.html`));
  });
  return Promise.all(writePromises);
}