page.progress is a deprecated property from GitBook v2

@param {Output}
@param {Page}
@return {Object}
540148
function encodeProgress(output, page) {
    var current = page.getPath();
    var navigation = encodeNavigation(output);
    navigation = Immutable.Map(navigation);

    var n = navigation.size;
    var percent = 0, prevPercent = 0, currentChapter = null;
    var done = true;

    var chapters = navigation
        .map(function(nav, chapterPath) {
            nav.path = chapterPath;
            return nav;
        })
        .valueSeq()
        .sortBy(function(nav) {
            return nav.index;
        })
        .map(function(nav, i) {
            // Calcul percent
            nav.percent = (i * 100) / Math.max((n - 1), 1);

            // Is it done
            nav.done = done;
            if (nav.path == current) {
                currentChapter = nav;
                percent = nav.percent;
                done = false;
            } else if (done) {
                prevPercent = nav.percent;
            }

            return nav;
        })
        .toJS();

    return {
        // Previous percent
        prevPercent: prevPercent,

        // Current percent
        percent: percent,

        // List of chapter with progress
        chapters: chapters,

        // Current chapter
        current: currentChapter
    };
}
100667
function parseProgressLine(line) {
  var progress = {};

  // Remove all spaces after = and trim
  line  = line.replace(/=\s+/g, '=').trim();
  var progressParts = line.split(' ');

  // Split every progress part by "=" to get key and value
  for(var i = 0; i < progressParts.length; i++) {
    var progressSplit = progressParts[i].split('=', 2);
    var key = progressSplit[0];
    var value = progressSplit[1];

    // This is not a progress line
    if(typeof value === 'undefined')
      return null;

    progress[key] = value;
  }

  return progress;
}
904691
function notifyStepProgress(element, progress) {
    const index = getIndex(element);
    if (progress !== undefined) stepStates[index].progress = progress;
    const resp = { element, index, progress: stepStates[index].progress };

    if (stepStates[index].state === 'enter') cb.stepProgress(resp);
  }
1057312
function _logProgress(req) {
  req.on('response', function(resp) {
    var len = parseInt(resp.headers['content-length'], 10),
      bar = new ProgressBar('[:bar]', {
        complete: '=',
        incomplete: ' ',
        total: len,
        width: 100, // just use 100
      });

    req.on('data', function(chunk) {
      bar.tick(chunk.length);
    });
  });

  req.on('error', function(err) {
    console.log(err);
    _log('error', 'failed to download node sources,');
    process.exit(1);
  });

  return req;
}
1058203
function PageBase(props, $container, vdir, dependencies) {
        "use strict";
    
        var search, querystring;
        Object.defineProperty(props, 'search', {
            'get': function () {
                return search;
            },
            'set': function (value) {
                search = value;
                querystring = new QueryString(value);
            }
        });
    
        var state;
        Object.defineProperty(props, 'state', {
            'get': function () {
                return state;
            },
            'set': function (value) {
                state = value;
            }
        });
    
        Object.defineProperty(this, '$container', {
            'get': function () {
                return $container;
            }
        });
        Object.defineProperty(this, 'vdir', {
            'get': function () {
                return vdir;
            }
        });
        Object.defineProperty(this, 'dependencies', {
            'get': function () {
                return dependencies.modules;
            }
        });
        Object.defineProperty(this, 'querystring', {
            'get': function () {
                return querystring;
            }
        });
        Object.defineProperty(this, 'state', {
            'get': function () {
                return state;
            }
        });
    
    }
1170861
function GraphProgress(graph, graphDescription) {
        assert.object(graph, 'graph');
        assert.string(graphDescription, 'graphDescription');

        this.graph = graph;
        this.data = {
            graphId: graph.instanceId,
            nodeId: graph.node,
            graphName: graph.name || 'Not available',
            status: graph._status,
            progress: {
                description: graphDescription || 'Not available',
            }
        };
        this._calculateGraphProgress();
    }
998558
function resolvePage () {
      try {
        if (body.waitForJS === true && !pageJSisDone) {
          setTimeout(function () {
            resolvePage()
          }, 100)

          return
        }

        var resultData = page.evaluate(function (rawFnSource, customArgs) {
          var fnSource = rawFnSource.trim()

          fnSource = fnSource.slice(-1) === ';' ? fnSource.slice(0, -1) : fnSource

          var fn = '(function result() { '
          fn += 'return (' + fnSource + ') '
          fn += '})()'

          try {
            // eslint-disable-next-line
            fn = window.eval(fn)
          } catch (e) {
            // eslint-disable-next-line no-template-curly-in-string
            return {
              error: 'script code passed as `scriptFn` option has syntax error: ' + e.message
            }
          }

          if (typeof fn !== 'function') {
            return {
              error: 'script code passed as `scriptFn` option is not a function'
            }
          }

          return {
            result: fn.apply(null, customArgs)
          }
        }, body.scriptFn, body.args)

        // resultData can still be null if evaluated script returned
        // non-serializable value
        if (resultData && resultData.error) {
          throw new Error(resultData.error)
        }

        fs.write(body.outputFilePath, JSON.stringify({
          result: resultData != null ? resultData.result : undefined
        }), 'w')

        respond(page, {
          empty: resultData == null,
          logs: messages
        })
      } catch (e) {
        onMainError(e)
      }
    }
1101772
function parseBook(book) {
    return timing.measure(
        'parse.book',
        Promise(book)
        .then(parseIgnore)
        .then(parseConfig)
        .then(parseLanguages)
        .then(function(resultBook) {
            if (resultBook.isMultilingual()) {
                return parseMultilingualBook(resultBook);
            } else {
                return parseBookContent(resultBook);
            }
        })
    );
}
646940
function pageToJqtree(page) {
          var info = {
            label: page.title,
            slug: page.slug,
            // Available both ways for compatibility with jqtree and
            // mongodb expectations
            _id: page._id,
            id: page._id,
            // For icons
            type: page.type,
            // Also nice for icons and browser-side decisions about what's draggable where
            trash: page.trash,
            publish: (page.path === 'home/trash') || apos.permissions.can(req, 'publish-page', page),
            edit: apos.permissions.can(req, 'edit-page', page)
          };
          if (page.children && page.children.length) {
            info.children = [];
            // Sort trash after non-trash
            _.each(page.children, function(child) {
              if (!child.trash) {
                info.children.push(pageToJqtree(child));
              }
            });
            _.each(page.children, function(child) {
              if (child.trash) {
                info.children.push(pageToJqtree(child));
              }
            });
          }
          return info;
        }
1334071
function(page) {
      var t = this,
          newPages = t.pages.slice(0);
      newPages.push(page);
      t.tour.set('pages', newPages);
      t.tour.isDirty = true;
      t.setDirty(true);
      t.loadForm();
    }
1134206
function( page ) {

            if ( this.nextButton ) {
                if(!this.tileSources || this.tileSources.length - 1 === page) {
                    //Disable next button
                    if ( !this.navPrevNextWrap ) {
                        this.nextButton.disable();
                    }
                } else {
                    this.nextButton.enable();
                }
            }
            if ( this.previousButton ) {
                if ( page > 0 ) {
                    //Enable previous button
                    this.previousButton.enable();
                } else {
                    if ( !this.navPrevNextWrap ) {
                        this.previousButton.disable();
                    }
                }
            }
      }
1329097
function encodeOutputWithPage(output, page) {
    var file = page.getFile();
    var book = output.getBook();

    var result = encodeOutput(output);
    result.page = encodePage(page, book.getSummary());
    result.file = encodeFile(file);

    return result;
}
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
    });
  }
450955
function(page) {
			var regixAll = /([^\S]```.*)(:(.+))[\s\S]+?```/g;
			var regix = /([^\S]```.*)(:(.+))[\s\S]+?```/;
			var matchAll = page.content.match(regixAll);

			for(var i = 0; matchAll && i < matchAll.length; i++){
				var match = matchAll[i].match(regix);
				var input = match.input.replace(match[2], "");
				var replace = input.replace(match[1], "\n\n!FILENAME " + match[3] + match[1]);
				page.content = page.content.replace(match.input, replace);
			}

			return page;
		}
47860
function onPage(output, page) {
    var file = page.getFile();
    var readme = output.getBook().getReadme().getFile();

    return Modifiers.modifyHTML(page, getModifiers(output, page))
    .then(function(resultPage) {
        // Generate the JSON
        var json = JSONUtils.encodeBookWithPage(output.getBook(), resultPage);

        // Delete some private properties
        delete json.config;

        // Specify JSON output version
        json.version = JSON_VERSION;

        // File path in the output folder
        var filePath = file.getPath() == readme.getPath()? 'README.json' : file.getPath();
        filePath = PathUtils.setExtension(filePath, '.json');

        // Write it to the disk
        return writeFile(
            output,
            filePath,
            JSON.stringify(json, null, 4)
        );
    });
}
1091135
function(args, connectionInfo, processPagedResults) {
  // args.consignmentIds.value MUST already be set
  args.page = {value: 1};
  args.pageSize = {value: 200};
  args.consignmentIdIndex = {value: 0};
  args.consignmentId = {value: args.consignmentIds.value[args.consignmentIdIndex.value]};
  args.getArray = function(){
    return this.consignmentIds.value;
  };
  args.getArrayIndex = function(){
    return this.consignmentIdIndex.value;
  };

  // iterate serially through a promise chain for all args.consignmentIds.value
  return utils.processPromisesSerially(
    args.consignmentIds.value,
    args.consignmentIdIndex.value,
    args,
    function mergeStrategy(newData, previousData){
      log.debug('inside mergeStrategy()');
      //log.silly('newData ', newData);
      //log.silly('previousData ', previousData);
      if (previousData && previousData.length>0) {
        if (newData.length>0) {
          log.debug('previousData.length: ', previousData.length);
          newData = newData.concat(previousData);
          log.debug('combinedData.length: ', newData.length);
        }
        else {
          newData = previousData;
        }
      }
      //log.silly('finalData ', newData);
      log.debug('finalData.length ', newData.length);
      return Promise.resolve(newData); // why do we need a promise?
    },
    function setupNext(updateArgs){
      updateArgs.consignmentIdIndex.value = updateArgs.consignmentIdIndex.value + 1;
      if (updateArgs.consignmentIdIndex.value < updateArgs.consignmentIds.value.length) {
        updateArgs.consignmentId.value = updateArgs.consignmentIds.value[updateArgs.consignmentIdIndex.value];
        log.debug('next is consignmentId: ' + updateArgs.consignmentId.value);
      }
      else {
        updateArgs.consignmentId.value = null;
        log.debug('finished iterating through all the consignmentIds');
      }
      return updateArgs;
    },
    function executeNext(updatedArgs){
      log.debug('executing for consignmentId: ' + updatedArgs.consignmentId.value);
      //log.silly('updatedArgs: ', updatedArgs);
      return fetchAllProductsByConsignment(updatedArgs, connectionInfo, processPagedResults);
    }
  );
}
1368656
function(page) {
			var regixAll = /(<p>!FILENAME\s+([\S].+)<\/p>)\s*<pre>[\s\S]*?(<\/pre>)/g;
			var regix = /(<p>!FILENAME\s+([\S].+)<\/p>)\s*<pre>[\s\S]*?(<\/pre>)/;
			var replacer = function(filename){
				return '<div><p class="code-filename">' + filename + '</p></div>';
			}

			var tagAll = page.content.match(regixAll);

			for(var j = 0; tagAll && j < tagAll.length; j++){
				var tag = page.content.match(regix);
				var replace = tag[0].replace(tag[1], replacer(tag[2]));
				page.content = page.content.replace(tag[0], replace);
			}

			return page;
		}