diff options
Diffstat (limited to 'docutils/tools')
| -rwxr-xr-x | docutils/tools/md2html5.py | 39 | ||||
| -rw-r--r-- | docutils/tools/md2pseudoxml.py | 33 | ||||
| -rw-r--r-- | docutils/tools/md2xml.py | 34 |
3 files changed, 106 insertions, 0 deletions
diff --git a/docutils/tools/md2html5.py b/docutils/tools/md2html5.py new file mode 100755 index 000000000..55b9238ce --- /dev/null +++ b/docutils/tools/md2html5.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# -*- coding: utf8 -*- +# :Copyright: © 2020 Günter Milde. +# :License: Released under the terms of the `2-Clause BSD license`_, in short: +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. +# This file is offered as-is, without any warranty. +# +# .. _2-Clause BSD license: https://opensource.org/licenses/BSD-2-Clause +# +# Revision: $Revision$ +# Date: $Date$ + +""" +A minimal front end to the Docutils Publisher, parsing CommonMark markdown files +with `recommonmark` and producing HTML 5 documents. + +The output is also valid XML. +""" + +try: + import locale # module missing in Jython + locale.setlocale(locale.LC_ALL, '') +except locale.Error: + pass + +from docutils.core import publish_cmdline, default_description + + +description = (u'Generate HTML5 documents from standalone ' + u'Markdown (CommonMark) sources.\n' + + default_description) + +publish_cmdline(#parser=mdparser, + parser_name="recommonmark", + writer_name='html5', + description=description) diff --git a/docutils/tools/md2pseudoxml.py b/docutils/tools/md2pseudoxml.py new file mode 100644 index 000000000..17673347f --- /dev/null +++ b/docutils/tools/md2pseudoxml.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# -*- coding: utf8 -*- +# :Copyright: © 2020 Günter Milde. +# :License: Released under the terms of the `2-Clause BSD license`_, in short: +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. +# This file is offered as-is, without any warranty. +# +# .. _2-Clause BSD license: https://opensource.org/licenses/BSD-2-Clause +# +# Revision: $Revision$ +# Date: $Date$ + +""" +A minimal front end to the Docutils Publisher, parsing CommonMark markdown +files with `recommonmark` and producing Pseudo-XML. +""" + +try: + import locale + locale.setlocale(locale.LC_ALL, '') +except: + pass + +from docutils.core import publish_cmdline, default_description + + +description = ('Generates Pseudo-XML from standalone ' + 'CommonMark sources. ' + default_description) + +publish_cmdline(parser_name='recommonmark', description=description) diff --git a/docutils/tools/md2xml.py b/docutils/tools/md2xml.py new file mode 100644 index 000000000..5743b7c39 --- /dev/null +++ b/docutils/tools/md2xml.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# -*- coding: utf8 -*- +# :Copyright: © 2020 Günter Milde. +# :License: Released under the terms of the `2-Clause BSD license`_, in short: +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. +# This file is offered as-is, without any warranty. +# +# .. _2-Clause BSD license: https://opensource.org/licenses/BSD-2-Clause +# +# Revision: $Revision$ +# Date: $Date$ + +""" +A minimal front end to the Docutils Publisher, parsing CommonMark markdown +files with `recommonmark` and producing Docutils XML. +""" + +try: + import locale + locale.setlocale(locale.LC_ALL, '') +except: + pass + +from docutils.core import publish_cmdline, default_description + + +description = ('Generates Docutils-native XML from standalone ' + 'CommonMark sources. ' + default_description) + +publish_cmdline(parser_name='recommonmark', writer_name='xml', + description=description) |
