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 import re
class MetaFixer(object): class MetaFixer(object):
def __init__(self): def __init__(self):
pass pass
def metafix(self, nm, txt): def metafix(self, nm, txt):
if nm == 'bibtex:pages': if nm == 'bibtex:pages':
txt = re.sub(r'--', '-', txt) txt = re.sub(r'--', '-', txt)
elif nm == 'someothername': elif nm == 'someothername':
# do something else # do something else
pass pass
elif nm == 'stillanother': elif nm == 'stillanother':
# etc. # etc.
pass pass
return txt return txt
def wrapup(self, metaheaders): def wrapup(self, metaheaders):
pass pass
</pre> </pre>
<p>If the 'metafix()' method is defined, it is called for <p>If the 'metafix()' method is defined, it is called for
each metadata field. A new MetaFixer object is created 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 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 the metadata fields (available for &RCL; 1.23.3 and later. 1.23.2
has equivalent code inside the handler script). Example:</para> has equivalent code inside the handler script). Example:</para>
<programlisting>import sys <programlisting>import sys
import re import re
class MetaFixer(object): class MetaFixer(object):
def __init__(self): def __init__(self):
pass pass
def metafix(self, nm, txt): def metafix(self, nm, txt):
if nm == 'bibtex:pages': if nm == 'bibtex:pages':
txt = re.sub(r'--', '-', txt) txt = re.sub(r'--', '-', txt)
elif nm == 'someothername': elif nm == 'someothername':
# do something else # do something else
pass pass
elif nm == 'stillanother': elif nm == 'stillanother':
# etc. # etc.
pass pass
return txt return txt
def wrapup(self, metaheaders): def wrapup(self, metaheaders):
pass pass
</programlisting> </programlisting>
<para>If the 'metafix()' method is defined, it is called for each <para>If the 'metafix()' method is defined, it is called for each