From e6c8fff3c5f10ddb62b3994c7502af37dbd6289a Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Fri, 25 Nov 2016 16:55:15 +0100 Subject: [PATCH] updated keyfreq and ox-jira Signed-off-by: Andreas Gerler --- bba.org | 3 - elpa/keyfreq-20150924.2005/keyfreq-pkg.el | 1 - .../keyfreq-autoloads.el | 10 +- elpa/keyfreq-20160516.716/keyfreq-pkg.el | 2 + .../keyfreq.el | 16 ++- elpa/ox-jira-20160426.553/ox-jira-pkg.el | 1 - .../ox-jira-autoloads.el | 4 +- elpa/ox-jira-20161026.429/ox-jira-pkg.el | 2 + .../ox-jira.el | 116 +++++++++++++++++- 9 files changed, 136 insertions(+), 19 deletions(-) delete mode 100644 elpa/keyfreq-20150924.2005/keyfreq-pkg.el rename elpa/{keyfreq-20150924.2005 => keyfreq-20160516.716}/keyfreq-autoloads.el (81%) create mode 100644 elpa/keyfreq-20160516.716/keyfreq-pkg.el rename elpa/{keyfreq-20150924.2005 => keyfreq-20160516.716}/keyfreq.el (98%) delete mode 100644 elpa/ox-jira-20160426.553/ox-jira-pkg.el rename elpa/{ox-jira-20160426.553 => ox-jira-20161026.429}/ox-jira-autoloads.el (59%) create mode 100644 elpa/ox-jira-20161026.429/ox-jira-pkg.el rename elpa/{ox-jira-20160426.553 => ox-jira-20161026.429}/ox-jira.el (77%) diff --git a/bba.org b/bba.org index e206ba11..ba8a2369 100644 --- a/bba.org +++ b/bba.org @@ -897,7 +897,6 @@ Very useful for repetitive literate devops jobs. #+END_SRC - ** copy previous src block [2016-08-25 Thu 23:36] @@ -1007,8 +1006,6 @@ selections I call this script: #+END_SRC - - ** insert arrow [2016-10-07 Fri 12:25] diff --git a/elpa/keyfreq-20150924.2005/keyfreq-pkg.el b/elpa/keyfreq-20150924.2005/keyfreq-pkg.el deleted file mode 100644 index 9fd306f0..00000000 --- a/elpa/keyfreq-20150924.2005/keyfreq-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "keyfreq" "20150924.2005" "track command frequencies" 'nil) diff --git a/elpa/keyfreq-20150924.2005/keyfreq-autoloads.el b/elpa/keyfreq-20160516.716/keyfreq-autoloads.el similarity index 81% rename from elpa/keyfreq-20150924.2005/keyfreq-autoloads.el rename to elpa/keyfreq-20160516.716/keyfreq-autoloads.el index 71f160a8..4be71eaa 100644 --- a/elpa/keyfreq-20150924.2005/keyfreq-autoloads.el +++ b/elpa/keyfreq-20160516.716/keyfreq-autoloads.el @@ -1,14 +1,15 @@ ;;; keyfreq-autoloads.el --- automatically extracted autoloads ;; ;;; Code: -(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) +(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) -;;;### (autoloads nil "keyfreq" "keyfreq.el" (22215 7928 0 0)) +;;;### (autoloads nil "keyfreq" "keyfreq.el" (22581 35909 0 0)) ;;; Generated autoloads from keyfreq.el (defvar keyfreq-mode nil "\ Non-nil if Keyfreq mode is enabled. -See the command `keyfreq-mode' for a description of this minor mode. +See the `keyfreq-mode' command +for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `keyfreq-mode'.") @@ -24,7 +25,8 @@ various keyfreq-* functions. (defvar keyfreq-autosave-mode nil "\ Non-nil if Keyfreq-Autosave mode is enabled. -See the command `keyfreq-autosave-mode' for a description of this minor mode. +See the `keyfreq-autosave-mode' command +for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `keyfreq-autosave-mode'.") diff --git a/elpa/keyfreq-20160516.716/keyfreq-pkg.el b/elpa/keyfreq-20160516.716/keyfreq-pkg.el new file mode 100644 index 00000000..e1292d1b --- /dev/null +++ b/elpa/keyfreq-20160516.716/keyfreq-pkg.el @@ -0,0 +1,2 @@ +;;; -*- no-byte-compile: t -*- +(define-package "keyfreq" "20160516.716" "track command frequencies" '((cl-lib "0.5"))) diff --git a/elpa/keyfreq-20150924.2005/keyfreq.el b/elpa/keyfreq-20160516.716/keyfreq.el similarity index 98% rename from elpa/keyfreq-20150924.2005/keyfreq.el rename to elpa/keyfreq-20160516.716/keyfreq.el index 8078f535..d107c264 100644 --- a/elpa/keyfreq-20150924.2005/keyfreq.el +++ b/elpa/keyfreq-20160516.716/keyfreq.el @@ -1,5 +1,4 @@ ;;; keyfreq.el --- track command frequencies -;; Package-Version: 20150924.2005 ;; -*- coding: utf-8 -*- ;; ;; Copyright 2009-2010, 2015 by David Capello @@ -11,6 +10,10 @@ ;; Maintainer: David Capello, Xah lee ;; Created: 2006 ;; +;; Package-Requires: ((cl-lib "0.5")) +;; Package-Version: 20160516.716 +;; +;; ;; Keyfreq is free software; you can redistribute it and/or modify it ;; under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3 of the License, or @@ -74,9 +77,12 @@ ;; ;;; Code: -(if (featurep 'cl-lib) - (require 'cl-lib) - (require 'cl)) +(if (not (featurep 'cl-lib)) + (progn + (require 'cl) + ;; fix conflict name + (defalias 'cl-reduce 'reduce)) + (require 'cl-lib)) ;; (require 'json)? (defgroup keyfreq nil @@ -220,7 +226,7 @@ for each entry with three arguments: number of times command was called, percentage usage and the command." (let* ((sum (car list)) (max-len - (reduce (lambda (a b) (max a (length (symbol-name (car b))))) + (cl-reduce (lambda (a b) (max a (length (symbol-name (car b))))) (cdr list) :initial-value 0))) (mapconcat diff --git a/elpa/ox-jira-20160426.553/ox-jira-pkg.el b/elpa/ox-jira-20160426.553/ox-jira-pkg.el deleted file mode 100644 index 7a04e306..00000000 --- a/elpa/ox-jira-20160426.553/ox-jira-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "ox-jira" "20160426.553" "JIRA Backend for Org Export Engine" '((org "8.0")) :url "https://github.com/stig/ox-jira.el" :keywords '("outlines" "hypermedia" "wp")) diff --git a/elpa/ox-jira-20160426.553/ox-jira-autoloads.el b/elpa/ox-jira-20161026.429/ox-jira-autoloads.el similarity index 59% rename from elpa/ox-jira-20160426.553/ox-jira-autoloads.el rename to elpa/ox-jira-20161026.429/ox-jira-autoloads.el index 75daa69c..400ce081 100644 --- a/elpa/ox-jira-20160426.553/ox-jira-autoloads.el +++ b/elpa/ox-jira-20161026.429/ox-jira-autoloads.el @@ -1,9 +1,9 @@ ;;; ox-jira-autoloads.el --- automatically extracted autoloads ;; ;;; Code: -(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) +(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) -;;;### (autoloads nil nil ("ox-jira.el") (22337 64108 292221 0)) +;;;### (autoloads nil nil ("ox-jira.el") (22584 24229 0 0)) ;;;*** diff --git a/elpa/ox-jira-20161026.429/ox-jira-pkg.el b/elpa/ox-jira-20161026.429/ox-jira-pkg.el new file mode 100644 index 00000000..e36dbc64 --- /dev/null +++ b/elpa/ox-jira-20161026.429/ox-jira-pkg.el @@ -0,0 +1,2 @@ +;;; -*- no-byte-compile: t -*- +(define-package "ox-jira" "20161026.429" "JIRA Backend for Org Export Engine" '((org "8.3")) :url "https://github.com/stig/ox-jira.el" :keywords '("outlines" "hypermedia" "wp")) diff --git a/elpa/ox-jira-20160426.553/ox-jira.el b/elpa/ox-jira-20161026.429/ox-jira.el similarity index 77% rename from elpa/ox-jira-20160426.553/ox-jira.el rename to elpa/ox-jira-20161026.429/ox-jira.el index ccd1a0b5..84523809 100644 --- a/elpa/ox-jira-20160426.553/ox-jira.el +++ b/elpa/ox-jira-20161026.429/ox-jira.el @@ -4,10 +4,10 @@ ;; Author: Stig Brautaset ;; Version: 0.1-SNAPSHOT -;; Package-Version: 20160426.553 +;; Package-Version: 20161026.429 ;; Keywords: outlines, hypermedia, wp ;; Homepage: https://github.com/stig/ox-jira.el -;; Package-Requires: ((org "8.0")) +;; Package-Requires: ((org "8.3")) ;; This file is NOT part of GNU Emacs. @@ -36,6 +36,7 @@ ;;; Code: +;; This is Cargo-culted from `ox-latex.el'` (eval-when-compile (require 'cl)) (require 'ox) (require 'ox-publish) @@ -102,15 +103,31 @@ ;;; Internal Helpers +;; Because I'm adding support for things as I find I need it rather than all +;; in one go, let's put a big fat red marker in for things we have not +;; implemented yet, to avoid missing it. +;; (defun ox-jira--not-implemented (element-type) "Replace anything we don't handle yet wiht a big red marker." (format "{color:red}Element of type '%s' not implemented!{color}" element-type)) +;; Super^script and sub_script I often want at the end of words, with no +;; whitespace immediately before it. Unfortunately JIRA doesn't support +;; that,so we have to fake it. This function makes simple text transforms +;; "embeddable" by preceding them with an empty anchor. This is admittedly a +;; bit of a hack, but I haven't found anything better. +;; (defun ox-jira--text-transform-embeddable (transform-char contents) (concat "{anchor}" transform-char contents transform-char)) ;;; Filters +;; Org support a single blank line between items in a list, but if we export +;; like that to JIRA format it will be interpreted as multiple consecutive +;; lists, which is never what I want. We can attempt to fix this by removing +;; the "post-blank" after a items (and paragraphs inside items) using a +;; filter. +;; (defun ox-jira-fix-multi-paragraph-items (tree backend info) "Remove extra blank line between paragraphs in plain-list items. @@ -130,6 +147,10 @@ Assume BACKEND is `jira'." ;;; Transcode functions +;; These functions do the actual translation to JIRA format. For this section +;; I've used Atlassian's Text Formatting Notation Help page as a reference: +;; https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=all + (defun ox-jira-bold (bold contents info) "Transcode BOLD from Org to JIRA. CONTENTS is the text with bold markup. INFO is a plist holding @@ -158,6 +179,8 @@ information." (org-remove-indentation (org-element-property :value fixed-width)))) +;; Footnotes have two parts: the reference, and the definition. +;; (defun ox-jira--footnote-anchor (element) (let ((label (org-element-property :label element))) (replace-regexp-in-string ":" "" label))) @@ -183,6 +206,15 @@ information." (format "{anchor:%s}[^%s^|#back%s] %s" anchor ref anchor contents))) +;; Headlines are a little bit more complex. I'm not even attempting to support +;; TODO labels and meta-information, just the straight-up text. It would be +;; nice to support the six standard levels of headlines JIRA offers though. +;; +;; Since the headline level is _relative_ rather than absolute, if the +;; exporter sees a '** second level' heading before it's seen a '* first +;; level' then the '** second level' will think it's a top-level heading. +;; That's a bit weird, but there you go. +;; (defun ox-jira-headline (headline contents info) "Transcode a HEADLINE element from Org to JIRA. CONTENTS is the contents of the headline, as a string. INFO is @@ -205,6 +237,22 @@ CONTENTS is the text with italic markup. INFO is a plist holding contextual information." (format "_%s_" contents)) +;; A list item. The JIRA format for nested lists follows. (You can also mix +;; ordered and unordered lists.) +;; +;; * item +;; ** sub-item +;; ** sub-item 2 +;; * item 2 +;; +;; The item element itself does not know what type it is: that is an attribute +;; of its parent, a plain-list element. We need to walk the path of +;; alternating plain-list and item nodes until there are no more, and extract +;; their type. The type list is used to create a bullet string. +;; +;; JIRA doesn't really have support for definition lists, so we fake it with a +;; bullet list and some bold text for the term. +;; (defun ox-jira--list-type-path (item) (when (and item (eq 'item (org-element-type item))) (let* ((list (org-element-property :parent item)) @@ -237,8 +285,12 @@ contextual information." (concat checkbox " ")) (when tag (format "*%s*: " tag)) - contents))) + contents))) +;; JIRA supports many types of links. I don't expect we support them all, but +;; we must make a token effort. A lot of this code is cribbed from +;; `ox-latex.el'. +;; (defun ox-jira-link (link desc info) "Transcode a LINK object from Org to JIRA. @@ -274,18 +326,38 @@ CONTENTS is nil. INFO is a plist used as a communication channel." (format "{{%s}}" (org-element-property :value verbatim))) +;; One of the most annoying things about JIRA markup is the way it doesn't +;; reflow text properly, so any linebreaks becomes hard linebreaks in the +;; rendered output. Let's fix that! +;; +;; What we need to do is replace any *internal* newlines (i.e. any not at the +;; end of the string) with a space. Regexes to the rescue! I used the +;; following reference to help me with this function: +;; https://www.gnu.org/software/emacs/manual/html_node/elisp/Regexp-Backslash.html#Regexp-Backslash + + (defun ox-jira-paragraph (paragraph contents info) "Transcode a PARAGRAPH element from Org to JIRA. CONTENTS is the contents of the paragraph, as a string. INFO is the plist used as a communication channel." (replace-regexp-in-string "\n\\([^\']\\)" " \\1" contents)) +;; I make a lot of lists. Let's make sure we handle them! This is very simple, +;; as in the JIRA format all the logic is actually _for each item_ in the +;; list. +;; (defun ox-jira-plain-list (plain-list contents info) "Transcode PLAIN-LIST from Org to JIRA. CONTENTS is the text with plain-list markup. INFO is a plist holding contextual information." contents) +;; This is text with no markup, but we have to escape certain characters to +;; avoid tripping up JIRA. In particular: +;; +;; - ={= :: Introduces macros +;; - =[= :: Introduces links +;; (defun ox-jira-plain-text (text info) "Transcode TEXT from Org to JIRA. TEXT is the string to transcode. INFO is a plist holding @@ -294,12 +366,22 @@ contextual information." '(lambda (p) (format "\\\\%s" p)) text)) +;; Paragraphs are grouped into sections. I've not found any mention in the Org +;; documentation, but it appears to be essential for any export to happen. +;; I've essentially cribbed this from `ox-latex.el`. +;; + (defun ox-jira-section (section contents info) "Transcode a SECTION element from Org to JIRA. CONTENTS is the contents of the section, as a string. INFO is the plist used as a communication channel." contents) +;; JIRA supports formatting for these languages: actionscript, html, +;; java,javascript, sql, xhtml, xml. If none of them fits, we can use 'none', +;; or leave out the language altogether, which I imagine will be a bit like +;; ={noformat}=. +;; (defun ox-jira-src-block (src-block contents info) "Transcode a SRC-BLOCK element from Org to Jira. CONTENTS holds the contents of the src-block. INFO is a plist holding @@ -327,12 +409,34 @@ CONTENTS is the text with superscript markup. INFO is a plist holding contextual information." (ox-jira--text-transform-embeddable "^" contents)) + +;; Org's table editor is one of the many reasons to use Org. It is excellent. +;; Org and JIRA's tables are quite similar. Where Org marks tables up like +;; this: +;; +;; | Name | Score | +;; |--------+-------| +;; | Ashley | 2 | +;; | Alex | 3 | +;; +;; Jira uses the following format: +;; +;; || Name || Score || +;; | Ashley | 2 | +;; | Alex | 3 | +;; +;; Tables are complex beasts. I only hope to support very simple ones. Looks +;; like most of the logic will live in the row and cell transcoding functions. +;; (defun ox-jira-table (table contents info) "Transcode a TABLE element from Org to JIRA. CONTENTS holds the contents of the table. INFO is a plist holding contextual information." contents) +;; We only want to output =standard= rows, not horizontal lines. I'm not sure +;; if detection of header rows belong here or in the cells. +;; (defun ox-jira-table-row (table-row contents info) "Transcode a TABLE-ROW element from Org to JIRA. CONTENTS holds the contents of the table-row. INFO is a plist holding @@ -340,6 +444,10 @@ contextual information." (when (eq 'standard (org-element-property :type table-row)) (format "%s\n" contents))) +;; The cell itself does not know if it is a header cell or not, so we have to +;; ask its containing row if it is the first row, and the table if it has a +;; header row at all. If those things are true, make the cell a header cell. +;; (defun ox-jira-table-cell (table-cell contents info) "Transcode a TABLE-CELL element from Org to JIRA. CONTENTS holds the contents of the table-cell. INFO is a plist holding @@ -353,6 +461,8 @@ contextual information." (format "%s %s %s" sep contents (if (org-export-last-sibling-p table-cell info) sep "")))) +;; This is updated to show progress of subsequent list of check boxes. +;; (defun ox-jira-statistics-cookie (statistics-cookie _contents _info) "Transcode a STATISTICS-COOKIE object from Org to JIRA. CONTENTS is nil. INFO is a plist holding contextual information." -- 2.47.3