Org-mode

Home

Table of Contents

1 Intro - Org-mode as a content / publishing system

This page contains my own notes about org-mode

Please refer to the full documentation at: http://orgmode.org/manual/

http://orgmode.org/worg/org-tutorials/org4beginners.html

http://orgmode.org/worg/org-tutorials/index.html

http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html

source code: /usr/share/emacs/24.4/lisp/org/org.el.gz

2 quick shortcusts

C-c C-e h Export org file to HTML

(org-toggle-link-display )

3 Reference

bash> aptitude install org-mode-doc

cat /var/lib/dpkg/info/org-mode-doc.list

/usr/share/doc-base/org-mode
/usr/share/doc/org-mode-doc/orgguide.pdf.gz
/usr/share/doc/org-mode-doc/orgcard.tex.gz
/usr/share/doc/org-mode-doc/pdflayout.sty
/usr/share/doc/org-mode-doc/org.gz
/usr/share/doc/org-mode-doc/library-of-babel.org.gz
/usr/share/doc/org-mode-doc/org-version.inc
/usr/share/doc/org-mode-doc/org.pdf.gz
/usr/share/doc/org-mode-doc/orgcard.txt.gz
/usr/share/info/org.gz
;; to read the org mode documentation inside emacs
;; install the package  org-mode-doc and then
;; evaluate the following expression inside emacs:

(info "org")

http://doc.norang.ca/org-mode.html Org Mode - Organize Your Life In Plain Text!

4 Html and CSS support

http://orgmode.org/manual/Hyperlinks.html

http://orgmode.org/manual/Markup.html Markup for rich export

http://orgmode.org/manual/CSS-support.html

Each exported file contains a compact default style that defines these classes in a basic way.

You may overwrite these settings, or add to them by using the variables org-html-head and org-html-head-extra.

You can override the global values of these variables for each file by using these keywords:

#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" />
#+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" />

http://orgmode.org/manual/Quoting-HTML-tags.html

#+BEGIN_HTML
    All lines between these markers are exported literally
#+END_HTML

http://orgmode.org/manual/Easy-Templates.html

Awesome HTML themes for files exported from Org mode https://github.com/fniessen/org-html-themes

Using Org-mode to Publish a Web Site https://pavpanchekha.com/blog/org-mode-publish.html

Org-Mode CSS http://nklein.com/2010/05/org-mode-css/

4.1 Showing / hidding links

To show the internal structure of all links, use the menu entry Org->Hyperlinks->Literal links.

VAR org-descriptive-links

(org-toggle-link-display )

E.g. Org website will be displayed as \"Org Website\", hiding the link itself and just displaying its description. When set to `nil', Org will display the full links literally.

You can interactively set the value of this variable by calling `org-toggle-link-display' or from the menu Org>Hyperlinks menu."

5 Source code support

Org mode contains the Org Babel environment which allows you to work with embedded source code blocks in a file, to facilitate code evaluation, documentation, and literate programming techniques.

#+BEGIN_SRC emacs-lisp
  (defun org-xor (a b)
     "Exclusive or."
     (if a (not b) b))
#+END_SRC
(defun org-xor (a b)
   "Exclusive or."
   (if a (not b) b))

For simplicity when using small examples, you can also start the example lines with a colon followed by a space. There may also be additional whitespace before the colon:

Here is an example
   : Some example from a text file.

http://orgmode.org/manual/Working-With-Source-Code.html

http://orgmode.org/manual/Languages.html List of supported languages

Code blocks in the following languages are supported.

Language Identifier Language Identifier
Asymptote asymptote Awk awk
Emacs Calc calc C C
C++ C++ Clojure clojure
CSS css ditaa ditaa
Graphviz dot Emacs Lisp emacs-lisp
gnuplot gnuplot Haskell haskell
Java java    
Javascript js LaTeX latex
Ledger ledger Lisp lisp
Lilypond lilypond MATLAB matlab
Mscgen mscgen Objective Caml ocaml
Octave octave Org mode org
Oz oz Perl perl
Plantuml plantuml Python python
R R Ruby ruby
Sass sass Scheme scheme
GNU Screen screen shell sh
SQL sql SQLite sqlite

5.1 Include files

http://orgmode.org/manual/Include-files.html#Include-files

During export, you can include the content of another file. For example, to include your .emacs file, you could use:

#+INCLUDE: "~/.emacs" src emacs-lisp

The optional second and third parameter are the markup (i.e., ‘example’ or ‘src’), and, if the markup is ‘src’, the language for formatting the contents. The markup is optional; if it is not given, the text will be assumed to be in Org mode format and will be processed normally.

Contents of the included file will belong to the same structure (headline, item) containing the INCLUDE keyword. In particular, headlines within the file will become children of the current section. That behavior can be changed by providing an additional keyword parameter, :minlevel. In that case, all headlines in the included file will be shifted so the one with the lowest level reaches that specified level. For example, to make a file become a sibling of the current top-level headline, use

#+INCLUDE: "~/my-book/chapter2.org" :minlevel 1

You can also include a portion of a file by specifying a lines range using the :lines parameter. The line at the upper end of the range will not be included. The start and/or the end of the range may be omitted to use the obvious defaults.

#+INCLUDE: "~/.emacs" :lines "5-10"   Include lines 5 to 10, 10 excluded
#+INCLUDE: "~/.emacs" :lines "-10"    Include lines 1 to 10, 10 excluded
#+INCLUDE: "~/.emacs" :lines "10-"    Include lines from 10 to EOF
C-c '
Visit the include file at point.

6 Org-mode Cool stuff

7 Publishing script

;; (defun my-preamble-format(plist)
;;   "my test preamble format func"
;;   "Follow your bliss …"
;; )

(defun my-preamble-format(plist)
  "my test preamble format func"
  ""
)


(defun my-postamble-format(plist)
  "my test preamble format func"
  "[POSTAMBLE HERE]"
)


;; execute from command line with:
;; emacs -Q --batch -l  publish_html.el

(require 'ox-publish)
(setq org-publish-project-alist
      '(

       ;; ... add all the components here
        ("org-notes"
         :base-directory "~/c_workspace/sen-blog/snarvaez_com_ar_notes/org_notes/"
         :base-extension "org"
         :publishing-directory "~/c_workspace/sen-blog/snarvaez_com_ar_notes/_site/"
         :recursive t
         :publishing-function org-html-publish-to-html
         :headline-levels 4             ; Just the default for this project.
         :auto-preamble t
         :auto-sitemap t                ; Generate sitemap.org automagically...
         :sitemap-filename "sitemap.org"  ; ... call it sitemap.org (it's the default)...
         :sitemap-title "Sitemap"         ; ... with title 'Sitemap'.
         :language "en"
         :html-head  "<link rel='stylesheet' type='text/css' href='style.css' />"
         :html-head-extra "<meta name='viewport' content='width=device-width, initial-scale=1.0'>"
         :with-author "Sebastian Emilio Narvaez"
         :with-email nil
         :html-preamble  my-preamble-format
         :exports code
         ;; :html-postamble my-postamble-format
         :htmlized-source t    ;; htmlized-source     non-nil means, publish htmlized source
         )

        ("org-static"
         :base-directory "~/c_workspace/sen-blog/snarvaez_com_ar_notes/org_notes/"
         :base-extension "html\\|css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
         :publishing-directory "~/c_workspace/sen-blog/snarvaez_com_ar_notes/_site/"
         :recursive t
         :publishing-function org-publish-attachment
         )

        ("org" :components ("org-notes" "org-static"))


      ))

(org-publish-project "org")

8 Org Publishing documentation summary

Publishing > Configuration > Sources and destinations



13.1.2 Sources and destinations for files
-----------------------------------------

Most properties are optional, but some should always be set.  In
particular, Org needs to know where to look for source files, and where
to put published files.

`:base-directory'      Directory containing publishing source files
`:publishing-directory'Directory where output files will be published.
                       You can directly publish to a web server using a
                       file name syntax appropriate for the Emacs
                       `tramp' package.  Or you can publish to a local
                       directory and use external tools to upload your
                       website (*note Uploading files::).
`:preparation-function'Function or list of functions to be called before
                       starting the publishing process, for example, to
                       run `make' for updating files to be published.
                       The project property list is scoped into this
                       call as the variable `project-plist'.
`:completion-function' Function or list of functions called after
                       finishing the publishing process, for example, to
                       change permissions of the resulting files.  The
                       project property list is scoped into this call as
                       the variable `project-plist'.



13.1.3 Selecting files
----------------------

By default, all files with extension `.org' in the base directory are
considered part of the project.  This can be modified by setting the
properties
`:base-extension'  Extension (without the dot!) of source files.  This
                   actually is a regular expression.  Set this to the
                   symbol `any' if you want to get all files in
                   `:base-directory', even without extension.
`:exclude'         Regular expression to match file names that should
                   not be published, even though they have been selected
                   on the basis of their extension.
`:include'         List of files to be included regardless of
                   `:base-extension' and `:exclude'.
`:recursive'       non-`nil' means, check base-directory recursively for
                   files to publish.
Home

Author: Sebastian Emilio Narvaez

Created: 2016-01-13 Wed 08:41

Emacs 24.4.1 (Org mode 8.2.10)

Validate