Subversion Repositories basico

Compare Revisions

Ignore whitespace Rev 365 → Rev 366

/branches/BR-0.4/basico/services/srv_asciidoctor.py
11,9 → 11,27
from basico.core.mod_srv import Service
from basico.core.mod_env import FILE, LPATH, ATYPES, APP
 
CMD_ASCIIDOCTOR = "%s -b html5 -D %s %s"
CMD_ASCIIDOCTOR = "%s %s -b html5 -D %s %s"
ADOCPROPS = {
'source-highlighter' : 'coderay',
# ~ 'stylesheet' : 'kb4it.css',
# ~ 'stylesdir' : 'resources/css',
# ~ 'imagesdir' : 'resources/images',
# ~ 'scriptsdir' : 'resources/js',
'toc' : 'left',
'toclevels' : '6',
'icons' : 'font',
'iconfont-remote!' : None,
# ~ 'iconfont-name' : 'fontawesome-4.7.0',
'experimental' : None,
'linkcss' : None,
# ~ 'docinfo1' : 'shared-header',
# ~ 'docinfo2' : 'shared-footer',
# ~ 'docinfodir' : 'resources/docinfo',
#~ 'noheader' : None,
#~ 'nofooter' : None,
}
 
 
class Asciidoctor(Service):
def initialize(self):
"""
28,12 → 46,23
def generate_preview(self, aid):
adocprops = ''
for prop in ADOCPROPS:
if ADOCPROPS[prop] is not None:
if '%s' in ADOCPROPS[prop]:
adocprops += '-a %s=%s \\\n' % (prop, ADOCPROPS[prop] % self.target_path)
else:
adocprops += '-a %s=%s \\\n' % (prop, ADOCPROPS[prop])
else:
adocprops += '-a %s \\\n' % prop
self.log.debug("\tParameters passed to Asciidoc:\n%s" % adocprops)
 
source = self.srvant.get_content_file(aid)
target_dir = LPATH['CACHE_HTML']
target_file = os.path.basename(source).replace('.adoc', '.html')
target = "file://" + target_dir + target_file
asciidoctor = self.srvutl.which('asciidoctor')
cmd = CMD_ASCIIDOCTOR % (asciidoctor, target_dir, source)
cmd = CMD_ASCIIDOCTOR % (asciidoctor, adocprops, target_dir, source)
self.log.debug(cmd)
res = os.system(cmd)
self.log.debug("Asciidoctor result: %s", res)
/branches/BR-0.4/basico/widgets/wdg_annot.py
297,18 → 297,19
stack_annotation.connect('notify::visible-child', self.stack_changed)
self.container_body.add(stack_annotation)
 
# Add Annotation preview stack
preview = self.annotation_preview()
stack_annotation.add_titled(preview, "preview", "Preview annotation")
stack_annotation.child_set_property (preview, "icon-name", "basico-preview")
# Add Annotation editor stack
editor = self.annotation_editor()
stack_annotation.add_titled(editor, "editor", "Edit annotation")
stack_annotation.child_set_property (editor, "icon-name", "basico-drafts")
# Add Annotation preview stack
preview = self.annotation_preview()
stack_annotation.add_titled(preview, "preview", "Preview annotation")
stack_annotation.child_set_property (preview, "icon-name", "basico-preview")
 
stack_annotation.set_visible_child(editor)
stack_annotation.set_visible_child_full('editor', Gtk.StackTransitionType.CROSSFADE)
stack_annotation.set_property('visible-child', editor)
 
 
def stack_changed(self, stack, GParamObject):