doc: indentation in sample program

This commit is contained in:
Jean-Francois Dockes 2019-11-08 15:52:09 +01:00
parent 1302b185d8
commit a544a3e26d
2 changed files with 29 additions and 28 deletions

View File

@ -2204,22 +2204,22 @@ metadatacmds = ; <em class=
import re
class MetaFixer(object):
def __init__(self):
pass
def __init__(self):
pass
def metafix(self, nm, txt):
if nm == 'bibtex:pages':
txt = re.sub(r'--', '-', txt)
elif nm == 'someothername':
# do something else
pass
elif nm == 'stillanother':
# etc.
pass
def metafix(self, nm, txt):
if nm == 'bibtex:pages':
txt = re.sub(r'--', '-', txt)
elif nm == 'someothername':
# do something else
pass
elif nm == 'stillanother':
# etc.
pass
return txt
def wrapup(self, metaheaders):
pass
return txt
def wrapup(self, metaheaders):
pass
</pre>
<p>If the 'metafix()' method is defined, it is called for
each metadata field. A new MetaFixer object is created

View File

@ -1456,26 +1456,27 @@ metadatacmds = ; <replaceable>tags</replaceable> = tmsu tags %f
variable can be used to designate a file with Python code to edit
the metadata fields (available for &RCL; 1.23.3 and later. 1.23.2
has equivalent code inside the handler script). Example:</para>
<programlisting>import sys
import re
class MetaFixer(object):
def __init__(self):
pass
def __init__(self):
pass
def metafix(self, nm, txt):
if nm == 'bibtex:pages':
txt = re.sub(r'--', '-', txt)
elif nm == 'someothername':
# do something else
pass
elif nm == 'stillanother':
# etc.
pass
def metafix(self, nm, txt):
if nm == 'bibtex:pages':
txt = re.sub(r'--', '-', txt)
elif nm == 'someothername':
# do something else
pass
elif nm == 'stillanother':
# etc.
pass
return txt
def wrapup(self, metaheaders):
pass
return txt
def wrapup(self, metaheaders):
pass
</programlisting>
<para>If the 'metafix()' method is defined, it is called for each