テスト (Shalev-Shwartz and Ben-David 2009)
関数
org-roam のノードを wordpress に投稿するための関数を作成した。
単純に org2blog-buffer-post-publish
で作成されたプロパティを移動するだけ。
(defun ks-post-to-wordpress () (interactive) (let ((snow (format-time-string (org-time-stamp-format t t) (org-current-time))) (rtitle (org-make-options-regexp (list "title" "TITLE"))) (rdate (org-make-options-regexp (list "date" "DATE"))) (rblog (org-make-options-regexp (list "blog" "BLOG"))) (rpostid (org-make-options-regexp (list "postid" "POSTID"))) (rorb2blog (org-make-options-regexp (list "org2blog" "ORG2BLOG"))) line1 line2) (save-excursion (goto-char (point-min)) (if (re-search-forward rorb2blog nil t 1) (progn (re-search-forward rdate nil t 1) (replace-match (concat "#+\\1: " snow)) (org2blog-buffer-post-publish)) (if (re-search-forward rtitle nil t 1) (progn (insert "\n\n") ;; TITLEプロパティの下にORG2BLOGプロパティを (insert "#+ORG2BLOG:\n") ;; TITLEプロパティの下にDATEプロパティを (insert (concat "#+DATE: " snow)) ;; 投稿 (org2blog-buffer-post-publish) ;; ここからファイル上部に記載される BLOG, POSTID を移動する. (goto-char (point-min)) ;; BLOG を退避、削除する. (re-search-forward rblog nil t 1) (setq line1 (match-string-no-properties 0)) (delete-region (match-beginning 0) (match-end 0)) (delete-char 1) ;; POSTID を退避、削除する. (re-search-forward rpostid nil t 1) (setq line2 (match-string-no-properties 0)) (delete-region (match-beginning 0) (match-end 0)) (delete-char 1) ;; BLOG, POSTID を追加する. (re-search-forward rdate nil t 1) (insert "\n") (insert line1) (insert "\n") (insert line2)))))))
参考文献
Shalev-Shwartz, Shai, and Shai Ben-David. 2009. Understanding Machine Learning. Cambridge University Press. https://doi.org/10.1017/cbo9781107298019.