当前位置: 首页 > news >正文

自建hexo博客并将原有的文章发布其上

1、保存粘贴到memo9中的博客文章,并将txt转换成word文档

varPowerShellPath, CommandLine: string; //  , ScriptPath
begin//save to txtMemo9.Lines.SaveToFile('test.txt');memo10.Lines.SaveToFile('txt2word.ps1');//save as docxPowerShellPath := 'powershell.exe ';CommandLine := 'C:\delphisource\mytools\mynewtools\Win64\Debug\txt2word.ps1 ';DosCommand3.CommandLine := PowerShellPath + ' -ExecutionPolicy Bypass -File ' + CommandLine;DosCommand3.Execute;end;

txt2word.ps1代码 

$word = New-Object -ComObject word.application
$doc = $word.documents.open("C:\delphisource\mytools\mynewtools\Win64\Debug\test.txt")
$doc.saveas("C:\delphisource\mytools\mynewtools\Win64\Debug\test.docx",16)
$doc.close()
$word.quit()

2、使用pandoc将word文档转换成md文档 

begin//pandoc word2mdDosCommand3.CommandLine := 'pandoc -s C:\delphisource\mytools\mynewtools\Win64\Debug\test.docx -t markdown -o C:\delphisource\mytools\mynewtools\Win64\Debug\test.md';// 启动进程DosCommand3.Execute;exit;end;

3、使用hexo新建博客文章

begin// newblogs bash command fileMemo11.Lines.Add('hexo new "' +UTF8Encode(edit9.Text) + '"');Memo11.Lines.SaveToFile('C:\pythoncode\new\test.sh');DosCommand3.CommandLine := '"C:\Program Files\Git\bin\bash.exe"  C:\pythoncode\new\test.sh';// 启动进程DosCommand3.Execute;end;

test.sh脚本

#!/bin/bash# �л���ָ��Ŀ¼
cd C:/Users/86182/myblog/source/_posts# ����Hexo����
hexo new "Python中的PDF文本提取:使用fitz和wxPython库(带进度条�?

4、将第二步产生的md文档,复制到指定文件夹下,并替换新建的博客md文档

beginMemo12.Lines.Add('mv "c:/Users/86182/myblog/source/_posts/test.md" "c:/Users/86182/myblog/source/_posts/'+UTF8Encode(Edit9.Text)+'.md"');Memo12.Lines.SaveToFile('C:\pythoncode\new\test4.sh');DosCommand3.CommandLine := '"C:\Program Files\Git\bin\bash.exe"  C:\pythoncode\new\test4.sh';// 启动进程DosCommand3.Execute;
end;

 test4.sh代码

#!/bin/bash# �����ļ�
cp "c:/delphisource/mytools/mynewtools/Win64/Debug/test.md" "c:/Users/86182/myblog/source/_posts"# ������Ŀ���ļ�
mv "c:/Users/86182/myblog/source/_posts/test.md" "c:/Users/86182/myblog/source/_posts/探索硬件王国:计算机硬件信息一览(使用powershell获得计算机硬件信息).md"

5、hexo将刚刚新增并编辑好的md文档生成。

beginDosCommand3.CommandLine := '"C:\Program Files\Git\bin\bash.exe"  C:\pythoncode\new\test1.sh';// 启动进程DosCommand3.Execute;
end;

test1.sh代码

#!/bin/bashcd C:/Users/86182/myblog/source/_postshexo generate 

6、hexo 启动服务器(注意先关闭)

beginDosCommand3.CommandLine := '"C:\Program Files\Git\bin\bash.exe"  C:\pythoncode\new\test3.sh';// 启动进程DosCommand3.Execute;
end;

test3.sh代码

#!/bin/bashcd C:/Users/86182/myblog/source/_postshexo server

结果如下

 

http://www.lryc.cn/news/126144.html

相关文章:

  • 【双指针_和为 s 的两个数_C++】
  • HTML5的介绍和基本框架
  • 代码随想录算法训练营第58天|动态规划part15|392.判断子序列、115.不同的子序列
  • 日常BUG——普通页面跳转tabbar页面报错
  • SpringBoot复习:(48)RedisAutoConfiguration自动配置类
  • 软硬件免费,服务收费:网络安全商业模式正在被颠覆
  • 变形金刚:从零开始【01/2】
  • Opencv特征检测之ORB算法原理及应用详解
  • 【es6】函数柯里化(Currying)
  • 线上多域名实战
  • 【C语言】上手实验
  • 设计HTML5表单
  • 使用Kaptcha生成验证码
  • 【vue】vue中的插槽以及使用方法
  • javaScript:分支语句的理解与使用(附带案例)
  • MySQL高阶知识点(一)事务的并发问题和隔离级别
  • 医疗PACS源码,支持三维多平面重建、三维容积重建、三维表面重建、三维虚拟内窥镜
  • Ubuntu安装Redis
  • “深入解析JVM内部机制:探索Java虚拟机的奥秘“
  • vim打开文件中文是乱码
  • 【正点原子STM32连载】 第七章 Geehy标准库版本MDK工程创建 摘自【正点原子】APM32F407最小系统板使用指南
  • SQL中count()的不同用法
  • go_细节注意
  • 屏蔽恶意域名的DNS查询
  • SQL-每日一题【1251. 平均售价】
  • Win11中使用pip或者Cython报错 —— error: Microsoft Visual C++ 14.0 is required.
  • Spring学习笔记之Bean的“出生入死”
  • hbase 报错 Master passed us a different hostname to use; was=
  • Aspera替代方案:探索这些安全且可靠的文件传输工具
  • 你真的了解数据结构与算法吗?