#!/usr/bin/python3

import argparse, re

parser = argparse.ArgumentParser()
parser.add_argument("infile",help="Input md file")
parser.add_argument("outfile",help="Output rnc file")
parser.add_argument("-t","--type",default="rnc",help="Example type to extract [rnc]")
args = parser.parse_args()

outf = open(args.outfile, "w") #, encoding="utf-8")
inf = open(args.infile, "r") #, encoding="utf-8")
state = "text"
for r in inf.readlines():
    if state == "found" and r.startswith("```"):
        state = "text"
    elif r.startswith("```"+args.type):
        state = "found"
        outf.write("\n")
    elif state == "found":
        outf.write(r)
inf.close()
outf.close()

5e727848fc9f95f18de29639e565f5afd6ccd797
<mask token>

<mask token>
parser.add_argument('infile', help='Input md file')
parser.add_argument('outfile', help='Output rnc file')
parser.add_argument('-t', '--type', default='rnc', help=
    'Example type to extract [rnc]')
<mask token>
for r in inf.readlines():
    if state == 'found' and r.startswith('```'):
        state = 'text'
    elif r.startswith('```' + args.type):
        state = 'found'
        outf.write('\n')
    elif state == 'found':
        outf.write(r)
inf.close()
outf.close()

<mask token>
parser = argparse.ArgumentParser()
parser.add_argument('infile', help='Input md file')
parser.add_argument('outfile', help='Output rnc file')
parser.add_argument('-t', '--type', default='rnc', help=
    'Example type to extract [rnc]')
args = parser.parse_args()
outf = open(args.outfile, 'w')
inf = open(args.infile, 'r')
state = 'text'
for r in inf.readlines():
    if state == 'found' and r.startswith('```'):
        state = 'text'
    elif r.startswith('```' + args.type):
        state = 'found'
        outf.write('\n')
    elif state == 'found':
        outf.write(r)
inf.close()
outf.close()

import argparse, re
parser = argparse.ArgumentParser()
parser.add_argument('infile', help='Input md file')
parser.add_argument('outfile', help='Output rnc file')
parser.add_argument('-t', '--type', default='rnc', help=
    'Example type to extract [rnc]')
args = parser.parse_args()
outf = open(args.outfile, 'w')
inf = open(args.infile, 'r')
state = 'text'
for r in inf.readlines():
    if state == 'found' and r.startswith('```'):
        state = 'text'
    elif r.startswith('```' + args.type):
        state = 'found'
        outf.write('\n')
    elif state == 'found':
        outf.write(r)
inf.close()
outf.close()

#!/usr/bin/python3

import argparse, re

parser = argparse.ArgumentParser()
parser.add_argument("infile",help="Input md file")
parser.add_argument("outfile",help="Output rnc file")
parser.add_argument("-t","--type",default="rnc",help="Example type to extract [rnc]")
args = parser.parse_args()

outf = open(args.outfile, "w") #, encoding="utf-8")
inf = open(args.infile, "r") #, encoding="utf-8")
state = "text"
for r in inf.readlines():
    if state == "found" and r.startswith("```"):
        state = "text"
    elif r.startswith("```"+args.type):
        state = "found"
        outf.write("\n")
    elif state == "found":
        outf.write(r)
inf.close()
outf.close()
