Skip to content

iani/org-pm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

org-pm (v. 0.2.2)

Publish org-mode files or sections to projects created by reading specifications from a folder.

Features / Principles

  • Publish any Org-mode file or any section of it to any number of projects.
  • Zero configuration: Start publishing any file or section to an existing or new project, without any previous configuration.
  • Easy customization: Place html (header), org-mode options, css and JavaScript files in folder includes, and they are included in the project’s definition automatically.
  • Templates for creating projects with different custom styles.
  • Optionally run script to upload site to server immediately after the publish process is completed.

Installation, dependencies

org-pm can be obtained from GitHub at: https://github.com/iani/org-pm

The el-get recipe for org-pm is:

(:name org-pm :url "http://github.com/iani/org-pm.git" :type git :features
       (org-pm)
       :after nil)

org-pm uses following packages:

  1. grizzl
  2. dash

On Emacs 24 one can install these packages by running the command package-install (Meta-x package-install grizzl).

Commands

org-pm-menu (Function-e m)
Open a menu with following items:
  • publish file
  • publish subtree
  • dired root directory
  • dired source directory
  • dired target directory
  • republish entire project
  • open last published file
  • make project
org-pm-publish-file (Function-e f)
Publish the current file to a project selected from a menu of existing project, or enter a name to create a new project.
org-pm-publish-subtree (Function-e s)
Publish the current org-section to a project selected from menu (see org-pm-publish-file).
org-pm-republish-entire-project
Force re-publishing all source files of the project.
org-pm-make-project
Create a new project or select a new template for an existing project.

When the above publishing commands are preceded by a universal argument (Control-U), org-pm will execute the first shell file (.sh) found inside sub-directory DEPLOY of the project after publishing. This can be used to upload the site to a server immediately after exporting it.

Directory structure

Project directory

Org-pm stores the configuration, source, and export files for all projects in a single directory. The default location of this directory is ~/org-pm-projects. Each sub-directory of this directory holds a project.

For example, the following directory structure defines two projects, project1 and project2:

~/org-pm-projects
                 /project1
                 /project2

org-pm stores the Org-mode source files of the project in the projects’ directory, under sub-directory SOURCE. The exported files output by publishing the project are placed directly inside the top level of the project directory. The project SOURCE directory is scanned recursively, and the directory structure of the source is preserved in the exported files directory structure.

Furthermore, each project directory may optionally contain the following sub-directories:

Directory includes
Contains css and js files that are included in the final project’s pages through the standard header mechanism, and the org and html files used to configure the org-mode options of the project and provide headers and other html parts.
Directory DEPLOY
Contains shell scripts for deploying the site.

The project’s html is exported inside the top level of the project folder.

~/org-pm-projects/project1
    sub-directory "includes":
          style.css        (contains the css style definition for the site)
          scripts.min.js   (contains js scripts for the site)
          OPTIONS.org      (contains the options for configuring export)
          HTML_HEAD.html   (contains the HTML_HEAD part for export)
    sub-directory "SOURCE:
          index.org        (the home page, created by publishing with org-pm)
    sub-directory "DEPLOY:
          github.sh        (shell script for deploying the site to github)
    index.html             (the home page, generated by org-pm-publish from index.org)

The SOURCE directory

org-pm places the org files that are used to create the project site inside the SOURCE folder.

Templates

The directory TEMPLATES in org-pm includes templates for customizing the style of a project. The command org-pm-make-project offers a menu to select a template, in order to initialize the template of a new project or to change the template of an existing project.

A template is simply a folder of files that are copied to the includes folder of a project.

To add your own templates, create a folder where you will put the templates, and add this folder to the list in variable org-pm-templates-dir. Include the wild-card for finding the folders (/*) in the path. For example:

(add-to-list 'org-pm-template-dirs "~/my-org-pm-templates/*")

Deploying (publishing to server) with scripts

If called with a prefix argument (C-u) the commands org-pm-publish-file, org-pm-publish-subtree, org-pm-republish-entire-project will look for a shell script to run after the publish process is complete. If you want to run a script to upload the project’s site with git or rsync etc, then place that script in directory DEPLOY inside the directory of the project. The script’s file name must end in .sh. Only the first script file contained in the DEPLOY directory will be run. Other files are ignored.

The path of the project folder is passed to the script as first argument.

Here is an example script for deploying to github:

(file:~/org-pm-projects/project1/DEPLOY/github.sh)

#!/bin/bash
cd $1
git checkout master
git add .
git commit -am "Published on: `date`"
git push origin master
git checkout gh-pages
git merge master
git push origin gh-pages
git checkout master

About

Publish org-mode files or sections to projects created by reading specifications from a folder

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages