It is implemented now...

I only use notes a little bit, and didn't really do anything special with that part of the implementation, other than put timestamps in bold (and that is untested).  The planner-publish mechanism seems to largely handle them already.

My main interest was in lists of tasks, and this seems to work now.  It is a little kludgey -- each task is its own itemized list!  There wasn't any obvious way to hack in the \begin{itemize} and \end{itemize}.  But the results look fine.

I've redefined \footnote to be a no-op.  It really doesn't make much sense to footnote locations to other plan pages.  Furthermore, it seems there are problems with the footnote being fragile.  It would be nice to have working footnotes, where appropriate, but I'm not enough of an elisp or LaTeX hacker to solve that.

Hope others find this useful.

/Lindsay


Michael Olson wrote:
Lindsay Todd <[EMAIL PROTECTED]> writes:

  
Folks: Has anyone ever customized a publishing style to publish
Planner documents as PDF?
    

I could see this being implemented someday.  Perhaps tasks could be
published as:

[ ]  <task desciption>

The brackets would be a checkbox: completed tasks would have a check
mark; the others would have their letter inside of the box).

I'm not sure what notes should look like.  Perhaps level-3 headlines
plus regular paragraph text would work.

What do you think?

  

_______________________________________________ Planner-el-discuss mailing list [email protected] https://mail.gna.org/listinfo/planner-el-discuss


-- 
R. Lindsay Todd                      email: [EMAIL PROTECTED]
Senior Systems Programmer            phone: 518-276-2605
Rensselaer Polytechnic Institute     fax:   518-276-2809
Troy, NY 12180-3590                  WWW:   http://www.rpi.edu/~toddr

The views, opinions, and judgments expressed in this message are
solely those of the author. The message contents have not been
reviewed or approved by Rensselaer.
(require 'planner)

(require 'muse-mode)
(require 'muse-publish)
(require 'muse-latex)  ;;; for deriving style


(require 'planner-publish)

(defcustom planner-publish-pdf-header
  "\\documentclass{article}[12pt]

\\usepackage{exscale}
\\usepackage{amsfonts}
\\usepackage{amssymb}
\\usepackage[english]{babel}
\\usepackage[latin1]{inputenc}
\\usepackage[T1]{fontenc}
\\usepackage{hyperref}
\\usepackage{ulem}
\\usepackage[pdftex]{graphicx}
\\usepackage{color}
\\usepackage[margin=1in,twoside]{geometry}
\\usepackage{fancyhdr}


\\definecolor{plannercolorpriorityA}{rgb}{0.8,0,0}
\\definecolor{plannercolorpriorityB}{rgb}{0,0.8,0}
\\definecolor{plannercolorpriorityC}{rgb}{0,0,0.8}
\\definecolor{plannercolordone}{gray}{0.5}
\\definecolor{plannercolorcancelled}{gray}{0.5}
\\newcommand{\\plannerprioritytagA}[1]{\\texttt{\\textcolor{plannercolorpriorityA}{#1}}}
\\newcommand{\\plannerprioritytagB}[1]{\\texttt{\\textcolor{plannercolorpriorityB}{#1}}}
\\newcommand{\\plannerprioritytagC}[1]{\\texttt{\\textcolor{plannercolorpriorityC}{#1}}}
\\newcommand{\\plannerpriorityA}[1]{\\textbf{\\textit{#1}}}
\\newcommand{\\plannerpriorityB}[1]{{#1}}
\\newcommand{\\plannerpriorityC}[1]{\\textit{#1}}
\\newcommand{\\plannerstatusopen}[1]{#1}
\\newcommand{\\plannerstatusinprogress}[1]{#1}
\\newcommand{\\plannerstatusdelegated}[1]{#1}
\\newcommand{\\plannerstatuspending}[1]{#1}
\\newcommand{\\plannerstatusdone}[1]{\\textcolor{plannercolordone}{\\sout{#1}}}
\\newcommand{\\plannerstatuscancelled}[1]{\\textcolor{plannercolorcancelled}{\\textsl{\\sout{#1}}}}

% Need a better solution to this...
\\renewcommand{\\footnote}[1]{}

\\setcounter{secnumdepth}{0}
\\newcommand{\\comment}[1]{}

<lisp>(when (muse-publishing-directive \"latex-block-paragraphs\")
\"\\\\renewcommand{\\\\familydefault}{\\\\sfdefault} \\\\sf
\\\\setlength{\\\\parindent}{0pt}
\\\\setlength{\\\\parskip}{4pt}\")
</lisp>

\\pagestyle{fancy}
\\fancyhead{}
\\fancyfoot{}
\\fancyhead[RE,LO]{\\thepage}
<lisp>(unless (muse-publishing-directive \"latex-omit-title\")
(concat \"\\\\fancyhead[RO,LE]{\\\\bfseries \" (muse-publishing-directive \"title\") \"}\"))
</lisp>

\\begin{document}

<lisp>(unless (muse-publishing-directive \"latex-omit-title\")
(concat \"\\\\title{\" (muse-publishing-directive \"title\") \"}
\\\\author{\" (muse-publishing-directive \"author\") \"}
\\\\date{\" (muse-publishing-directive \"date\") \"}\"
))
</lisp>\n\n"
  "Header used for publishing LaTeX files.  This may be text or a filename."
  :type 'string
  :group 'planner-publish-pdf)




(defcustom planner-publish-pdf-finalize-regexps
  `(;; numeric ranges
    (10000 "\\([0-9]+\\)-\\([0-9]+\\)" 0 "\\1--\\2")

    ;; be careful of closing quote pairs
    (10100 "\"'" 0 "\"\\\\-'"))
  "List of markup regexps for identifying regions in a Muse page.
For more on the structure of this list, see `muse-publish-markup-regexps'."
  :type '(repeat (choice
                  (list :tag "Markup rule"
                        integer
                        (choice regexp symbol)
                        integer
                        (choice string function symbol))
                  function))
  :group 'planner-publish)

(defun planner-publish-pdf-finalize-buffer ()
  (goto-char (point-min))
  (muse-publish-markup "finalizing Planner page"
                       planner-publish-pdf-finalize-regexps)
  ;; indicate that we are to continue finalizing the buffer
  nil)

; Reuse planner-publish-markup-functions



(defcustom planner-publish-pdf-markup-tags
  '(("nested-section" t nil planner-publish-nested-section-tag)
    ("title" t t planner-publish-pdf-title-tag)
    ("content" t nil planner-publish-content-tag)
    ("diary-section" t nil planner-publish-diary-section-tag)
    ("tasks-section" t nil planner-publish-tasks-section-tag)
    ("notes-section" t nil planner-publish-notes-section-tag)
    ("notes"   nil nil planner-publish-notes-tag)
    ("past-notes" nil t planner-publish-past-notes-tag)
    ("task"    t t   planner-publish-pdf-task-tag)
    ("note"    t t   planner-publish-note-tag))
  "A list of tag specifications, for specially marking up PLANNER.
See `muse-publish-markup-tags' for more information."
  :type '(repeat (list (string :tag "Markup tag")
                       (boolean :tag "Expect closing tag" :value t)
                       (boolean :tag "Parse attributes" :value nil)
                       function))
  :group 'planner-publish)


(defun planner-publish-pdf-title-tag (beg end attrs)
  (let ((level (cdr (assoc "level" attrs))))
    (save-excursion
      (goto-char beg)
      (cond
       ((string= level "1")
	(planner-insert-markup (muse-markup-text 'chapter)))
       ((string= level "2")
	(planner-insert-markup (muse-markup-text 'section)))
       ((string= level "3")
	(planner-insert-markup (muse-markup-text 'subsection)))
       ((string= level "4")
	(planner-insert-markup (muse-markup-text 'subsubsection)))
       ((string= level "5")
	(planner-insert-markup (muse-markup-text 'section-other))))
      (goto-char end)
      (cond
       ((string= level "1")
	(planner-insert-markup (muse-markup-text 'chapter-end)))
       ((string= level "2")
	(planner-insert-markup (muse-markup-text 'section-end)))
       ((string= level "3")
	(planner-insert-markup (muse-markup-text 'subsection-end)))
       ((string= level "4")
	(planner-insert-markup (muse-markup-text 'subsubsection-end)))
       ((string= level "5")
	(planner-insert-markup (muse-markup-text 'section-other-end)))))))


(defun planner-publish-pdf-task-tag (beg end attrs)
  (save-excursion
    (let ((number   (cdr (assoc "id" attrs)))
          (status   (cdr (assoc "status" attrs)))
          (priority (cdr (assoc "priority" attrs)))
          (link     (cdr (assoc "link" attrs)))
          (plan     (cdr (assoc "plan" attrs)))
          (date     (cdr (assoc "date" attrs))))
      (remove-text-properties beg end
                              '(read-only nil rear-nonsticky nil))
      (goto-char end)
      ; FIXME: We want links, but not footnotes.
      ;(when link
      ;  (insert " (" (planner-make-link link) ")"))
      (let ((squashstatus (cond
			   ((string= status "in-progress") "inprogress")
			   (t status)))
	    (bullet (cond
		     ((string= status "open")        "~")
		     ((string= status "in-progress") "o")
		     ((string= status "delegated")   "D")
		     ((string= status "pending")     "P")
		     ((string= status "done")        "X")
		     ((string= status "cancelled")   "C"))))


	(planner-insert-markup (muse-markup-text 'planner-end-task))
	(goto-char beg)
	(planner-insert-markup
	 (muse-markup-text 'planner-begin-task
			   bullet squashstatus priority (concat priority number) priority
;			   priority
;			   (concat priority number " "
;				   (planner-publish-task-status-collapse status)
;				   " ")
			   ))))))


(defcustom planner-publish-pdf-markup-strings
  '(
    (planner-begin-nested-section . "")
    (planner-end-nested-section   . "")
    (planner-begin-content       . "")
    (planner-end-content         . "")
    (planner-begin-body          . "")
    (planner-end-body            . "")
    (planner-begin-diary-section . "")
    (planner-end-diary-section   . "")
    (planner-begin-task-section  . "")
    (planner-end-task-section    . "")
    (planner-begin-note-section  . "")
    (planner-end-note-section    . "")
    (planner-begin-task-body     . "")
    (planner-end-task-body       . "")
    (planner-begin-task          . "\\begin{itemize}\n\\item[\\texttt{[%s]}] \\plannerstatus%s{\\plannerprioritytag%s{%s} \\plannerpriority%s{")
    (planner-end-task            . "}}\n\\end{itemize}")
    (planner-begin-note          . "")
    (planner-end-note            . "")
    (planner-begin-note-details  . "\\begin{quotation}\\textbf{%s}")
    (planner-end-note-details    . "\\end{quotation}")
    (planner-begin-note-link     . " ")
    (planner-end-note-link       . "")
    (planner-begin-note-categories . " ")
    (planner-end-note-categories . "")
    )
  "Strings used for marking up text as PDF.
These cover the most basic kinds of markup, the handling of which
differs little between the various styles.

If a markup rule is not found here, `muse-pdf-markup-strings' is
searched."
  :type '(alist :key-type symbol :value-type string)
  :group 'planner-publish)


(muse-derive-style "planner-pdf" "pdf"
		   :suffix    'muse-latex-extension
		   :regexps   'planner-publish-markup-regexps
		   :functions 'planner-publish-markup-functions
		   :strings   'planner-publish-pdf-markup-strings
		   :specials  'muse-latex-decide-specials
		   :tags      'planner-publish-pdf-markup-tags
		   :before    'planner-publish-prepare-buffer
		   :after     'planner-publish-pdf-finalize-buffer
		   :final     'muse-latex-pdf-generate
		   :browser   'muse-latex-pdf-browse-file
		   :link-suffix 'muse-latex-pdf-extension
		   :osuffix   'muse-latex-pdf-extension
		   :header    'planner-publish-pdf-header
		   :footer    'muse-latex-footer
		   )

(provide 'planner-publish-pdf)
_______________________________________________
Planner-el-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/planner-el-discuss

Reply via email to