##// END OF EJS Templates
Added keyboard shortcuts docs
klonuo -
Show More
@@ -0,0 +1,83 b''
1 from os.path import abspath, dirname, join
2
3 from IPython.terminal.interactiveshell import KeyBindingManager
4
5
6 def name(c):
7 s = c.__class__.__name__
8 return log_filters[s] if s in log_filters.keys() else s
9
10
11 def sentencize(s):
12 """Extract first sentence
13 """
14 s = s.replace('\n', ' ').strip().split('.')
15 s = s[0] if len(s) else s
16 try:
17 return " ".join(s.split())
18 except AttributeError:
19 return s
20
21
22 def most_common(lst, n=3):
23 """Most common elements occurring more then `n` times
24 """
25 from collections import Counter
26
27 c = Counter(lst)
28 return [k for (k, v) in c.items() if k and v > n]
29
30
31 def multi_filter_str(flt):
32 """Yield readable conditional filter
33 """
34 assert hasattr(flt, 'filters'), 'Conditional filter required'
35
36 yield name(flt)
37 for subfilter in flt.filters:
38 yield name(subfilter)
39 if hasattr(subfilter, 'filter'):
40 yield name(subfilter.filter)
41
42
43 log_filters = dict(_AndList='(And)', _OrList='(Or)', _Invert='(Inv)')
44
45 kbm = KeyBindingManager.for_prompt()
46 ipy_bindings = kbm.registry.key_bindings
47
48 dummy_docs = [] # ignore bindings without proper documentation
49
50 common_docs = most_common([kb.handler.__doc__ for kb in ipy_bindings])
51 if common_docs:
52 dummy_docs.extend(common_docs)
53
54 dummy_docs = list(set(dummy_docs))
55
56 single_filter = dict()
57 multi_filter = dict()
58 for kb in ipy_bindings:
59 doc = kb.handler.__doc__
60 if not doc or doc in dummy_docs:
61 continue
62
63 shortcut = ' '.join([k if isinstance(k, str) else k.name for k in kb.keys])
64 shortcut += shortcut.endswith('\\') and '\\' or ''
65 if hasattr(kb.filter, 'filters'):
66 flt = ' '.join(multi_filter_str(kb.filter))
67 multi_filter[(shortcut, flt)] = sentencize(doc)
68 else:
69 single_filter[(shortcut, name(kb.filter))] = sentencize(doc)
70
71
72 if __name__ == '__main__':
73
74 here = abspath(dirname(__file__))
75 dest = join(here, 'source', 'config', 'shortcuts')
76
77 with open(join(dest, 'single_filtered.csv'), 'w') as csv:
78 for k, v in sorted(single_filter.items()):
79 csv.write(':kbd:`{}`\t{}\t{}\n'.format(k[0], k[1], v))
80
81 with open(join(dest, 'multi_filtered.csv'), 'w') as csv:
82 for k, v in sorted(multi_filter.items()):
83 csv.write(':kbd:`{}`\t{}\t{}\n'.format(k[0], k[1], v))
@@ -0,0 +1,25 b''
1 =================
2 IPython shortcuts
3 =================
4
5 Available shortcut in IPython terminal.
6
7
8 Single Filtered shortcuts
9 =========================
10
11 .. csv-table::
12 :header: Shortcut,Filter,Description
13 :widths: 30, 30, 100
14 :delim: tab
15 :file: single_filtered.csv
16
17
18 Multi Filtered shortcuts
19 =========================
20
21 .. csv-table::
22 :header: Shortcut,Filter,Description
23 :widths: 30, 30, 100
24 :delim: tab
25 :file: multi_filtered.csv
@@ -1,159 +1,164 b''
1 1 # Makefile for Sphinx documentation
2 2 #
3 3
4 4 # You can set these variables from the command line.
5 5 SPHINXOPTS =
6 6 SPHINXBUILD = sphinx-build
7 7 PAPER =
8 8 SRCDIR = source
9 9 BUILDDIR = build
10 10 PYTHON = python
11 11
12 12 # Internal variables.
13 13 PAPEROPT_a4 = -D latex_paper_size=a4
14 14 PAPEROPT_letter = -D latex_paper_size=letter
15 15 ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SRCDIR)
16 16
17 17 .PHONY: help clean html web pickle htmlhelp latex changes linkcheck api
18 18
19 19 default: html
20 20
21 21 help:
22 22 @echo "Please use \`make <target>' where <target> is one of"
23 23 @echo " html standalone HTML files"
24 24 @echo " html_noapi same as above, without the time consuming API docs"
25 25 @echo " pickle pickle files (usable by e.g. sphinx-web)"
26 26 @echo " htmlhelp HTML files and a HTML help project"
27 27 @echo " latex LaTeX files, you can set PAPER=a4 or PAPER=letter"
28 28 @echo " texinfo Texinfo files"
29 29 @echo " info Texinfo files and run them through makeinfo"
30 30 @echo " changes an overview over all changed/added/deprecated items"
31 31 @echo " linkcheck check all external links for integrity (takes a long time)"
32 32 @echo " gh-pages clone IPython docs in ./gh-pages/ , build doc, autocommit"
33 33 @echo
34 34 @echo "Compound utility targets:"
35 35 @echo "pdf latex and then runs the PDF generation"
36 36 @echo "all html and pdf"
37 37 @echo "dist all, and then puts the results in dist/"
38 38
39 39 clean_api:
40 40 -rm -rf $(SRCDIR)/api/generated
41 41
42 42 clean: clean_api
43 43 -rm -rf build/* dist/*
44 44 -rm -f $(SRCDIR)/config/options/config-generated.txt
45 -rm -f $(SRCDIR)/config/shortcuts/*.csv
45 46 -rm -f $(SRCDIR)/interactive/magics-generated.txt
46 47
47 48 pdf: latex
48 49 cd build/latex && make all-pdf
49 50
50 51 all: html pdf
51 52
52 53 # For final distribution, only build HTML (our pdf is now so large as to be
53 54 # unusable, takes forever to build and just bloats the downloads). We leave
54 55 # them hardlinked at the top-level so users find them easily, though the
55 56 # original build/html dir is left in-place (useful to reload builds while
56 57 # testing).
57 58 dist: html
58 59 rm -rf html
59 60 cp -al build/html .
60 61 @echo "Build finished. Final docs are in html/"
61 62
62 html: api autoconfig automagic
63 html_noapi: clean_api autoconfig automagic
63 html: api autoconfig automagic autogen_shortcuts
64 html_noapi: clean_api autoconfig automagic autogen_shortcuts
64 65
65 66 html html_noapi:
66 67 mkdir -p build/html build/doctrees
67 68 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html
68 69 @echo
69 70 @echo "Build finished. The HTML pages are in build/html."
70 71
71 72 automagic: source/interactive/magics-generated.txt
72 73
73 74 source/interactive/magics-generated.txt: autogen_magics.py
74 75 $(PYTHON) autogen_magics.py
75 76 @echo "Created docs for line & cell magics"
76 77
77 78 autoconfig: source/config/options/config-generated.txt
78 79
79 source/config/options/generated:
80 source/config/options/config-generated.txt:
80 81 $(PYTHON) autogen_config.py
81 82 @echo "Created docs for config options"
82 83
83 84 api: source/api/generated/gen.txt
84 85
85 86 source/api/generated/gen.txt:
86 87 $(PYTHON) autogen_api.py
87 88 @echo "Build API docs finished."
88 89
90 autogen_shortcuts:
91 $(PYTHON) autogen_shortcuts.py
92 @echo "Created docs for shortcuts"
93
89 94 pickle:
90 95 mkdir -p build/pickle build/doctrees
91 96 $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle
92 97 @echo
93 98 @echo "Build finished; now you can process the pickle files or run"
94 99 @echo " sphinx-web build/pickle"
95 100 @echo "to start the sphinx-web server."
96 101
97 102 web: pickle
98 103
99 104 htmlhelp:
100 105 mkdir -p build/htmlhelp build/doctrees
101 106 $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp
102 107 @echo
103 108 @echo "Build finished; now you can run HTML Help Workshop with the" \
104 109 ".hhp project file in build/htmlhelp."
105 110
106 111 qthelp:
107 112 mkdir -p build/qthelp
108 113 $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) build/qthelp
109 114 @echo
110 115 @echo "Build finished; now you can run "qcollectiongenerator" with the" \
111 116 ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
112 117 @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/IPython.qhcp"
113 118 @echo "To view the help file:"
114 119 @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/IPython.qhc"
115 120
116 121 latex: api autoconfig
117 122 mkdir -p build/latex build/doctrees
118 123 $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex
119 124 @echo
120 125 @echo "Build finished; the LaTeX files are in build/latex."
121 126 @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
122 127 "run these through (pdf)latex."
123 128
124 129 changes:
125 130 mkdir -p build/changes build/doctrees
126 131 $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes
127 132 @echo
128 133 @echo "The overview file is in build/changes."
129 134
130 135 linkcheck:
131 136 mkdir -p build/linkcheck build/doctrees
132 137 $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck
133 138 @echo
134 139 @echo "Link check complete; look for any errors in the above output " \
135 140 "or in build/linkcheck/output.rst."
136 141
137 142 nightly: dist
138 143 rsync -avH --delete dist/ ipython:www/doc/nightly
139 144
140 145 gh-pages: clean html
141 146 # if VERSION is unspecified, it will be dev
142 147 # For releases, VERSION should be just the major version,
143 148 # e.g. VERSION=2 make gh-pages
144 149 $(PYTHON) gh-pages.py $(VERSION)
145 150
146 151 texinfo:
147 152 mkdir -p $(BUILDDIR)/texinfo
148 153 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
149 154 @echo
150 155 @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
151 156 @echo "Run \`make' in that directory to run these through makeinfo" \
152 157 "(use \`make info' here to do that automatically)."
153 158
154 159 info:
155 160 mkdir -p $(BUILDDIR)/texinfo
156 161 $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
157 162 @echo "Running Texinfo files through makeinfo..."
158 163 make -C $(BUILDDIR)/texinfo info
159 164 @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
@@ -1,82 +1,83 b''
1 1 @ECHO OFF
2 2 REM ~ Windows command line make file for Sphinx documentation
3 3
4 4 SETLOCAL
5 5
6 6 SET SPHINXOPTS=
7 7 SET SPHINXBUILD=sphinx-build
8 8 SET PAPER=
9 9 SET SRCDIR=source
10 10 SET PYTHON=python
11 11
12 12 IF "%PAPER%" == "" SET PAPER=a4
13 13 SET ALLSPHINXOPTS=-d build\doctrees -D latex_paper_size=%PAPER% %SPHINXOPTS% %SRCDIR%
14 14
15 15 FOR %%X IN (%SPHINXBUILD%.exe) DO SET P=%%~$PATH:X
16 16
17 17 FOR %%L IN (html html_noapi pickle htmlhelp latex changes linkcheck) DO (
18 18 IF "%1" == "%%L" (
19 19 IF "%P%" == "" (
20 20 ECHO.
21 21 ECHO Error: Sphinx is not available. Please make sure it is correctly installed.
22 22 GOTO END
23 23 )
24 24 MD build\doctrees 2>NUL
25 25 MD build\%1 || GOTO DIR_EXIST
26 26 %PYTHON% autogen_config.py && ECHO Created docs for config options
27 27 %PYTHON% autogen_magics.py && ECHO Created docs for line ^& cell magics
28 %PYTHON% autogen_shortcuts.py && ECHO Created docs for shortcuts
28 29 IF NOT "%1" == "html_noapi" (
29 30 %PYTHON% autogen_api.py && ECHO Build API docs finished
30 31 %SPHINXBUILD% -b %1 %ALLSPHINXOPTS% build\%1
31 32 ) ELSE (
32 33 %SPHINXBUILD% -b html %ALLSPHINXOPTS% build\%1
33 34 )
34 35 IF NOT ERRORLEVEL 0 GOTO ERROR
35 36 ECHO.
36 37 ECHO Build finished. Results are in build\%1.
37 38 IF "%1" == "pickle" (
38 39 ECHO Now you can process the pickle files or run
39 40 ECHO sphinx-web build\pickle to start the sphinx-web server.
40 41 )
41 42 IF "%1" == "htmlhelp" (
42 43 ECHO Now you can run HTML Help Workshop with the
43 44 ECHO .hhp project file in build/htmlhelp.
44 45 )
45 46 IF "%1" == "linkcheck" (
46 47 ECHO Look for any errors in the above output
47 48 ECHO or in build\linkcheck\output.rst.
48 49 )
49 50 GOTO END
50 51 )
51 52 )
52 53
53 54
54 55 IF "%1" == "clean" (
55 56 RD /s /q build dist %SRCDIR%\api\generated 2>NUL
56 57 IF ERRORLEVEL 0 ECHO Build environment cleaned!
57 58 GOTO END
58 59 )
59 60
60 61 ECHO.
61 62 ECHO Please use "make [target]" where [target] is one of:
62 63 ECHO.
63 64 ECHO html to make standalone HTML files
64 65 ECHO html_noapi same as above, without the time consuming API docs
65 66 ECHO jsapi to make standalone HTML files for the Javascript API
66 67 ECHO pickle to make pickle files (usable by e.g. sphinx-web)
67 68 ECHO htmlhelp to make HTML files and a HTML help project
68 69 ECHO latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
69 70 ECHO changes to make an overview over all changed/added/deprecated items
70 71 ECHO linkcheck to check all external links for integrity
71 72 GOTO END
72 73
73 74 :DIR_EXIST
74 75 ECHO.
75 76 ECHO Info: Run "make clean" to clean build environment
76 77
77 78 :ERROR
78 79 ECHO.
79 80 ECHO Error: Build process failed!
80 81
81 82 :END
82 83 ENDLOCAL No newline at end of file
1 NO CONTENT: modified file chmod 100644 => 100755
@@ -1,33 +1,34 b''
1 1 .. _config_index:
2 2
3 3 ===============================
4 4 Configuration and customization
5 5 ===============================
6 6
7 7 Configuring IPython
8 8 -------------------
9 9
10 10 .. toctree::
11 11 :maxdepth: 2
12 12
13 13 intro
14 14 options/index
15 shortcuts/index
15 16 details
16 17
17 18 .. seealso::
18 19
19 20 :doc:`/development/config`
20 21 Technical details of the config system.
21 22
22 23 Extending and integrating with IPython
23 24 --------------------------------------
24 25
25 26 .. toctree::
26 27 :maxdepth: 2
27 28
28 29 extensions/index
29 30 integrating
30 31 custommagics
31 32 inputtransforms
32 33 callbacks
33 34 eventloops
General Comments 0
You need to be logged in to leave comments. Login now