From 5a926e65f92fae64828979bfc1a83df66af56d72 Mon Sep 17 00:00:00 2001 From: Andros Fenollosa Date: Tue, 13 Jun 2023 10:07:27 +0200 Subject: [PATCH] Init commit --- org-share-to-web.el | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 org-share-to-web.el diff --git a/org-share-to-web.el b/org-share-to-web.el new file mode 100644 index 0000000..fae7f73 --- /dev/null +++ b/org-share-to-web.el @@ -0,0 +1,30 @@ +;;; org-share-to-web.el --- Share org to website. -*- lexical-binding: t; +;; +;; Copyright © 2023 Andros Fenollosa +;; Authors: Andros Fenollosa +;; URL: https://github.com/tanrax/org-share-to-web.el +;; Version: 1.0.0 +;; SPDX-License-Identifier: GPL-3.0-or-later + +;;; Commentary: +;; + +;;; Code: + +(defvar org-share-to-web-domain "") +(defvar org-share-to-web-directory "") + +(defun org-share-to-web-buffer () + "Share the current org file to the server, export to html and copy URL to clipboard." + (interactive) + (let* ((filename-current-buffer (file-name-nondirectory (buffer-file-name))) + (filename-sans-extension (file-name-sans-extension filename-current-buffer)) + (filename-html (concat filename-sans-extension ".html")) + (export-html (org-export-string-as (buffer-string) 'html))) + (write-region export-html nil (concat org-share-to-web-directory filename-html)) + (tramp-cleanup-all-connections) + (kill-new (concat org-share-to-web-domain filename-html)))) + +(provide 'org-share-to-web) + +;;; org-share-to-web.el ends here