def on_help_menu_item_activate(self, widget): temp_dir = self.journal.dirs.temp_dir filesystem.write_file(os.path.join(temp_dir, 'source.txt'), info.help_text) html = self.journal.convert(info.help_text, 'xhtml', headers=[_('RedNotebook Documentation'), info.version, ''], options={'toc': 1}) utils.show_html_in_browser(html, os.path.join(temp_dir, 'help.html'))
def on_help_menu_item_activate(self, widget): temp_dir = self.journal.dirs.temp_dir filesystem.write_file(os.path.join(temp_dir, 'source.txt'), help_text) html = self.journal.convert( help_text, 'xhtml', headers=[_('RedNotebook Documentation'), info.version, ''], options={'toc': 1}) utils.show_html_in_browser(html, os.path.join(temp_dir, 'help.html'))
def on_help_menu_item_activate(self, widget): temp_dir = self.journal.dirs.temp_dir filesystem.write_file(os.path.join(temp_dir, "source.txt"), help_text) html = self.journal.convert( help_text, "xhtml", headers=[_("RedNotebook Documentation"), info.version, ""], options={"toc": 1}, ) utils.show_html_in_browser(html, os.path.join(temp_dir, "help.html"))
def on_preview_button_clicked(self, button): self.journal.save_old_day() if browser.WebKit2: self.html_editor.show_day(self.day) self.change_mode(preview=True) else: date_format = self.journal.config.read('exportDateFormat') date_string = dates.format_date(date_format, self.day.date) markup_string = markup.get_markup_for_day(self.day) html = self.journal.convert( markup_string, 'xhtml', headers=[date_string + ' - RedNotebook', '', ''], options={'toc': 0}) utils.show_html_in_browser( html, os.path.join(self.journal.dirs.temp_dir, 'day.html'))
def on_preview_button_clicked(self, button): self.journal.save_old_day() if self.html_editor.internal: self.html_editor.show_day(self.day) self.change_mode(preview=True) else: date_format = self.journal.config.read('exportDateFormat') date_string = dates.format_date(date_format, self.day.date) markup_string = markup.get_markup_for_day(self.day) html = self.journal.convert( markup_string, 'xhtml', headers=[date_string + ' - RedNotebook', '', ''], options={'toc': 0}) utils.show_html_in_browser( html, os.path.join(self.journal.dirs.temp_dir, 'day.html'))
def on_preview_button_clicked(self, button): self.journal.save_old_day() if self.html_editor.internal: self.html_editor.show_day(self.day) self.change_mode(preview=True) else: date_format = self.journal.config.read("exportDateFormat") date_string = dates.format_date(date_format, self.day.date) markup_string = markup.get_markup_for_day(self.day, "xhtml") html = self.journal.convert( markup_string, "xhtml", headers=[date_string + " - RedNotebook", "", ""], options={"toc": 0}, ) utils.show_html_in_browser( html, os.path.join(self.journal.dirs.temp_dir, "day.html"))
except gobject.GError: # There are unknown tags in the markup, return the original text logging.debug('There are unknown tags in the markup: %s' % result) return original_txt def convert_from_pango(pango_markup): original_txt = pango_markup replacements = dict(( ('<b>', '**'), ('</b>', '**'), ('<i>', '//'), ('</i>', '//'), ('<s>', '--'), ('</s>', '--'), ('<u>', '__'), ('</u>', '__'), ('&', '&'), ('<', '<'), ('>', '>'), ('\n', r'\\'), )) for orig, repl in replacements.items(): pango_markup = pango_markup.replace(orig, repl) logging.log(5, 'Converted "%s" pango to "%s" txt2tags' % (repr(original_txt), repr(pango_markup))) return pango_markup if __name__ == '__main__': from rednotebook.util.utils import show_html_in_browser markup = 'Aha\n\tThis is a quote. It looks very nice. Even with many lines' html = convert(markup, 'xhtml', '/tmp') show_html_in_browser(html, '/tmp/test.html')
def convert_from_pango(pango_markup): original_txt = pango_markup replacements = dict(( ('<b>', '**'), ('</b>', '**'), ('<i>', '//'), ('</i>', '//'), ('<s>', '--'), ('</s>', '--'), ('<u>', '__'), ('</u>', '__'), ('&', '&'), ('<', '<'), ('>', '>'), ('\n', r'\\'), )) for orig, repl in replacements.items(): pango_markup = pango_markup.replace(orig, repl) logging.log( 5, 'Converted "%s" pango to "%s" txt2tags' % (repr(original_txt), repr(pango_markup))) return pango_markup if __name__ == '__main__': from rednotebook.util.utils import show_html_in_browser markup = 'Aha\n\tThis is a quote. It looks very nice. Even with many lines' html = convert(markup, 'xhtml', '/tmp') show_html_in_browser(html, '/tmp/test.html')