Skip to content

Commit c08937b

Browse files
committed
Fix chains with literal and regex patterns (#435)
1 parent 74f0ce1 commit c08937b

File tree

13 files changed

+32
-58
lines changed

13 files changed

+32
-58
lines changed

.pyspelling.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ matrix:
2222
- 'code, pre, span.keys'
2323
- '.magiclink-compare, .magiclink-commit, .magiclink-repository, .md-footer-social__link'
2424
- '.MathJax_Preview, .md-nav__link, .md-footer-custom-text, .md-source__repository, .headerlink, .md-icon'
25-
- '.md-footer-social__link'
25+
- '.md-social__link'
2626
- pyspelling.filters.url:
2727

2828
- name: markdown

docs/src/markdown/about/changelog.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 4.16.4
4+
5+
- **FIX**: When chaining literal and regular expression patterns together, the mode could get stuck in literal mode
6+
when applying replacements.
7+
38
## 4.16.3
49

510
- **FIX**: Use latest `wcmatch` (8.1) which does a better job at bailing out of really large expansions. Patterns

rummage/lib/__meta__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def parse_version(ver):
189189

190190

191191
# (major, minor, micro, release type, pre-release build, post-release build, development-release)
192-
__version_info__ = Version(4, 16, 3, 'final')
192+
__version_info__ = Version(4, 16, 4, 'final')
193193
__version__ = __version_info__._get_canonical()
194194
__app__ = "Rummage"
195195
__status__ = __version_info__[3]

rummage/lib/gui/data/docs/.dochash

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6e1ca51903754d2bcb30ca487e913551
1+
e86be5b6022c3447a3b600c653dd9816

rummage/lib/gui/data/docs/404.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<title>Rummage</title>
1010

1111
<!-- Theme CSS -->
12-
<link rel="stylesheet" href="css/theme.css">
12+
<link rel="stylesheet" href="/css/theme.css">
1313

1414
<!-- Extra CSS -->
1515
</style>

rummage/lib/gui/data/docs/about/changelog.html

+9-4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525

2626
<!-- Table of Content (Don't show for static sites) -->
2727
<h1 id="changelog">Changelog</h1>
28+
<h2 id="4164">4.16.4</h2>
29+
<ul>
30+
<li><strong>FIX</strong>: When chaining literal and regular expression patterns together, the mode could get stuck in literal mode
31+
when applying replacements.</li>
32+
</ul>
2833
<h2 id="4163">4.16.3</h2>
2934
<ul>
3035
<li><strong>FIX</strong>: Use latest <code>wcmatch</code> (8.1) which does a better job at bailing out of really large expansions. Patterns
@@ -312,7 +317,7 @@ <h2 id="406">4.0.6</h2>
312317
</ul>
313318
<h2 id="405">4.0.5</h2>
314319
<ul>
315-
<li><strong>FIX</strong>: Single instance handling regression <a class="magiclink magiclink-github magiclink-issue" href="https://github.com/facelessuser/Rummage/issues/217" title="GitHub Issue: facelessuser/Rummage#217">#217</a>.</li>
320+
<li><strong>FIX</strong>: Single instance handling regression <a class="magiclink magiclink-github magiclink-issue" href="https://github.com/facelessuser/Rummage/issues/217" title="GitHub Issue: facelessuser/Rummage #217">#217</a>.</li>
316321
</ul>
317322
<h2 id="404">4.0.4</h2>
318323
<ul>
@@ -372,7 +377,7 @@ <h2 id="37">3.7</h2>
372377
<li><strong>FIX</strong>: Update requests should use <code>https</code>.</li>
373378
<li><strong>FIX</strong>: Update localization.</li>
374379
<li><strong>FIX</strong>: Fixes to Windows notifications.</li>
375-
<li><strong>FIX</strong>: Single instance handling regression <a class="magiclink magiclink-github magiclink-issue" href="https://github.com/facelessuser/Rummage/issues/217" title="GitHub Issue: facelessuser/Rummage#217">#217</a>.</li>
380+
<li><strong>FIX</strong>: Single instance handling regression <a class="magiclink magiclink-github magiclink-issue" href="https://github.com/facelessuser/Rummage/issues/217" title="GitHub Issue: facelessuser/Rummage #217">#217</a>.</li>
376381
<li><strong>FIX</strong>: Require Backrefs 3.5.0 which includes fixes for: pattern caching, named Unicode bug. Also adds better format
377382
string replace with the added ability to use format string align and fill.</li>
378383
<li><strong>FIX</strong>: Don't escape curly brackets in format strings just because they are string escaped when preprocessing Regex
@@ -401,7 +406,7 @@ <h2 id="36">3.6</h2>
401406
<li><strong>FIX</strong>: Wildcard patterns not allowing character tokens such as <code>\x70</code>, <code>\u0070</code>, <code>\N{unicode name}</code>, <code>\160</code>, and
402407
standard escapes like <code>\t</code> etc.</li>
403408
<li><strong>FIX</strong>: Incorrect documentation on wildcard patterns.</li>
404-
<li><strong>FIX</strong>: Python 2.7 not translating Unicode escapes <a class="magiclink magiclink-github magiclink-issue" href="https://github.com/facelessuser/Rummage/issues/196" title="GitHub Issue: facelessuser/Rummage#196">#196</a>.</li>
409+
<li><strong>FIX</strong>: Python 2.7 not translating Unicode escapes <a class="magiclink magiclink-github magiclink-issue" href="https://github.com/facelessuser/Rummage/issues/196" title="GitHub Issue: facelessuser/Rummage #196">#196</a>.</li>
405410
<li><strong>FIX</strong>: Require Backrefs 3.1.2. Some bug fixes, but notably, Backrefs switched from using <code>\&lt;</code> and <code>\&gt;</code> for start and
406411
end word boundaries to <code>\m</code> and <code>\M</code>. This is because of an oversight as Python versions less than 3.7 would escape
407412
<code>&lt;</code> and <code>&gt;</code> in <code>re.escpae</code> (even though it is unnecessary). Also some Unicode table generation fixes.</li>
@@ -465,7 +470,7 @@ <h2 id="321">3.2.1</h2>
465470
</ul>
466471
<h2 id="320">3.2.0</h2>
467472
<ul>
468-
<li><strong>NEW</strong>: Results update live. Progress has been removed. (<a class="magiclink magiclink-github magiclink-issue" href="https://github.com/facelessuser/Rummage/issues/140" title="GitHub Issue: facelessuser/Rummage#140">#140</a>)</li>
473+
<li><strong>NEW</strong>: Results update live. Progress has been removed. (<a class="magiclink magiclink-github magiclink-issue" href="https://github.com/facelessuser/Rummage/issues/140" title="GitHub Issue: facelessuser/Rummage #140">#140</a>)</li>
469474
<li><strong>FIX</strong>: Windows status bar flicker.</li>
470475
<li><strong>FIX</strong>: Results not showing when notifications is set to only play audio alerts.</li>
471476
</ul>

rummage/lib/gui/data/docs/about/contributing.html

+2-4
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ <h2 id="overview">Overview</h2>
7979
<li>Code patches via pull requests.</li>
8080
<li>Documentation improvements via pull requests.</li>
8181
</ul>
82-
<h2 id="become-a-sponsor">Become a Sponsor <span class="twemoji heart-throb"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M7.655 14.916L8 14.25l.345.666a.752.752 0 01-.69 0zm0 0L8 14.25l.345.666.002-.001.006-.003.018-.01a7.643 7.643 0 00.31-.17 22.08 22.08 0 003.433-2.414C13.956 10.731 16 8.35 16 5.5 16 2.836 13.914 1 11.75 1 10.203 1 8.847 1.802 8 3.02 7.153 1.802 5.797 1 4.25 1 2.086 1 0 2.836 0 5.5c0 2.85 2.045 5.231 3.885 6.818a22.075 22.075 0 003.744 2.584l.018.01.006.003h.002z"/></svg></span></h2>
82+
<h2 id="become-a-sponsor">Become a Sponsor <span class="twemoji heart-throb"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M7.655 14.916 8 14.25l.345.666a.752.752 0 0 1-.69 0zm0 0L8 14.25l.345.666.002-.001.006-.003.018-.01a7.643 7.643 0 0 0 .31-.17 22.08 22.08 0 0 0 3.433-2.414C13.956 10.731 16 8.35 16 5.5 16 2.836 13.914 1 11.75 1 10.203 1 8.847 1.802 8 3.02 7.153 1.802 5.797 1 4.25 1 2.086 1 0 2.836 0 5.5c0 2.85 2.045 5.231 3.885 6.818a22.075 22.075 0 0 0 3.744 2.584l.018.01.006.003h.002z"/></svg></span></h2>
8383
<p>Open source projects take time and money. Help support the project by becoming a sponsor. You can add your support at
8484
any tier you feel comfortable with. No amount is too little.</p>
85-
<p><span class="twemoji"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg></span> <a href="https://github.com/sponsors/facelessuser">GitHub Sponsors </a></p>
85+
<p><span class="twemoji"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg></span> <a href="https://github.com/sponsors/facelessuser">GitHub Sponsors </a></p>
8686
<p>If you'd like to do a one time contribution, you can do so via PayPal.</p>
8787
<p><span class="twemoji"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M111.4 295.9c-3.5 19.2-17.4 108.7-21.5 134-.3 1.8-1 2.5-3 2.5H12.3c-7.6 0-13.1-6.6-12.1-13.9L58.8 46.6c1.5-9.6 10.1-16.9 20-16.9 152.3 0 165.1-3.7 204 11.4 60.1 23.3 65.6 79.5 44 140.3-21.5 62.6-72.5 89.5-140.1 90.3-43.4.7-69.5-7-75.3 24.2zM357.1 152c-1.8-1.3-2.5-1.8-3 1.3-2 11.4-5.1 22.5-8.8 33.6-39.9 113.8-150.5 103.9-204.5 103.9-6.1 0-10.1 3.3-10.9 9.4-22.6 140.4-27.1 169.7-27.1 169.7-1 7.1 3.5 12.9 10.6 12.9h63.5c8.6 0 15.7-6.3 17.4-14.9.7-5.4-1.1 6.1 14.4-91.3 4.6-22 14.3-19.7 29.3-19.7 71 0 126.4-28.8 142.9-112.3 6.5-34.8 4.6-71.4-23.8-92.6z"/></svg></span> <a href="https://www.paypal.me/facelessuser">PayPal</a></p>
8888
<h2 id="bug-reports">Bug Reports</h2>
@@ -131,13 +131,11 @@ <h3 id="running-validation-tests">Running Validation Tests</h3>
131131
<p>Make sure that Tox is installed:</p>
132132
<div class="highlight"><pre><span></span><code>pip install tox
133133
</code></pre></div>
134-
135134
</li>
136135
<li>
137136
<p>Run Tox:</p>
138137
<div class="highlight"><pre><span></span><code>tox
139138
</code></pre></div>
140-
141139
<p>Tox should install necessary dependencies and run the tests. If you are a Linux user, please check out information
142140
on <a href="../installation.html#requirements">requirements</a>.</p>
143141
</li>

rummage/lib/gui/data/docs/extras.html

+1-14
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ <h3 id="macos">macOS</h3>
106106
<p>Content of script:</p>
107107
<div class="highlight"><pre><span></span><code><span class="o">(</span>/Library/Frameworks/Python.framework/Versions/3.6/bin/rummage --path <span class="s2">&quot;</span><span class="nv">$1</span><span class="s2">&quot;</span><span class="o">)</span>&gt;/dev/null <span class="m">2</span>&gt;<span class="p">&amp;</span><span class="m">1</span> <span class="p">&amp;</span>
108108
</code></pre></div>
109-
110109
<p>This is just an example. You will need to determine the location of your Python install.</p>
111110
</li>
112111
</ul>
@@ -137,7 +136,6 @@ <h3 id="windows">Windows</h3>
137136
<span class="k">[HKEY_CLASSES_ROOT\*\shell\Rummage Here...\command]</span>
138137
<span class="na">@</span><span class="o">=</span><span class="s">&quot;&lt;python_install_path&gt;\\Scripts\\rummage.exe --path \&quot;%1\&quot;&quot;</span>
139138
</code></pre></div>
140-
141139
<p>Optionally, you can also include the Rummage icon beside your context menu entry by adding a few additional lines:</p>
142140
<div class="highlight"><pre><span></span><code><span class="na">Windows Registry Editor Version 5.00</span>
143141

@@ -155,7 +153,6 @@ <h3 id="windows">Windows</h3>
155153
<span class="k">[HKEY_CLASSES_ROOT\*\shell\Rummage Here...\command]</span>
156154
<span class="na">@</span><span class="o">=</span><span class="s">&quot;&lt;python_install_path&gt;\\Scripts\\rummage.exe --path \&quot;%1\&quot;&quot;</span>
157155
</code></pre></div>
158-
159156
</li>
160157
<li>
161158
<p>Save file.</p>
@@ -181,7 +178,6 @@ <h4 id="ubuntu-nautilus-gnome">Ubuntu Nautilus (Gnome)</h4>
181178
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">paths</span><span class="p">):</span>
182179
<span class="n">subprocess</span><span class="o">.</span><span class="n">Popen</span><span class="p">([</span><span class="n">RUMMAGE_PATH</span><span class="p">,</span> <span class="s2">&quot;--path&quot;</span><span class="p">,</span> <span class="n">paths</span><span class="p">[</span><span class="mi">0</span><span class="p">]])</span>
183180
</code></pre></div>
184-
185181
</li>
186182
<li>
187183
<p>Restart of Nautilus may or may not be needed, but context menu item should appear under <code>Scripts</code> and should work on files and folders.</p>
@@ -195,7 +191,6 @@ <h4 id="ubuntu-dolphin-kde">Ubuntu Dolphin (KDE)</h4>
195191
<div class="highlight"><pre><span></span><code>facelessuser@facelessuser:~$ kf5-config --path services
196192
/home/facelessuser/.local/share/kservices5/:/usr/share/kservices5/
197193
</code></pre></div>
198-
199194
</li>
200195
<li>
201196
<p>Next create your <code>.desktop</code> file in one of these locations creating the necessary folder(s) if needed. In this example, the file will be created at <code>~/.local/share/kservices5/ServiceMenus/rummage.desktoop</code>.</p>
@@ -213,13 +208,11 @@ <h4 id="ubuntu-dolphin-kde">Ubuntu Dolphin (KDE)</h4>
213208
<span class="na">Icon</span><span class="o">=</span><span class="s">/usr/local/lib/python3.5/dist-packages/rummage/lib/gui/data/rummage_1024.png</span>
214209
<span class="na">Exec</span><span class="o">=</span><span class="s">rummage --path &quot;%f&quot;</span>
215210
</code></pre></div>
216-
217211
</li>
218212
<li>
219213
<p>Lastly we rebuild and refresh the desktop entries:</p>
220-
<div class="highlight"><pre><span></span><code><span class="gp">facelessuser@facelessuser:~$</span> kbuildsycoca5
214+
<div class="highlight"><pre><span></span><code><span class="gp">facelessuser@facelessuser:~$ </span>kbuildsycoca5
221215
</code></pre></div>
222-
223216
</li>
224217
<li>
225218
<p>Close all Dolphin windows and reopen to see your context menu item. It should be found under <code>Actions</code>.</p>
@@ -252,36 +245,30 @@ <h3 id="editing-existing-translations">Editing Existing Translations</h3>
252245
<div class="highlight"><pre><span></span><code>msgid &quot;About&quot;
253246
msgstr &quot;&lt;my_translation&gt;&quot;
254247
</code></pre></div>
255-
256248
<h3 id="generate-new-template-from-source">Generate New Template from Source</h3>
257249
<p>In the Python source, you'll notice that translatable strings are represented as <code>_("some text")</code>. <code>_</code> is the function that retrieves the proper translations. In order to provide translations, we have to build up a template of all of these strings in a <code>.pot</code> file. This is done by running:</p>
258250
<div class="highlight"><pre><span></span><code>python setup.py extract_messages
259251
</code></pre></div>
260-
261252
<p>This will scan the Python source and generate a template at <code>rummage/lib/gui/localization/locale/rummage.pot</code>.</p>
262253
<p>If you update the source in a way that requires generating a new <code>.pot</code> file, then you will most likely need to update existing <code>.po</code> files as well. See <a href="#update-translation-files">Update Translation Files</a> to see how.</p>
263254
<p>See Babel's documentation on <a href="http://babel.pocoo.org/en/latest/setup.html#extract-messages"><code>extract_messages</code></a> for more info.</p>
264255
<h3 id="update-translation-files">Update Translation Files</h3>
265256
<p>When new strings are added in the source, or strings are changed, you will need to re-generate the <code>.pot</code> file and then update the <code>.po</code> files. This should update all <code>.po</code> files.</p>
266257
<div class="highlight"><pre><span></span><code>python setup.py update_catalog
267258
</code></pre></div>
268-
269259
<p>If you need to only update a specific <code>.po</code> file:</p>
270260
<div class="highlight"><pre><span></span><code>python setup.py update_catalog -l en_US
271261
</code></pre></div>
272-
273262
<p>See Babel's documentation on <a href="http://babel.pocoo.org/en/latest/setup.html#update-catalog"><code>update_catalog</code></a> for more info.</p>
274263
<h3 id="create-new-translations">Create New Translations</h3>
275264
<p>To create a translation <code>.po</code> file to edit, all you need to do is run the command below specifying your locale. The command should create a <code>.po</code> file to edit and the associated directory structure.</p>
276265
<div class="highlight"><pre><span></span><code>python setup.py init_catalog -l en_US
277266
</code></pre></div>
278-
279267
<p>See Babel's documentation on <a href="http://babel.pocoo.org/en/latest/setup.html#init-catalog"><code>init_catalog</code></a> for more info.</p>
280268
<h3 id="build-translations">Build Translations</h3>
281269
<p>Building translations is also pretty easy:</p>
282270
<div class="highlight"><pre><span></span><code>python setup.py compile_catalog
283271
</code></pre></div>
284-
285272
<p>This should build <code>.mo</code> files for all languages. See Babel's documentation on <a href="http://babel.pocoo.org/en/latest/setup.html#compile-catalog"><code>compile_catalog</code></a> for more info.</p>
286273
</div>
287274

0 commit comments

Comments
 (0)