Bug 330634

Summary: Python str.format positional argument specifiers can be omitted
Product: [Applications] kate Reporter: xOneca <xoneca+bugs.kde.org>
Component: syntaxAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: Git   
Target Milestone: ---   
Platform: unspecified   
OS: All   
Latest Commit: Version Fixed In:
Attachments: Patch updating tag substitution

Description xOneca 2014-02-01 15:41:39 UTC
From http://docs.python.org/2/library/string.html#format-string-syntax:
> Changed in version 2.7: The positional argument specifiers can be omitted, so '{} {}' is equivalent to '{0} {1}'.

But current syntax highlighting doesn't reflect this.

Reproducible: Always

Steps to Reproduce:
"This looks good: {0}".format("good")
"This does not look good, but should: {}".format("good?")
"This also should be ok: {:s}".format("good?")
Actual Results:  
The two last strings are not correctly highlighted.

Expected Results:  
Correctly identify "{}" and "{:s}" as correct replacement fields and highlight them.

(Related to bug 317097)
Comment 1 xOneca 2014-02-01 15:46:45 UTC
Created attachment 84934 [details]
Patch updating tag substitution

Patch is respect to rev. 0d7032ff. (File version: 2.22)
Comment 2 Christoph Cullmann 2016-01-31 16:28:24 UTC
Git commit 2ee8046be4aa7a15fb739352d82c73a2949777db by Christoph Cullmann.
Committed on 31/01/2016 at 16:27.
Pushed by cullmann into branch 'master'.

Patch updating tag substitution

>From http://docs.python.org/2/library/string.html#format-string-syntax:

  Changed in version 2.7: The positional argument specifiers can be omitted, so
  '{} {}' is equivalent to '{0} {1}'.

M  +19   -18   src/syntax/data/python.xml

http://commits.kde.org/ktexteditor/2ee8046be4aa7a15fb739352d82c73a2949777db