mirror of
https://github.com/fergalmoran/picard.git
synced 2026-01-06 08:34:01 +00:00
Script: replace only the first _ with ~
This commit is contained in:
2
NEWS.txt
2
NEWS.txt
@@ -1,4 +1,4 @@
|
||||
Version 0.9.0alpha11 - 2007-05-28
|
||||
Version 0.9.0alpha11 - 2007-05-27
|
||||
* New Features:
|
||||
* Added "Edit" button to the tag editor.
|
||||
* Bug Fixes:
|
||||
|
||||
@@ -307,7 +307,8 @@ def func_num(parser, text, length):
|
||||
|
||||
def func_unset(parser, name):
|
||||
"""Unsets the variable ``name``."""
|
||||
name = name.replace("_", "~")
|
||||
if name.startswith("_"):
|
||||
name = "~" + name[1:]
|
||||
try:
|
||||
del parser.context[name]
|
||||
except KeyError:
|
||||
@@ -316,19 +317,23 @@ def func_unset(parser, name):
|
||||
|
||||
def func_set(parser, name, value):
|
||||
"""Sets the variable ``name`` to ``value``."""
|
||||
name = name.replace("_", "~")
|
||||
if name.startswith("_"):
|
||||
name = "~" + name[1:]
|
||||
parser.context[name] = value
|
||||
return ""
|
||||
|
||||
def func_get(parser, name):
|
||||
"""Returns the variable ``name`` (equivalent to ``%name%``)."""
|
||||
name = name.replace("_", "~")
|
||||
if name.startswith("_"):
|
||||
name = "~" + name[1:]
|
||||
return parser.context.get(name, u"")
|
||||
|
||||
def func_copy(parser, new, old):
|
||||
"""Copies content of variable ``old`` to variable ``new``."""
|
||||
new = new.replace("_", "~")
|
||||
old = old.replace("_", "~")
|
||||
if new.startswith("_"):
|
||||
new = "~" + new[1:]
|
||||
if old.startswith("_"):
|
||||
old = "~" + old[1:]
|
||||
parser.context[new] = parser.context.getall(old)[:]
|
||||
return ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user