{"action":"created","issue":{"url":"https://api.github.com/repos/ardumont/org2jekyll/issues/36","repository_url":"https://api.github.com/repos/ardumont/org2jekyll","labels_url":"https://api.github.com/repos/ardumont/org2jekyll/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/ardumont/org2jekyll/issues/36/comments","events_url":"https://api.github.com/repos/ardumont/org2jekyll/issues/36/events","html_url":"https://github.com/ardumont/org2jekyll/issues/36","id":149068121,"number":36,"title":"is it possible to add freeform extra yaml headers? 2/2","user":{"login":"yefeiyu","id":4845104,"avatar_url":"https://avatars.githubusercontent.com/u/4845104?v=3","gravatar_id":"","url":"https://api.github.com/users/yefeiyu","html_url":"https://github.com/yefeiyu","followers_url":"https://api.github.com/users/yefeiyu/followers","following_url":"https://api.github.com/users/yefeiyu/following{/other_user}","gists_url":"https://api.github.com/users/yefeiyu/gists{/gist_id}","starred_url":"https://api.github.com/users/yefeiyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yefeiyu/subscriptions","organizations_url":"https://api.github.com/users/yefeiyu/orgs","repos_url":"https://api.github.com/users/yefeiyu/repos","events_url":"https://api.github.com/users/yefeiyu/events{/privacy}","received_events_url":"https://api.github.com/users/yefeiyu/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ardumont/org2jekyll/labels/duplicate","name":"duplicate","color":"cccccc"},{"url":"https://api.github.com/repos/ardumont/org2jekyll/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2016-04-18T07:37:00Z","updated_at":"2016-04-20T07:42:06Z","closed_at":null,"body":"Thank you for your last replay!\r\nToday I study the \"monkey patch\", and I DO step by step like this:\r\n1rt step:\r\nI paste the patch to my \"~/.emacs.d/init.d/blog-pack.el\":\r\n``` lisp\r\n(custom-set-variables '(org2jekyll-extra-yaml-headers \"scheme-text: \\\"#0029ff\\\"\r\nscheme-link: \\\"#ff00b4\\\"\r\nscheme-hover: \\\"#ff00b4\\\"\r\nscheme-code: \\\"#ad00ff\\\"\r\nscheme-bg: \\\"#00ebff\\\"\r\nscheme-hero-text: \\\"#00ebff\\\"\r\nscheme-hero-link: \\\"#00ebff\\\"\r\nscheme-hero-bg: \\\"#0029ff\\\"\r\nplugin: lightense\"))\r\n```\r\n2nd step:\r\nPress \"Alt+Shift+;\", then mini buffer appear the word \"Eval:\", then I paste that two patches what you give me,\r\n``` lisp\r\n(defcustom org2jekyll-extra-yaml-headers nil\r\n  \"An entry of static yaml header (already formatted).\r\nE.g. from https://github.com/ardumont/org2jekyll/issues/34#issue-148684715:\r\nscheme-text: \\\"#0029ff\\\"\r\nscheme-link: \\\"#ff00b4\\\"\r\nscheme-hover: \\\"#ff00b4\\\"\r\nscheme-code: \\\"#ad00ff\\\"\r\nscheme-bg: \\\"#00ebff\\\"\r\nscheme-hero-text: \\\"#00ebff\\\"\r\nscheme-hero-link: \\\"#00ebff\\\"\r\nscheme-hero-bg: \\\"#0029ff\\\"\r\nplugin: lightense\"\r\n  :group 'org2jekyll)\r\n\r\n(defun org2jekyll--to-yaml-header (org-metadata)\r\n  \"Given a list of ORG-METADATA, compute the yaml header string.\"\r\n  (-let (((begin end) (if (org2jekyll--old-org-version-p)\r\n                          '(\"#+BEGIN_HTML\" \"#+END_HTML\\n\")\r\n                        '(\"#+BEGIN_EXPORT HTML\" \"#+END_EXPORT\\n\"))))\r\n    (--> org-metadata\r\n         org2jekyll--org-to-yaml-metadata\r\n         (--map (format \"%s: %s\" (car it) (cdr it)) it)\r\n         (cons \"---\" it)\r\n         (cons begin it)\r\n         (-snoc it org2jekyll-extra-yaml-headers)\r\n         (-snoc it \"---\")\r\n         (-snoc it end)\r\n         (s-join \"\\n\" it)\r\n         (s-replace \"\\n\\n\" \"\\n\" it))))\r\n```\r\n3nd step:\r\nI built an \"org\" file:\r\n``` ruby\r\n#+STARTUP: showall\r\n#+STARTUP: hidestars\r\n#+OPTIONS: H:2 num:nil tags:nil toc:nil timestamps:t\r\n#+LAYOUT: post\r\n#+AUTHOR: yefeiyu\r\n#+DATE: 2016-04-18 一 15:14\r\n#+TITLE: try\r\n#+DESCRIPTION: \r\n#+TAGS: \r\n#+CATEGORIES: \r\n\r\n* try\r\n```\r\n4rd step:\r\nM-x org2jekyll-publish\r\n\r\n5th step:\r\nThen It created a file of \"2016-04-16-try.html\",\r\n``` ruby\r\n---\r\nlayout: post\r\ntitle: try\r\ndate: 2016-04-18\r\ncategories: \r\n-\r\ntags: \r\n-\r\nauthor: yefeiyu\r\nexcerpt: \r\n---\r\n\r\n<div id=\"outline-container-sec-1\" class=\"outline-2\">\r\n<h2 id=\"sec-1\">one</h2>\r\n<div class=\"outline-text-2\" id=\"text-1\">\r\n<p>\r\ntry<br >\r\n</p>\r\n</div>\r\n</div>\r\n```\r\n\r\n6th step:\r\nI didn't find the HEAD of \"scheme-text ......\", I had to paste it.\r\n\r\nWhat's wrong with me ?\r\n\r\n******\r\n\r\nAlthough your patches are close to my target, but my goal is :\r\n1, Input the \"scheme-text ....\" in \".org\" file;\r\n2, Create the \".html\" file with backgroud color, text color and link color.\r\n\r\n(btw: My last issue lack of \"#ff3dss\", only because I want fill the vacant position at every post, so the every article has it own color.\r\n      My english is poor, I am sorry.)\r\n\r\nThank you! \r\n"},"comment":{"url":"https://api.github.com/repos/ardumont/org2jekyll/issues/comments/212302646","html_url":"https://github.com/ardumont/org2jekyll/issues/36#issuecomment-212302646","issue_url":"https://api.github.com/repos/ardumont/org2jekyll/issues/36","id":212302646,"user":{"login":"ardumont","id":718812,"avatar_url":"https://avatars.githubusercontent.com/u/718812?v=3","gravatar_id":"","url":"https://api.github.com/users/ardumont","html_url":"https://github.com/ardumont","followers_url":"https://api.github.com/users/ardumont/followers","following_url":"https://api.github.com/users/ardumont/following{/other_user}","gists_url":"https://api.github.com/users/ardumont/gists{/gist_id}","starred_url":"https://api.github.com/users/ardumont/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ardumont/subscriptions","organizations_url":"https://api.github.com/users/ardumont/orgs","repos_url":"https://api.github.com/users/ardumont/repos","events_url":"https://api.github.com/users/ardumont/events{/privacy}","received_events_url":"https://api.github.com/users/ardumont/received_events","type":"User","site_admin":false},"created_at":"2016-04-20T07:42:06Z","updated_at":"2016-04-20T07:42:06Z","body":"> Now, I can do this by yasnippet. I created a new snippet in the ~/.emacs.d/snippets/org-mode fold:\r\n\r\nInteresting. I need to take a look at yasnippet. Thanks.\r\n\r\n> So I can add the #+EXTRA-YAML-HEADERS...etc easy. the only regret thing is it need my input oc TAB every time, in each article. (After this step, I can definned colors)\r\n\r\nAlso, since this changes every time, you can try and write your own function.\r\n\r\nSomething like this can be a bootstrap:\r\n```lisp\r\n(defun yefeiyu-read-extra-yaml-headers ()\r\n  \"Read some pre-formatted extra yaml headers from user.\r\nWrite the extra-headers at point.\"\r\n  (interactive)\r\n  (let ((theme (read-input \"theme: \"))\r\n        (plugin (read-input \"plugin: \"))\r\n        (scheme-text (read-input \"scheme-text: \"))\r\n        (scheme-link (read-input \"scheme-link: \"))\r\n        (scheme-hover (read-input \"scheme-hover: \"))\r\n        (scheme-code (read-input \"scheme-code: \"))\r\n        (scheme-bg (read-input \"scheme-bg: \"))\r\n        (scheme-hero-text (read-input \"scheme-hero-text: \"))\r\n        (scheme-hero-link (read-input \"scheme-hero-link: \"))\r\n        (scheme-hero-bg (read-input \"scheme-hero-bg: \")))\r\n    (insert (format \"#+EXTRA-YAML-HEADERS: theme: %s\\\\nplugin: %s\\\\nscheme-text: \\\"%s\\\"\\\\nscheme-link: \\\"%s\\\"\\\\nscheme-hover: \\\"%s\\\"\\\\nscheme-code: \\\"%s\\\"\\\\nscheme-bg: \\\"%s\\\"\\\\nscheme-hero-text: \\\"%s\\\"\\\\nscheme-hero-link: \\\"%s\\\"\\\\nscheme-hero-bg: \\\"%s\\\"\\\\n\"\r\n                    theme plugin scheme-text scheme-link scheme-hover scheme-code scheme-bg scheme-hero-text scheme-hero-link scheme-hero-bg))))\r\n```\r\n\r\nAn improvment on the previous function would be to have some completion on possible themes (to avoid repeating too much). As a hint, here are some emacs functions to do such thing `ido-completing-read` (native), `helm-comp-read` (needs helm).\r\n\r\n> Thank you again. It's very comfortable to use org2jekyll\r\n\r\nThanks.\r\n\r\nCheers,"}}