PKegNsubmark/__init__.py""" A Subset of Markdown Use it like this: submark something.md > something.html or: cat something.html | submark > something.html or: $ echo '**hi**' | submark hi """ __version__ = "0.7" from .submark import convert # noqa from .cli import main # noqa PK'Novvsubmark/cli.py""" """ from .submark import convert_list import fileinput def main(): print(convert_list(fileinput.input())) PKnN%'NNsubmark/submark.py""" """ import re def headers(line): line = re.sub(r"^# (.*)", r"

\1

", line) line = re.sub(r"^## (.*)", r"

\1

", line) line = re.sub(r"^### (.*)", r"

\1

", line) line = re.sub(r"^#### (.*)", r"

\1

", line) line = re.sub(r"^##### (.*)", r"
\1
", line) return line def strong(line): line = re.sub(r"\*\*(.*)\*\*", r"\1", line) line = re.sub(r"__(.*)__", r"\1", line) return line def em(line): line = re.sub(r"\*(.*)\*", r"\1", line) line = re.sub(r"_(.*)_", r"\1", line) return line def link(line): line = re.sub(r'\[(.+)\]\(([^ ]+) (".+")\)', r'\1', line) line = re.sub(r'\[(.+)\]\(([^ ]+)\)', r'\1', line) return line def image(line): # example: r'![alt](/some/image.png) "title")', # out: r'alt', line = re.sub(r'!\[(.+)\]\(([^ ]+) "(.+)"\)', r'\1', line) return line def code_span(line): # example: this is `some code` # out: this is some code line = re.sub(r'`([^`]+)`', r'\1', line) return line def horizontal_rule(line): # example: --- # out:
line = re.sub(r'^---+ *$', r'
', line) return line def line_break(line): # example: some text # out: some text
line = re.sub(r'\s\s$', r'
', line) return line def convert_line(line): line = line.rstrip('\n') line = headers(line) line = strong(line) line = em(line) line = image(line) line = link(line) line = code_span(line) line = horizontal_rule(line) line = line_break(line) return line def convert_list(lines): converted_list = [convert_line(l) for l in lines] return "\n".join(converted_list) def convert(some_string): return convert_list(some_string.split("\n")) PK!Hu$(&submark-0.7.dist-info/entry_points.txtN+I/N.,()*.MM,ʶVy\\PKUN.,,submark-0.7.dist-info/LICENSEMIT License Copyright (c) 2019 Brian Okken Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!HMuSasubmark-0.7.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,szd&Y)r$[)T&UD"PK!HĢ submark-0.7.dist-info/METADATAVmo6_qs5,)MuitX EQĴD[%Q#).=(Y^3=~KnX J Y(z\IUБWu]r33 ,eN<ܙ1RG,bZ2n,^j o~zUpVL1Vނ] &1\'JTodixi›M!6q&gZxL/謪\Ԟ//nZr+\h3jc6?*F4~XP#??[D ̏`&t&<1 S0M̊*HJ] T̈rI % bԄbU,Y!m#ʅYGrdV爂sg^Ȕ\H d&Jz˙ 2R>C=ifDfŴIӬ>`؇!.!d~xkm,99N;ww?}i;5)Ŵ8uV0\cF|z 2DeiPlsq1_ -+lk#] pT8u~3;RT!VSv0ŒJN`|k8c>Vg 8*7ri]u-fb8ݙ*l]̽$[P?xC,Ts=c{/2mLp-0лd_~ ͏M); urcI&`8px gI5pᜯ[AףPFx_,0ФA/6̔y.+K :O 83' ܂6iS۬3YSXқ0Ā(8-kpG碌YbĚ<aB!9#{uUqA2>H@vh1zR~" ~&k /-\&8n\BZHLol-dh/1 + 5t7dD,rPݣ CuW tc"6jofH<HAv8 ۄ=inwr,#,[3_sa#}(oyo@ةAiKπAM5ԂdZ\2 "8AMAq)X|_T TعW%OR0 Lr^fQ P+y'l1e9kBYb[ۧE'>PjJc{ҟ9*ʨD"wmDrg^oҷp!jNQu{A)i5_nA )/֓erF4 ޕ]lT {ggzmgU]=KZMmh$@>a,`;2X[[EPKegNsubmark/__init__.pyPK'NovvFsubmark/cli.pyPKnN%'NNsubmark/submark.pyPK!Hu$(&f submark-0.7.dist-info/entry_points.txtPKUN.,, submark-0.7.dist-info/LICENSEPK!HMuSa5submark-0.7.dist-info/WHEELPK!HĢ submark-0.7.dist-info/METADATAPK!HQfȁWsubmark-0.7.dist-info/RECORDPK;h