Skip to content

Commit

Permalink
Minor things
Browse files Browse the repository at this point in the history
  • Loading branch information
maoschanz committed Mar 11, 2019
1 parent e3c8f79 commit ef5c4d5
Show file tree
Hide file tree
Showing 8 changed files with 244 additions and 217 deletions.
4 changes: 2 additions & 2 deletions markdown_preview/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,10 @@ def add_word_tags(self, start_tag, end_tag):
return
new_code = self.add_tags_characters(document, start_tag, end_tag, start, end)

def format_title_upper(self):
def format_title_lower(self):
self.add_line_tags('#', '')

def format_title_lower(self):
def format_title_upper(self):
self.remove_line_tags('# ', ' #')

def format_title(self, level):
Expand Down
16 changes: 11 additions & 5 deletions markdown_preview/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class MdExportDialog(Gtk.Dialog):
output_format = 'error'
file_format = 'md'

# TODO c'est quand même con de reconstruire de manière dédoublée cette UI

def __init__(self, file_format, gedit_window, settings, **kwargs):
super().__init__(use_header_bar=True, title=_("Export as…"), **kwargs)
self.file_format = file_format
Expand Down Expand Up @@ -165,16 +167,20 @@ def on_pandoc_format_changed(self, w):
self.remember_button.set_visible(output_format == 'custom')

if output_format == 'pdf':
self.pandoc_command_entry.set_text('pandoc $INPUT_FILE -V geometry=right=2cm -V' \
' geometry=left=2cm -V geometry=bottom=2cm -V geometry=top=2cm -o $OUTPUT_FILE')
self.pandoc_command_entry.set_text('pandoc $INPUT_FILE -V geometry=right=2cm' \
' -V geometry=left=2cm -V geometry=bottom=2cm -V geometry=top=2cm' \
' -o $OUTPUT_FILE')
elif output_format == 'revealjs':
self.pandoc_command_entry.set_text('pandoc $INPUT_FILE -t revealjs -s -V revealjs-url=http://lab.hakim.se/reveal-js -o $OUTPUT_FILE')
self.pandoc_command_entry.set_text('pandoc $INPUT_FILE -t revealjs -s -V' \
' revealjs-url=http://lab.hakim.se/reveal-js -o $OUTPUT_FILE')
elif output_format == 'custom':
self.pandoc_command_entry.set_text(self._settings.get_string('custom-export'))
elif output_format == 'html_custom':
self.pandoc_command_entry.set_text('pandoc $INPUT_FILE -t html5 -s -c ' + self._settings.get_string('style') + ' -o $OUTPUT_FILE')
self.pandoc_command_entry.set_text('pandoc $INPUT_FILE -t html5 -s -c ' \
+ self._settings.get_string('style') + ' -o $OUTPUT_FILE')
else:
self.pandoc_command_entry.set_text('pandoc $INPUT_FILE -t ' + output_format + ' -o $OUTPUT_FILE')
self.pandoc_command_entry.set_text('pandoc $INPUT_FILE -t ' + output_format \
+ ' -o $OUTPUT_FILE')

#################

24 changes: 24 additions & 0 deletions markdown_preview/menus.ui
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,30 @@
<attribute name="action">win.md-prev-set-autoreload</attribute>
</item>
</section>
<section id="md-preview-options">
<submenu>
<attribute name="label" translatable="yes">Options</attribute>
<section>
<attribute name="label" translatable="yes">Rendering</attribute>
<item>
<attribute name="label" translatable="yes">python3-markdown</attribute>
<attribute name="action">win.md-prev-rendering</attribute>
<attribute name="target">p3md</attribute>
</item>
<item>
<attribute name="label" translatable="yes">pandoc</attribute>
<attribute name="action">win.md-prev-rendering</attribute>
<attribute name="target">pandoc</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Use relative paths</attribute>
<attribute name="action">win.md-prev-relative-path</attribute>
</item>
</section>
</submenu>
</section>
<section id="md-preview-zoom">
<attribute name="display-hint">horizontal-buttons</attribute>
<item>
Expand Down
10 changes: 1 addition & 9 deletions markdown_preview/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,9 @@ def __init__(self, datadir, **kwargs):
#--------
builder = Gtk.Builder().new_from_file(os.path.join(BASE_PATH, 'prefs.ui'))
# builder.set_translation_domain('gedit-plugin-markdown-preview') # ?????? FIXME
stack = Gtk.Stack(margin=10)
stack = builder.get_object('stack')
switcher = Gtk.StackSwitcher(stack=stack, halign=Gtk.Align.CENTER)

preview_page = builder.get_object('preview_page')
backend_page = builder.get_object('backend_page')
shortcuts_page = builder.get_object('shortcuts_page')

stack.add_titled(preview_page, 'preview', _("Preview"))
stack.add_titled(backend_page, 'backend', _("Backend"))
stack.add_titled(shortcuts_page, 'shortcuts', _("Shortcuts"))

### PREVIEW ###

backendCombobox = builder.get_object('backendCombobox')
Expand Down
Loading

0 comments on commit ef5c4d5

Please sign in to comment.