1 #!/usr/bin/env python 2 3 """ 4 Common parsing data. 5 6 Copyright (C) 2012, 2013 Paul Boddie <paul@boddie.org.uk> 7 8 This software is free software; you can redistribute it and/or 9 modify it under the terms of the GNU General Public License as 10 published by the Free Software Foundation; either version 2 of 11 the License, or (at your option) any later version. 12 13 This software is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public 19 License along with this library; see the file LICENCE.txt 20 If not, write to the Free Software Foundation, Inc., 21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 22 """ 23 24 URL_SCHEMES = ("http", "https", "ftp", "mailto") 25 26 # Translation helpers. 27 28 blocktypes = { 29 "h1" : "= %s =", 30 "h2" : "== %s ==", 31 "h3" : "=== %s ===", 32 "h4" : "==== %s ====", 33 "h5" : "===== %s =====", 34 "h6" : "====== %s ======", 35 "bq" : "{{{%s}}}", 36 } 37 38 headings = blocktypes.keys(); headings.remove("bq") 39 40 def quote_macro_argument(arg): 41 if arg.find('"') != -1: 42 return '"%s"' % arg.replace('"', '""') 43 else: 44 return arg 45 46 # vim: tabstop=4 expandtab shiftwidth=4