@promptbook/legacy-documents 0.74.0-6 → 0.74.0-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.es.js CHANGED
@@ -23,7 +23,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
23
23
  *
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- var PROMPTBOOK_ENGINE_VERSION = '0.74.0-5';
26
+ var PROMPTBOOK_ENGINE_VERSION = '0.74.0-7';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  */
@@ -570,12 +570,9 @@ function $execCommandNormalizeOptions(options) {
570
570
  })
571
571
  .filter(function (arg) { return arg !== ''; });
572
572
  if (_.length > 1) {
573
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
574
573
  _a = __read(_), command = _a[0], args = _a.slice(1);
575
574
  }
576
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
577
575
  if (options.args) {
578
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
579
576
  args = __spreadArray(__spreadArray([], __read(args), false), __read(options.args), false);
580
577
  }
581
578
  var humanReadableCommand = !['npx', 'npm'].includes(command) ? command : args[0];
@@ -4500,10 +4497,12 @@ function countLines(text) {
4500
4497
  * @public exported from `@promptbook/utils`
4501
4498
  */
4502
4499
  function countPages(text) {
4503
- var sentencesPerPage = 5; // Assuming each page has 5 sentences
4504
- var sentences = text.split(/[.!?]+/).filter(function (sentence) { return sentence.trim() !== ''; });
4505
- var pageCount = Math.ceil(sentences.length / sentencesPerPage);
4506
- return pageCount;
4500
+ if (text === '') {
4501
+ return 0;
4502
+ }
4503
+ var pagesByLinesCount = Math.ceil(countLines(text) / 44);
4504
+ var pagesByCharactersCount = Math.ceil(countCharacters(text) / 2772);
4505
+ return Math.max(pagesByLinesCount, pagesByCharactersCount);
4507
4506
  }
4508
4507
 
4509
4508
  /**