Merge lp:~vr123456/leo-editor/detect_urls into lp:leo-editor/old-trunk

Proposed by Viktor Ransmayr
Status: Merged
Merged at revision: not available
Proposed branch: lp:~vr123456/leo-editor/detect_urls
Merge into: lp:leo-editor/old-trunk
Diff against target: 162 lines (+45/-20)
2 files modified
leo/plugins/detect_urls.py (+34/-9)
leo/plugins/leoPluginsRef.leo (+11/-11)
To merge this branch: bzr merge lp:~vr123456/leo-editor/detect_urls
Reviewer Review Type Date Requested Status
The Leo editor team Pending
Review via email: mp+17100@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Viktor Ransmayr (vr123456) wrote :

I have made one more improvement, that I think is important.

I have introduced an explicit 'init' function, so that info
about the plugin is published, when the cmd 'print-plugins-info'
is executed.

I have used the style found in plugin 'maximizeNewWindows.py'.

Please check especially the section << version history >>
and my 'version' choice. - I do not know if there is any
established convention, that I should follow ...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'leo/plugins/detect_urls.py'
--- leo/plugins/detect_urls.py 2010-01-09 13:50:47 +0000
+++ leo/plugins/detect_urls.py 2010-01-10 15:58:16 +0000
@@ -3,8 +3,7 @@
3#@<< docstring >>3#@<< docstring >>
4#@+node:vpe.20060426084738:<< docstring >>4#@+node:vpe.20060426084738:<< docstring >>
5"""5"""
6Colorizes URLs everywhere in node's body on node selection6Colorizes URLs everywhere in node's body on node selection or saving.
7or saving.
87
9Double click on any URL launches it in default browser.8Double click on any URL launches it in default browser.
109
@@ -16,13 +15,45 @@
16#@nl15#@nl
17#@@language python16#@@language python
18#@@tabwidth -417#@@tabwidth -4
18
19__version__ = "0.3"
20#@<< version history >>
21#@+node:RV20090910.20100110154407.7439:<< version history >>
22#@+at
23#
24# Originally written by ???
25#
26# 0.1 ???: Initial version.
27#
28# 0.2 VR: Detect URLs with protocol type 'file' and detect a new URL also
29# after a save operation.
30#
31# 0.3 VR: Display info about this plugin, when executing cmd
32# 'print-plugins-info'.
33#@-at
34#@-node:RV20090910.20100110154407.7439:<< version history >>
35#@nl
36#@<< imports >>
37#@+node:RV20090910.20100110154407.7437:<< imports >>
19import leo.core.leoGlobals as g38import leo.core.leoGlobals as g
20import leo.core.leoPlugins as leoPlugins39import leo.core.leoPlugins as leoPlugins
21import re40import re
22#VR20100108: url_regex = re.compile(r"""(http|https|ftp)://[^\s'"]+[\w=/]""")41#@-node:RV20090910.20100110154407.7437:<< imports >>
42#@nl
43
23url_regex = re.compile(r"""(http|https|file|ftp)://[^\s'"]+[\w=/]""")44url_regex = re.compile(r"""(http|https|file|ftp)://[^\s'"]+[\w=/]""")
2445
25#@+others46#@+others
47#@+node:RV20090910.20100110154407.7438:init()
48def init():
49 ok = not g.app.unitTesting
50 if ok:
51 leoPlugins.registerHandler("bodydclick1", openURL)
52 leoPlugins.registerHandler("select2", colorizeURLs)
53 leoPlugins.registerHandler("save2", colorizeURLs)
54 g.plugin_signon(__name__)
55 return ok
56#@-node:RV20090910.20100110154407.7438:init()
26#@+node:vpe.20060305064323.5:openURL()57#@+node:vpe.20060305064323.5:openURL()
27def openURL(tag,keywords):58def openURL(tag,keywords):
28 c = keywords.get("c")59 c = keywords.get("c")
@@ -69,11 +100,5 @@
69 n += len(line) + 1100 n += len(line) + 1
70#@-node:vpe.20060426062042:colorizeURLs()101#@-node:vpe.20060426062042:colorizeURLs()
71#@-others102#@-others
72
73if 1:
74 leoPlugins.registerHandler("bodydclick1", openURL)
75 leoPlugins.registerHandler("select2", colorizeURLs)
76 leoPlugins.registerHandler("save2", colorizeURLs) #VR20100108
77 g.plugin_signon(__name__)
78#@-node:ekr.20060506070443.1:@thin detect_urls.py103#@-node:ekr.20060506070443.1:@thin detect_urls.py
79#@-leo104#@-leo
80105
=== modified file 'leo/plugins/leoPluginsRef.leo'
--- leo/plugins/leoPluginsRef.leo 2010-01-09 19:51:52 +0000
+++ leo/plugins/leoPluginsRef.leo 2010-01-10 15:58:16 +0000
@@ -3,7 +3,7 @@
3<leo_file>3<leo_file>
4<leo_header file_format="2" tnodes="0" max_tnode_index="0" clone_windows="0"/>4<leo_header file_format="2" tnodes="0" max_tnode_index="0" clone_windows="0"/>
5<globals body_outline_ratio="0.5">5<globals body_outline_ratio="0.5">
6 <global_window_position top="48" left="25" height="692" width="996"/>6 <global_window_position top="48" left="10" height="692" width="1024"/>
7 <global_log_window_position top="0" left="0" height="0" width="0"/>7 <global_log_window_position top="0" left="0" height="0" width="0"/>
8</globals>8</globals>
9<preferences/>9<preferences/>
@@ -32,9 +32,9 @@
32<v t="ekr.20090430075506.4"><vh>Notes &amp; to-do</vh>32<v t="ekr.20090430075506.4"><vh>Notes &amp; to-do</vh>
33<v t="ekr.20090430075506.3"><vh>@thin leoPluginNotes.txt</vh></v>33<v t="ekr.20090430075506.3"><vh>@thin leoPluginNotes.txt</vh></v>
34</v>34</v>
35<v t="edream.110203113231.618"><vh>Plugins</vh>35<v t="edream.110203113231.618" a="E"><vh>Plugins</vh>
36<v t="EKR.20040517090508"><vh> Enable plugins using @enabled-plugins nodes</vh></v>36<v t="EKR.20040517090508"><vh> Enable plugins using @enabled-plugins nodes</vh></v>
37<v t="ekr.20050303051035"><vh> Templates: these show recommended ways of defining plugins.</vh>37<v t="ekr.20050303051035" a="E"><vh> Templates: these show recommended ways of defining plugins.</vh>
38<v t="ekr.20041114102139"><vh>Notes</vh>38<v t="ekr.20041114102139"><vh>Notes</vh>
39<v t="ekr.20041114103913"><vh>About comments in the style guide</vh></v>39<v t="ekr.20041114103913"><vh>About comments in the style guide</vh></v>
40<v t="ekr.20041114102139.1"><vh>About the root node</vh></v>40<v t="ekr.20041114102139.1"><vh>About the root node</vh></v>
@@ -64,7 +64,7 @@
64<v t="ekr.20091118065749.5261"><vh>@thin ctagscompleter.py</vh></v>64<v t="ekr.20091118065749.5261"><vh>@thin ctagscompleter.py</vh></v>
65<v t="ville.20091204224145.5355"><vh>@thin codewisecompleter.py</vh></v>65<v t="ville.20091204224145.5355"><vh>@thin codewisecompleter.py</vh></v>
66</v>66</v>
67<v t="ekr.20040722135402.1"><vh>Body pane</vh>67<v t="ekr.20040722135402.1" a="E"><vh>Body pane</vh>
68<v t="edream.110403140857.8"><vh>@thin color_markup.py</vh></v>68<v t="edream.110403140857.8"><vh>@thin color_markup.py</vh></v>
69<v t="ekr.20060506070443.1"><vh>@thin detect_urls.py</vh></v>69<v t="ekr.20060506070443.1"><vh>@thin detect_urls.py</vh></v>
70<v t="edream.110203113231.753"><vh>@thin image.py</vh></v>70<v t="edream.110203113231.753"><vh>@thin image.py</vh></v>
@@ -364,7 +364,7 @@
364<v t="edream.110203113231.873"><vh>@thin at_folder.py</vh></v>364<v t="edream.110203113231.873"><vh>@thin at_folder.py</vh></v>
365<v t="ekr.20040915085351"><vh>@thin at_produce.py</vh></v>365<v t="ekr.20040915085351"><vh>@thin at_produce.py</vh></v>
366<v t="ktenney.20041211072654.1"><vh>@thin at_view.py</vh></v>366<v t="ktenney.20041211072654.1"><vh>@thin at_view.py</vh></v>
367<v t="tbrown.20091029123555.5319" descendentVnodeUnknownAttributes="7d71005803000000302e3571017d710258040000007465737471037d710458050000005f6564697471057d7106580400000074686973710758120000006f6b20686f77206120626f757420746869737108737373732e"><vh>@thin attrib_edit.py</vh></v>367<v t="tbrown.20091029123555.5319" descendentVnodeUnknownAttributes="7d71005503302e3571017d710258040000007465737471037d710458050000005f6564697471057d7106580400000074686973710758120000006f6b20686f77206120626f757420746869737108737373732e"><vh>@thin attrib_edit.py</vh></v>
368<v t="mork.20041020082242.1"><vh>@thin base64Packager.py</vh></v>368<v t="mork.20041020082242.1"><vh>@thin base64Packager.py</vh></v>
369<v t="tbrown.20070322113635"><vh>@thin bookmarks.py</vh></v>369<v t="tbrown.20070322113635"><vh>@thin bookmarks.py</vh></v>
370<v t="ekr.20060807103814.1"><vh>@thin datenodes.py</vh></v>370<v t="ekr.20060807103814.1"><vh>@thin datenodes.py</vh></v>
@@ -801,8 +801,7 @@
801</v>801</v>
802<v t="ekr.20100103093121.5329"802<v t="ekr.20100103093121.5329"
803marks="vivainio2.20091008133028.5823,vivainio2.20091008140054.14555,ville.20091008210853.7616,ville.20091023181249.5264,vivainio2.20091008133028.5825,ville.20091023181249.5266,"><vh>@thin stickynotes.py</vh></v>803marks="vivainio2.20091008133028.5823,vivainio2.20091008140054.14555,ville.20091008210853.7616,ville.20091023181249.5264,vivainio2.20091008133028.5825,ville.20091023181249.5266,"><vh>@thin stickynotes.py</vh></v>
804<v t="ekr.20100103093121.5339"804<v t="ekr.20100103093121.5339"><vh>@thin stickynotes_plus.py</vh></v>
805marks="vivainio2.20091008133028.5823,vivainio2.20091008140054.14555,ville.20091008210853.7616,ville.20091023181249.5264,vivainio2.20091008133028.5825,ville.20091023181249.5266,"><vh>@thin stickynotes_plus.py</vh></v>
806<v t="ekr.20070119094733.1"><vh>@thin dtest.py</vh></v>805<v t="ekr.20070119094733.1"><vh>@thin dtest.py</vh></v>
807</v>806</v>
808<v t="ekr.20061023142737"><vh>UNL plugin</vh>807<v t="ekr.20061023142737"><vh>UNL plugin</vh>
@@ -814,7 +813,7 @@
814</v>813</v>
815<v t="rogererens.20041013082304"><vh>@thin UNL.py</vh></v>814<v t="rogererens.20041013082304"><vh>@thin UNL.py</vh></v>
816</v>815</v>
817<v t="ekr.20040915073259"><vh>Windows</vh>816<v t="ekr.20040915073259" a="E"><vh>Windows</vh>
818<v t="tbrown.20090322083202.1"><vh>NOTE: todo.py is qt verion of cleo.py (which is tk)</vh></v>817<v t="tbrown.20090322083202.1"><vh>NOTE: todo.py is qt verion of cleo.py (which is tk)</vh></v>
819<v t="tbrown.20090119215428.2"><vh>@thin todo.py</vh></v>818<v t="tbrown.20090119215428.2"><vh>@thin todo.py</vh></v>
820<v t="ekr.20050227071948"><vh> cleo</vh>819<v t="ekr.20050227071948"><vh> cleo</vh>
@@ -861,7 +860,7 @@
861<v t="pap.20041020001240"><vh>@thin footprints.py</vh></v>860<v t="pap.20041020001240"><vh>@thin footprints.py</vh></v>
862</v>861</v>
863<v t="mork.20041018162155.1"><vh>@thin EditAttributes.py</vh></v>862<v t="mork.20041018162155.1"><vh>@thin EditAttributes.py</vh></v>
864<v t="ekr.20040915073259.1"><vh>@thin maximizeNewWindows.py</vh></v>863<v t="ekr.20040915073259.1" a="E"><vh>@thin maximizeNewWindows.py</vh></v>
865<v t="mork.20041022155742.1"><vh>@thin nodebar.py</vh></v>864<v t="mork.20041022155742.1"><vh>@thin nodebar.py</vh></v>
866<v t="edream.110203113231.924"><vh>@thin redirect_to_log.py</vh></v>865<v t="edream.110203113231.924"><vh>@thin redirect_to_log.py</vh></v>
867<v t="ekr.20040915075530"><vh>@thin UASearch.py</vh></v>866<v t="ekr.20040915075530"><vh>@thin UASearch.py</vh></v>
@@ -870,7 +869,8 @@
870<v t="ekr.20060506070443.1"></v>869<v t="ekr.20060506070443.1"></v>
871<v t="ville.20090310191936.10"><vh>@thin colorize_headlines.py</vh></v>870<v t="ville.20090310191936.10"><vh>@thin colorize_headlines.py</vh></v>
872<v t="ville.20090314215508.4"><vh>@thin quicksearch.py</vh></v>871<v t="ville.20090314215508.4"><vh>@thin quicksearch.py</vh></v>
873<v t="ville.20091008210853.5241"><vh>@thin stickynotes.py</vh></v>872<v t="ville.20091008210853.5241"
873marks="vivainio2.20091008133028.5823,vivainio2.20091008140054.14555,ville.20091008210853.7616,ville.20091023181249.5264,vivainio2.20091008133028.5825,ville.20091023181249.5266,"><vh>@thin stickynotes.py</vh></v>
874</v>874</v>
875</v>875</v>
876</vnodes>876</vnodes>
@@ -4496,7 +4496,7 @@
4496<t tx="ekr.20041114103913.1">PLEASE define each function or method in a separate node! To make this work,4496<t tx="ekr.20041114103913.1">PLEASE define each function or method in a separate node! To make this work,
4497just put @others in the root of your plugin as shown. Note that @others may be4497just put @others in the root of your plugin as shown. Note that @others may be
4498nested, as shown in class myClass.</t>4498nested, as shown in class myClass.</t>
4499<t tx="ekr.20041211035618" str_leo_pos="2"></t>4499<t tx="ekr.20041211035618" str_leo_pos="2,3,1"></t>
4500<t tx="ekr.20041231134702"># This is called from plugins_menu plugin.4500<t tx="ekr.20041231134702"># This is called from plugins_menu plugin.
45014501
4502# It should only be defined if the extension has been registered.4502# It should only be defined if the extension has been registered.

Subscribers

People subscribed via source and target branches

to status/vote changes: