koztv-blog-tools 1.2.7 → 1.2.9

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/dist/index.js CHANGED
@@ -773,8 +773,9 @@ async function processPost(post, options, exportDir) {
773
773
  await new Promise((r) => setTimeout(r, 2e3));
774
774
  }
775
775
  } else {
776
+ const defaultLang = translate?.sourceLang || "ru";
776
777
  languages.push({
777
- lang: "original",
778
+ lang: defaultLang,
778
779
  title: originalTitle,
779
780
  body: originalBody,
780
781
  isOriginal: true
@@ -782,12 +783,7 @@ async function processPost(post, options, exportDir) {
782
783
  }
783
784
  for (const { lang, title, body, isOriginal } of languages) {
784
785
  const slug = generateSlug2(title, lang);
785
- let postDir;
786
- if (languages.length > 1 || translate && translate.targetLangs.length > 0) {
787
- postDir = path2.join(outputDir, lang, slug);
788
- } else {
789
- postDir = path2.join(outputDir, slug);
790
- }
786
+ const postDir = path2.join(outputDir, lang, slug);
791
787
  if (fs2.existsSync(postDir)) {
792
788
  onProgress?.(` Skipping existing: ${lang}/${slug}`);
793
789
  continue;
@@ -822,12 +818,14 @@ async function processPost(post, options, exportDir) {
822
818
  }
823
819
  }
824
820
  }
821
+ const replyLine = post.replyToMsgId ? `reply_to_msg_id: ${post.replyToMsgId}
822
+ ` : "";
825
823
  const markdown = `---
826
824
  title: "${title.replace(/"/g, '\\"')}"
827
825
  date: ${date}
828
826
  lang: ${lang}
829
827
  original_link: "${post.link || ""}"
830
- ${isOriginal ? "" : `translated_from: "${translate?.sourceLang || "ru"}"
828
+ ${replyLine}${isOriginal ? "" : `translated_from: "${translate?.sourceLang || "ru"}"
831
829
  `}---
832
830
 
833
831
  ${finalBody}
package/dist/index.mjs CHANGED
@@ -716,8 +716,9 @@ async function processPost(post, options, exportDir) {
716
716
  await new Promise((r) => setTimeout(r, 2e3));
717
717
  }
718
718
  } else {
719
+ const defaultLang = translate?.sourceLang || "ru";
719
720
  languages.push({
720
- lang: "original",
721
+ lang: defaultLang,
721
722
  title: originalTitle,
722
723
  body: originalBody,
723
724
  isOriginal: true
@@ -725,12 +726,7 @@ async function processPost(post, options, exportDir) {
725
726
  }
726
727
  for (const { lang, title, body, isOriginal } of languages) {
727
728
  const slug = generateSlug2(title, lang);
728
- let postDir;
729
- if (languages.length > 1 || translate && translate.targetLangs.length > 0) {
730
- postDir = path2.join(outputDir, lang, slug);
731
- } else {
732
- postDir = path2.join(outputDir, slug);
733
- }
729
+ const postDir = path2.join(outputDir, lang, slug);
734
730
  if (fs2.existsSync(postDir)) {
735
731
  onProgress?.(` Skipping existing: ${lang}/${slug}`);
736
732
  continue;
@@ -765,12 +761,14 @@ async function processPost(post, options, exportDir) {
765
761
  }
766
762
  }
767
763
  }
764
+ const replyLine = post.replyToMsgId ? `reply_to_msg_id: ${post.replyToMsgId}
765
+ ` : "";
768
766
  const markdown = `---
769
767
  title: "${title.replace(/"/g, '\\"')}"
770
768
  date: ${date}
771
769
  lang: ${lang}
772
770
  original_link: "${post.link || ""}"
773
- ${isOriginal ? "" : `translated_from: "${translate?.sourceLang || "ru"}"
771
+ ${replyLine}${isOriginal ? "" : `translated_from: "${translate?.sourceLang || "ru"}"
774
772
  `}---
775
773
 
776
774
  ${finalBody}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koztv-blog-tools",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "Shared utilities for Telegram-based blog sites",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",