Browse Source

Make update of ascii refcard auomatic

Carsten Dominik 10 years ago
parent
commit
c069b7c5c6
6 changed files with 134 additions and 474 deletions
  1. 1 0
      .gitignore
  2. 5 2
      Makefile
  3. 2 2
      ORGWEBPAGE/index.org
  4. 123 0
      UTILITIES/orgcard2txt.pl
  5. 3 0
      doc/org.texi
  6. 0 470
      doc/orgcard.txt

+ 1 - 0
.gitignore

@@ -26,6 +26,7 @@
 *.dvi
 *.ps
 orgcard_letter.tex
+orgcard.txt
 org
 org-install.el
 org-*.tar.gz

+ 5 - 2
Makefile

@@ -202,6 +202,9 @@ doc/org.html: doc/org.texi
 doc/orgcard.pdf: doc/orgcard.tex
 	(cd doc; pdftex orgcard.tex)
 
+doc/orgcard.txt: doc/orgcard.tex
+	(cd doc; perl ../UTILITIES/orgcard2txt.pl orgcard.tex > orgcard.txt)
+
 doc/orgcard_letter.tex: doc/orgcard.tex
 	perl -pe 's/\\pdflayout=\(0l\)/\\pdflayout=(1l)/' \
                    doc/orgcard.tex > doc/orgcard_letter.tex
@@ -232,7 +235,7 @@ info:	doc/org
 
 pdf:	doc/org.pdf doc/orgguide.pdf
 
-card:	doc/orgcard.pdf doc/orgcard_letter.pdf
+card:	doc/orgcard.pdf doc/orgcard_letter.pdf doc/orgcard.txt
 
 distfile:
 	@if [ "X$(TAG)" = "X" ]; then echo "*** No tag ***"; exit 1; fi
@@ -266,7 +269,7 @@ release:
 	$(MKDIR) RELEASEDIR
 	cp org-$(TAG).zip org-$(TAG).tar.gz RELEASEDIR
 	cp doc/org.pdf doc/orgcard.pdf doc/org.texi doc/org.html RELEASEDIR
-	cp doc/orgguide.pdf RELEASEDIR
+	cp doc/orgguide.pdf doc/orgcard.txt RELEASEDIR
 	cp RELEASEDIR/org-$(TAG).zip    RELEASEDIR/org.zip
 	cp RELEASEDIR/org-$(TAG).tar.gz RELEASEDIR/org.tar.gz
 

+ 2 - 2
ORGWEBPAGE/index.org

@@ -178,8 +178,8 @@ and corresponding to the latest git version.
 
 ** Reference card
    - Download the [[file:orgcard.pdf][Refcard]] for org-mode
-   - Kyle Sherman has created a [[file:orgcard.txt][text version]] of the reference card
-     (Org version 6.07).
+   - There is also a [[file:orgcard.txt][text version]] of the
+     reference card.
 ** The FAQ
    - The [[http://orgmode.org/worg/org-faq.php][Org Mode FAQ]] is user-editable and is maintained by the [[http://orgmode.org/worg/][Worg
      project]]. 

+ 123 - 0
UTILITIES/orgcard2txt.pl

@@ -0,0 +1,123 @@
+# orgcard2txt.pl - a script to generate orgcard.txt from orgcard.tex
+# Copyright (C) 2010 Osamu OKANO
+#
+# Version: 0.1
+#
+# This program 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
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Usage:
+# ======
+#  perl orgcard2txt.pl orgcard.tex > orgcard.txt
+use strict;
+use warnings;
+
+sub rep_esc{
+  my $s = shift @_;
+  $s =~ s/\\kbd{([^}]+)}/$1/g;
+  $s =~ s/\$\^([0-9])\$/[$1]/g;
+  $s =~ s/\\rm //g;
+  $s =~ s/\\\///g;
+  $s =~ s/\\\^{}/^/g;
+  $s =~ s/\\}/}/g;
+  $s =~ s/\\{/{/g;
+  $s =~ s/\\\#/#/g;
+  $s =~ s/\\\^/^/g;
+  $s =~ s/\\\%/%/g;
+  $s =~ s/\\\_/_/g;
+  $s =~ s/\\\&/&/g;
+  $s =~ s/\\\$/\$/g;
+  $s =~ s/\$\\leftrightarrow\$/<->/g;
+  $s =~ s/\$\\pm 1\$/±1/g;
+  $s =~ s/``{\\tt ([^}]+)}''/`$1'/g;
+  return $s;
+}
+my $page=0;
+my $orgversionnumber;
+
+open(IN,$ARGV[0]);
+while(<IN>){
+  last if(/\f/);
+  $orgversionnumber = $1 if /\\def\\orgversionnumber{([^}]+)}/;
+}
+close(IN);
+
+print <<HEAD;
+================================================================================
+Org-Mode Reference Card (for version $orgversionnumber)
+================================================================================
+HEAD
+
+my $key;
+my $value;
+
+format STDOUT =
+@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+$key,$value
+.
+
+open(IN,$ARGV[0]);
+while(<IN>){
+  if(/\f/){
+    $page = $page + 1;
+    next;
+  }
+  next if($page != 1);
+  next if(/^%/);
+  next if /Org-Mode Reference Card \([12]\/2\)/;
+  next if /\\centerline{\(for version \\orgversionnumber\)}/;
+  next if /\(for version  \)/;
+  next if /\\newcolumn/;
+  next if /\\copyrightnotice/;
+  next if /\\bye/;
+  next if /\\title{([^}]+)}/;
+  chomp;
+#  print "b:$_\n";
+  s/([^\\])\%.+$/$1/;
+#  print "a:$_\n";
+  if (/\\section{(.+)}/){
+    my $sec = rep_esc($1);
+    print "================================================================================\n";
+    print "$sec\n";
+    print "================================================================================\n";
+    next;
+  }
+  if (/{\\bf (.+)}/){
+    my $bf = rep_esc($1);
+    print "--------------------------------------------------------------------------------\n";
+    print "$bf\n";
+    print "--------------------------------------------------------------------------------\n";
+    next;
+  }
+  if (/^{\\it (.+)}/){
+    my $it = rep_esc($1);
+    print "--------------------------------------------------------------------------------\n";
+    print "$it\n";
+    print "--------------------------------------------------------------------------------\n";
+    next;
+  }
+  if(/^\\key{(.+)}\s*$/||/^\\metax{(.+)}\s*$/){
+    my ($k,$v) = split(/}{/,$1);
+    my $k2 = &rep_esc($k);
+    my $v2 = &rep_esc($v);
+#    print "$k2\t$v2\n";
+    ($key,$value)=($k2,$v2);
+    write;
+    next;
+  }
+  my $line = rep_esc($_);
+  $line =~ s/{\\it ([^}]+)}/$1/g;
+  $line =~ s/{\\tt ([^}]+)}/$1/g;
+  print "$line\n";
+}
+close(IN);

+ 3 - 0
doc/org.texi

@@ -12665,6 +12665,9 @@ and being able to quickly restrict the agenda to a subtree.
 @i{Tim O'Callaghan} suggested in-file links, search options for general
 file links, and TAGS.
 @item
+@i{Osamu Okano} wrote @file{orgcard2ref.pl}, a perl program to create a text
+version of the reference card.
+@item
 @i{Takeshi Okano} translated the manual and David O'Toole's tutorial
 into Japanese.
 @item

+ 0 - 470
doc/orgcard.txt

@@ -1,470 +0,0 @@
-================================================================================
-Org-Mode Reference Card (for version 6.10)
-================================================================================
-
-================================================================================
-Getting Started
-================================================================================
-
-(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
-(define-key global-map "\C-cl" 'org-store-link) [1]
-(define-key global-map "\C-ca" 'org-agenda) [1]
-
-For the many customization options try            M-x org-customize
-To read the on-line documentation try             M-x org-info
-
-================================================================================
-Visibility Cycling
-================================================================================
-
-rotate current subtree between states             TAB
-rotate entire buffer between states               S-TAB
-restore property-dependent startup visibility     C-u C-u TAB
-show the whole file, including drawers            C-u C-u C-u TAB
-reveal context around point                       C-c C-r
-
-================================================================================
-Motion
-================================================================================
-
-next/previous heading                             C-c C-n/p
-next/previous heading, same level                 C-c C-f/b
-backward to higher level heading                  C-c C-u
-jump to another place in document                 C-c C-j
-previous/next plain list item                     S-UP/DOWN [3]
-
-================================================================================
-Structure Editing
-================================================================================
-
-insert new heading/item at current level          M-RET
-insert new heading after subtree                  C-RET
-insert new TODO entry/checkbox item               M-S-RET
-insert TODO entry/ckbx after subtree              C-S-RET
-turn (head)line into item, cycle bullet type      C-c -
-turn item/line into headline, and back into line  C-c *
-
-promote/demote current heading up one level       M-LEFT/RIGHT
-promote/demote current subtree up one level       M-S-LEFT/RIGHT
-move subtree/list item up/down                    M-S-UP/DOWN
-refile subtree                                    C-c C-w
-kill subtree                                      C-c C-x C-w
-copy subtree                                      C-c C-x M-w
-yank subtree                                      C-c C-x C-y
-narrow buffer to current subtree                  C-x n s
-widen restriction to full buffer                  C-x n w
-
-================================================================================
-Archiving
-================================================================================
-
-toggle ARCHIVE tag                                C-c C-x C-a
-force cycling of an ARCHIVEd tree                 C-TAB
-move subtree to archive file                      C-c C-x C-s
-
-================================================================================
-Filtering and Sparse Trees
-================================================================================
-
-construct a sparse tree by various criteria       C-c /
-view TODO's in sparse tree                        C-c C-v
-global TODO list in agenda mode                   C-c a t [1]
-time sorted view of current org file              C-c a L
-
-================================================================================
-Tables
-================================================================================
-
---------------------------------------------------------------------------------
-Creating a table
---------------------------------------------------------------------------------
-
-just start typing, e.g.                           |Name|Phone|Age RET |- TAB
-convert region to table                           C-c |
-... separator at least 3 spaces                   C-3 C-c |
-
---------------------------------------------------------------------------------
-Commands available inside tables
---------------------------------------------------------------------------------
-
-The following commands work when the cursor is inside a table.  Outside of
-tables, the same keys may have other functionality.
-
---------------------------------------------------------------------------------
-Re-aligning and field motion
---------------------------------------------------------------------------------
-
-re-align the table without moving the cursor      C-c C-c
-re-align the table, move to next field            TAB
-move to previous field                            S-TAB
-re-align the table, move to next row              RET
-
---------------------------------------------------------------------------------
-Row and column editing
---------------------------------------------------------------------------------
-
-move the current column left                      M-LEFT/RIGHT
-kill the current column                           M-S-LEFT
-insert new column to left of cursor position      M-S-RIGHT
-move the current row up/down                      M-UP/DOWN
-kill the current row or horizontal line           M-S-UP
-insert new row above the current row              M-S-DOWN
-insert hline below (C-u : above) current row      C-c -
-sort lines in region                              C-c ^
-
---------------------------------------------------------------------------------
-Regions
---------------------------------------------------------------------------------
-
-cut rectangular region                            C-c C-x C-w
-copy rectangular region                           C-c C-x M-w
-paste rectangular region                          C-c C-x C-y
-fill paragraph across selected cells              C-c C-q
-
---------------------------------------------------------------------------------
-Miscellaneous
---------------------------------------------------------------------------------
-
-to limit column width to N characters, use        ...| <N> |...
-edit the current field in a separate window       C-c `
-make current field fully visible                  C-u TAB
-export as tab-separated file                      M-x org-table-export
-import tab-separated file                         M-x org-table-import
-sum numbers in current column/rectangle           C-c +
-
---------------------------------------------------------------------------------
-Tables created with the table.el package
---------------------------------------------------------------------------------
-
-insert a new table.el table                       C-c ~
-recognize existing table.el table                 C-c C-c
-convert table (Org-mode <-> table.el)             C-c ~
-
---------------------------------------------------------------------------------
-Spreadsheet
---------------------------------------------------------------------------------
-
-Formulas typed in field are executed by TAB, RET and C-c C-c.  = introduces a
-column formula, := a field formula.
-
-Example: Add Col1 and Col2                        |=$1+$2 |
-... with printf format specification              |=$1+$2;%.2f|
-... with constants from constants.el              |=$1/$c/$cm |
-sum from 2nd to 3rd hline                         |:=vsum(@II..@III)|
-apply current column formula                      | = |
-set and eval column formula                       C-c =
-set and eval field formula                        C-u C-c =
-re-apply all stored equations to current line     C-c *
-re-apply all stored equations to entire table     C-u C-c *
-iterate table to stability                        C-u C-u C-c *
-rotate calculation mark through # * ! $           C-#
-show line, column, formula reference              C-c ?
-toggle coordinate grid                            C-c }
-toggle formula debugger                           C-c {
-
---------------------------------------------------------------------------------
-Formula Editor
---------------------------------------------------------------------------------
-
-edit formulas in separate buffer                  C-c '
-exit and install new formulas                     C-c C-c
-exit, install, and apply new formulas             C-u C-c C-c
-abort                                             C-c C-q
-toggle reference style                            C-c C-r
-pretty-print Lisp formula                         TAB
-complete Lisp symbol                              M-TAB
-shift reference point                             S-cursor
-shift test line for column references             M-up/down
-scroll the window showing the table               M-S-up/down
-toggle table coordinate grid                      C-c }
-
-================================================================================
-Links
-================================================================================
-
-globally store link to the current location       C-c l [1]
-insert a link (TAB completes stored links)        C-c C-l
-insert file link with file name completion        C-u C-c C-l
-edit (also hidden part of) link at point          C-c C-l
-open file links in emacs                          C-c C-o
-... force open in emacs/other window              C-u C-c C-o
-open link at point                                mouse-1/2
-... force open in emacs/other window              mouse-3
-record a position in mark ring                    C-c %
-jump back to last followed link(s)                C-c &
-find next link                                    C-c C-x C-n
-find previous link                                C-c C-x C-p
-edit code snippet of file at point                C-c '
-
---------------------------------------------------------------------------------
-Internal Links
---------------------------------------------------------------------------------
-
-<<My Target>>                                     target
-<<<My Target>>>                                   radio target [2]
-[[*this text]]                                    find headline
-[[this text]]                                     find target or text in buffer
-[[this text][description]]                        optional link text
-
---------------------------------------------------------------------------------
-External Links
---------------------------------------------------------------------------------
-
-file:/home/dominik/img/mars.jpg                   file, absolute
-file:papers/last.pdf                              file, relative
-file:projects.org::*that text                     find headline
-file:projects.org::find me                        find trgt/string
-http://www.astro.uva.nl/dominik                   on the web
-mailto:adent@galaxy.net                           Email address
-news:comp.emacs                                   Usenet group
-bbdb:Richard Stallman                             BBDB person
-gnus:group                                        GNUS group
-gnus:group#id                                     GNUS message
-vm|wl|mhe|rmail:folder                            Mail folder
-vm|wl|mhe|rmail:folder#id                         Mail message
-info:emacs:Regexps                                Info file:node
-shell:ls *.org                                    shell command
-elisp:(calendar)                                  elisp form
-[[external link][description]]                    optional link text
-
-================================================================================
-Completion
-================================================================================
-
-In-buffer completion completes TODO keywords at headline start, TeX macros
-after `\', option keywords after `#-â', TAGS after `:', and dictionary words
-elsewhere.
-
-complete word at point                            M-TAB
-
-================================================================================
-TODO Items and Checkboxes
-================================================================================
-
-rotate the state of the current item              C-c C-t
-select next/previous state                        S-LEFT/RIGHT
-select next/previous set                          C-S-LEFT/RIGHT
-view TODO items in a sparse tree                  C-c C-v
-view 3rd TODO keyword's sparse tree               C-3 C-c C-v
-set the priority of the current item              C-c , [ABC]
-remove priority cookie from current item          C-c , SPC
-raise/lower priority of current item              S-UP/DOWN [3]
-insert new checkbox item in plain list            M-S-RET
-toggle checkbox(es) in region/entry/at point      C-c C-x C-b
-toggle checkbox at point                          C-c C-c
-checkbox statistics cookies                       insert [/] or [%]
-update checkbox statistics (C-u : whole file)     C-c #
-
-================================================================================
-Tags
-================================================================================
-
-set tags for current heading                      C-c C-q
-realign tags in all headings                      C-u C-c C-q
-create sparse tree with matching tags             C-c \
-globally (agenda) match tags at cursor            C-c C-o
-
-\section{Properties and Column View}
-
-\key{set property}{C-c C-x p}
-\key{special commands in property lines}{C-c C-c}
-\key{next/previous allowed value}{S-left/right}
-\key{turn on column view}{C-c C-x C-c}
-\key{capture columns view in dynamic block}{C-c C-x i}
-
-\key{quit column view}{q}
-\key{next/previous allowed value}{S-left/right}
-\key{next/previous allowed value}{n / p}
-\key{edit value}{e}
-\key{edit allowed values list}{a}
-\key{show value}{v}
-\key{make column wider/narrower}{> / <}
-\key{move column left/right}{M-left/right}
-\key{add new column}{M-S-right}
-\key{Delete current column}{M-S-left}
-
-
-
-================================================================================
-Timestamps
-================================================================================
-
-prompt for date and insert timestamp              C-c .
-like C-c . but insert date and time format        C-u C-c .
-like C-c . but make stamp inactive                C-c !
-insert DEADLINE timestamp                         C-c C-d
-insert SCHEDULED timestamp                        C-c C-s
-create sparse tree with all deadlines due         C-c C-w
-the time between 2 dates in a time range          C-c C-y
-change timestamp at cursor by ±1 day              S-RIGHT/LEFT [3]
-change year/month/day at cursor by ±1             S-UP/DOWN [3]
-access the calendar for the current date          C-c >
-insert timestamp matching date in calendar        C-c <
-access agenda for current date                    C-c C-o
-select date while prompted                        mouse-1/RET
-toggle custom format display for dates/times      C-c C-x C-t
-
---------------------------------------------------------------------------------
-Clocking time
---------------------------------------------------------------------------------
-
-start clock on current item                       C-c C-x C-i
-stop clock on current item                        C-c C-x C-o
-cancel current clock                              C-c C-x C-x
-display total subtree times                       C-c C-x C-d
-remove displayed times                            C-c C-c
-insert/update table with clock report             C-c C-x C-r
-
-================================================================================
-Agenda Views
-================================================================================
-
-add/move current file to front of agenda          C-c [
-remove current file from your agenda              C-c ]
-cycle through agenda file list                    C-'
-compile agenda for the current week               C-c a a [1]
-compile global TODO list                          C-c a t [1]
-compile TODO list for specific keyword            C-c a T [1]
-match tags, TODO kwds and properties              C-c a m [1]
-match only in TODO entries                        C-c a M [1]
-find stuck projects                               C-c a # [1]
-show timeline of current org file                 C-c a L [1]
-configure custom commands                         C-c a C [1]
-configure stuck projects                          C-c a ! [1]
-agenda for date at cursor                         C-c C-o
-
-To set categories, add lines like [2]:
-#+CATEGORY: MyCateg
-
---------------------------------------------------------------------------------
-Commands available in an agenda buffer
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
-View Org file
---------------------------------------------------------------------------------
-
-show original location of item                    SPC/mouse-3
-show and recenter window                          L
-goto original location in other window            TAB/mouse-2
-goto original location, delete other windows      RET
-show subtree in indirect buffer, ded. frame       b
-toggle follow-mode                                f
-
---------------------------------------------------------------------------------
-Change display
---------------------------------------------------------------------------------
-
-delete other windows                              o
-switch to day/week/month/year view                d/w/m/y
-toggle inclusion of diary entries                 D
-toggle time grid for daily schedule               G
-toggle display of logbook entries                 l
-toggle inclusion of archived trees/files          v / C-u v}
-refresh agenda buffer with any changes            r / g
-filter agenda with respect to a tag               /
-save all org-mode buffers                         s
-display the next/previous day, week,...           RIGHT/LEFT
-goto today                                        .
-
---------------------------------------------------------------------------------
-Remote editing
---------------------------------------------------------------------------------
-
-digit argument                                    0-9
-change state of current TODO item                 t
-kill item and source                              C-k
-archive the subtree (file/tag/sibling)            $ / a / A
-show tags of current headline                     T
-set tags for current headline                     :
-set priority of current item                      p
-raise/lower priority of current item              S-UP/DOWN [3]
-display weighted priority of current item         P
-run an attachment command                         C-c C-a
-schedule/set deadline for this item               C-c C-s/d
-change timestamp to one day earlier/later         S-LEFT/RIGHT [3]
-change timestamp to today                         >
-insert new entry into diary                       i
-start/stop/cancel the clock in current item       I / O / X
-jump to running clock entry                       J
-
-
---------------------------------------------------------------------------------
-Misc
---------------------------------------------------------------------------------
-
-Open link in current line                         C-c C-o
-
---------------------------------------------------------------------------------
-Calendar commands
---------------------------------------------------------------------------------
-
-find agenda cursor date in calendar               c
-compute agenda for calendar cursor date           c
-show phases of the moon                           M
-show sunrise/sunset times                         S
-show holidays                                     H
-convert date to other calendars                   C
-
---------------------------------------------------------------------------------
-Quit and Exit
---------------------------------------------------------------------------------
-
-quit agenda, remove agenda buffer                 q
-exit agenda, remove all agenda buffers            x
-
-================================================================================
-Calendar and Diary Integration
-================================================================================
-
-Include Emacs diary entries into Org-mode agenda with:
-(setq org-agenda-include-diary t)
-
-================================================================================
-LaTeX and cdlatex-mode
-================================================================================
-
-preview LaTeX fragment                            C-c C-x C-l
-expand abbreviation (cdlatex-mode)                TAB
-insert/modify math symbol (cdlatex-mode)          ` / '
-
-================================================================================
-Exporting and Publishing
-================================================================================
-
-Exporting creates files with extensions .txt and .html in the current
-directory.  Publishing puts the resulting file into some other place.
-
-export/publish dispatcher                         C-c C-e
-export visible part only                          C-c C-e v
-insert template of export options                 C-c C-x t
-toggle fixed width for entry or region            C-c :
-
---------------------------------------------------------------------------------
-Comments: Text not being exported
---------------------------------------------------------------------------------
-
-Text before the first headline is not considered part of the document and is
-therefore never exported.  Lines starting with # are comments and are not
-exported.  Subtrees whose header starts with COMMENT are never exported.
-
-toggle COMMENT keyword on entry                   C-c ;
-
-================================================================================
-Dynamic Blocks
-================================================================================
-
-update dynamic block at point                     C-c C-x C-u
-update all dynamic blocks                         C-u C-c C-x C-u
-
-================================================================================
-Notes
-================================================================================
-
-[1] This is only a suggestion for a binding of this command.  Choose you own
-key as shown under INSTALLATION.
-
-[2] After changing a #+KEYWORD or <<<target>>> line, press C-c C-c with the
-cursor still in the line to update.
-
-[3] Keybinding affected by org-CUA-compatibility.