Exemple #1
0
def snapshot(src, msg=u'snapshot', pdfArgs={}):
    """
	Commits the current state of the repository and exports a snapshot of the
	current documents.

	Arguments:
	src		--	The source Markdown document.

	Keyword arguments:
	msg		--	A commit message. (default=u'snapshot')
	"""

    cmd = [u'git', u'commit', u'-am', msg]
    print(u'Committing (msg: %s)' % msg)
    call(cmd)
    cmd = [u'git', u'log', u'--pretty=format:[%cd #%h] %s', u'--date=iso', \
     u'-1']
    tag = check_output(cmd).decode()
    folder = os.path.join(exportFolder, tag)
    print(u'Exporting to %s' % folder)
    if os.path.exists(folder):
        raise Exception( \
         u'Folder %s already exists! There is probably nothing new to export.' \
         % folder)
    os.mkdir(folder)
    if u'pdf' in exportFormats:
        build.PDF(src, os.path.join(folder, u'export.pdf'), **pdfArgs)
    if u'doc' in exportFormats:
        build.DOC(src, os.path.join(folder, u'export.doc'))
    if u'docx' in exportFormats:
        build.DOCX(src, os.path.join(folder, u'export.docx'))
    if u'odt' in exportFormats:
        build.ODT(src, os.path.join(folder, u'export.odt'))
    if u'html' in exportFormats:
        build.HTML(src, os.path.join(folder, u'export.html'))
Exemple #2
0
#!/usr/bin/env python
#-*- coding:utf-8 -*-

from academicmarkdown import build

build.HTML(u'stimulus-sets.md', u'stimulus-sets.html', standalone=False)
build.PDF(u'stimulus-sets.md', u'stimulus-sets.pdf')
Exemple #3
0
        print 'Adding %s' % path
        src.append(path)
    return sorted(src)


def helpify(folder, msg=u''):
    """
	Recursively builds a help page from Markdown help files in a source folder.
	
	Arguments:
	folder		--	The source folder.
	
	Keyword arguments:
	msg			--	An informative message to include after each help file.
	
	Returns:
	A help page.
	"""

    src = collect(folder)
    md = u''
    for path in src:
        _md = u'\n' + open(path).read().decode(u'utf-8') + msg + u'\n'
        _md = _md.replace(u'\n#', u'\n###')
        md += _md
    return md


md = md % (helpify(u'help'), helpify(u'plugins', plugin_msg))
html = build.HTML(md, standalone=False)
open('../osdoc/content/_includes/item-help', 'w').write(html.encode('utf-8'))
Exemple #4
0
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
This file is part of YAMLDoc.

YAMLDoc is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

YAMLDoc is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with YAMLDoc.  If not, see <http://www.gnu.org/licenses/>.
"""

import yamldoc
from academicmarkdown import build
from yamldoc.py3compat import *
fd = yamldoc.DocFactory(yamldoc)
md = build.MD(str(fd))
build.TOCAnchorHeaders = True
build.HTML(str(fd), u'readme.html')
print(md)
open(u'readme.md', u'w').write(safe_encode(md))
Exemple #5
0
#!/usr/bin/env python
"""
This file is part of qnotero.

qnotero is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

qnotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with qnotero.  If not, see <http://www.gnu.org/licenses/>.
"""

from academicmarkdown import build
build.MD('readme-src.md', 'readme.md')
build.HTML('readme-src.md', 'readme.html')
Exemple #6
0
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
This file is part of zoteromarkdown.

zoteromarkdown is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

zoteromarkdown is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with zoteromarkdown.  If not, see <http://www.gnu.org/licenses/>.
"""

import academicmarkdown
from academicmarkdown import build
import myZoteroCredentials
build.path.append(u'example/src')
build.zoteroLibraryId = myZoteroCredentials.zoteroLibraryId
build.zoteroApiKey = myZoteroCredentials.zoteroApiKey
build.setStyle('modern')
build.pdfHeader = u'Generated with academicmarkdown %s' \
 % academicmarkdown.version
build.PDF('example/src/example.md', 'example/example.pdf')
build.HTML('example/src/example.md', 'example/example.html')