Skip to content

Commit

Permalink
very beginning of issue #20
Browse files Browse the repository at this point in the history
various minor improvements to the export dialog, the backend module, the prefs window, etc. to prepare the future implementation of a revealjs support
  • Loading branch information
maoschanz committed Feb 9, 2020
1 parent f501a73 commit c8d30db
Show file tree
Hide file tree
Showing 10 changed files with 231 additions and 167 deletions.
3 changes: 2 additions & 1 deletion POTFILES
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
./markdown_preview/export.py
./markdown_preview/prefs_and_export.py
./markdown_preview/__init__.py
./markdown_preview/kb_acc_data.py
./markdown_preview/preview.py
Expand All @@ -8,3 +8,4 @@
./markdown_preview/menus.ui
./markdown_preview/prefs.ui
./markdown_preview/preview.ui
./markdown_preview/revealjs_box.ui
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
- [ ] help labels and links for pandoc too! et toutes les pages en fait
- [ ] CSS for admonitions (and other default plugins ?)
- [ ] and pymdown ??
- [ ] cesser les zouaveries avec pandoc et les pre-strings/post-strings, il y a de vraies options
- [ ] reveal js https://github.com/jgm/pandoc/wiki/Using-pandoc-to-produce-reveal.js-slides
- [ ] rendu
- [ ] transitions
- [ ] numéros de pages
- [ ] paramètres de thème
- [ ] compléter les descriptions des schémas
- [ ] se souvenir du splitter
- [ ] ajouter le réglage pour le splitter dans les préférences
- [ ] bring back the fullscreen, but better
Expand Down
181 changes: 87 additions & 94 deletions example.css
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote {
margin: 0;
padding: 0;
}
/* example of a css file */
body {
font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", Arial, sans-serif;
font-size: 13px;
line-height: 18px;
color: #737373;
background-color: white;
margin: 10px 13px 10px 13px;
font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", Arial, sans-serif;
font-size: 13px;
line-height: 18px;
color: #737373;
background-color: white;
margin: 10px 13px 10px 13px;
}

h1, h2, h3, h4, h5, h6, p, blockquote {
margin: 0;
padding: 0;
}

table {
margin: 10px 0 15px 0;
border-collapse: collapse;
Expand All @@ -30,131 +26,128 @@ th {
}

a {
color: #0069d6;
color: #0069d6;
}
a:hover {
color: #0050a3;
text-decoration: none;
color: #0050a3;
text-decoration: none;
}
a img {
border: none;
border: none;
}

p {
margin-bottom: 9px;
margin-bottom: 9px;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #404040;
line-height: 36px;
h1, h2, h3, h4, h5, h6 {
color: #404040;
line-height: 36px;
}
h1 {
margin-bottom: 18px;
font-size: 30px;
margin-bottom: 18px;
font-size: 30px;
}
h2 {
font-size: 24px;
font-size: 24px;
}
h3 {
font-size: 18px;
font-size: 18px;
}
h4 {
font-size: 16px;
font-size: 16px;
}
h5 {
font-size: 14px;
font-size: 14px;
}
h6 {
font-size: 13px;
font-size: 13px;
}
hr {
margin: 0 0 19px;
border: 0;
border-bottom: 1px solid #ccc;
margin: 0 0 19px;
border: 0;
border-bottom: 1px solid #ccc;
}
blockquote {
padding: 13px 13px 21px 15px;
margin-bottom: 18px;
font-family:georgia,serif;
font-style: italic;
padding: 13px 13px 21px 15px;
margin-bottom: 18px;
font-family:georgia,serif;
font-style: italic;
}
blockquote:before {
content:"\201C";
font-size:40px;
margin-left:-10px;
font-family:georgia,serif;
color:#eee;
content:"\201C";
font-size:40px;
margin-left:-10px;
font-family:georgia,serif;
color:#eee;
}
blockquote p {
font-size: 14px;
font-weight: 300;
line-height: 18px;
margin-bottom: 0;
font-style: italic;
font-size: 14px;
font-weight: 300;
line-height: 18px;
margin-bottom: 0;
font-style: italic;
}
code, pre {
font-family: Monaco, Andale Mono, Courier New, monospace;
font-family: Monaco, Andale Mono, Courier New, monospace;
}
code {
background-color: #fee9cc;
color: rgba(0, 0, 0, 0.75);
padding: 1px 3px;
font-size: 12px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
background-color: #fee9cc;
color: rgba(0, 0, 0, 0.75);
padding: 1px 3px;
font-size: 12px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
pre {
display: block;
padding: 14px;
margin: 0 0 18px;
line-height: 16px;
font-size: 11px;
border: 1px solid #d9d9d9;
white-space: pre-wrap;
word-wrap: break-word;
display: block;
padding: 14px;
margin: 0 0 18px;
line-height: 16px;
font-size: 11px;
border: 1px solid #d9d9d9;
white-space: pre-wrap;
word-wrap: break-word;
}
pre code {
background-color: #fff;
color:#737373;
font-size: 11px;
padding: 0;
background-color: #fff;
color:#737373;
font-size: 11px;
padding: 0;
}
sup {
font-size: 0.83em;
vertical-align: super;
line-height: 0;
font-size: 0.83em;
vertical-align: super;
line-height: 0;
}
kbd {
display: inline-block;
padding: 3px 5px;
font-size: 11px;
line-height: 10px;
color: #555;
vertical-align: middle;
background-color: #fcfcfc;
border: solid 1px #ccc;
border-bottom-color: #bbb;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #bbb;
display: inline-block;
padding: 3px 5px;
font-size: 11px;
line-height: 10px;
color: #555;
vertical-align: middle;
background-color: #fcfcfc;
border: solid 1px #ccc;
border-bottom-color: #bbb;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #bbb;
}
* {
-webkit-print-color-adjust: exact;
}
@media screen and (min-width: 914px) {
body {
width: 854px;
margin:10px auto;
}
body {
width: 854px;
margin:10px auto;
}
}
@media print {
body,code,pre code,h1,h2,h3,h4,h5,h6 {
body, code, pre code, h1, h2, h3, h4, h5, h6 {
color: black;
}
table, pre {
page-break-inside: avoid;
}
}
}

10 changes: 5 additions & 5 deletions markdown_preview/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
LOCALE_PATH = os.path.join(BASE_PATH, 'locale')

from .preview import MdPreviewBar
from .export import MdExportDialog, MdConfigWidget
from .prefs_and_export import MdExportDialog, MdConfigWidget
from .kb_acc_data import ACTIONS_NAMES
from .kb_acc_data import SETTINGS_KEYS

Expand Down Expand Up @@ -211,7 +211,7 @@ def view_method(self, name):
else:
return

print('action : ' + name)
# print('action : ' + name) # TODO terminer ça mdr

if name == 'insert_table':
v.insert_table()
Expand Down Expand Up @@ -275,11 +275,11 @@ def do_create_configure_widget(self):
return widget

def on_open_prefs(self, *args):
w = Gtk.Window(title=_("Markdown Preview"))
w = Gtk.Window(title=_("Markdown Preview"), default_height=350)
widget = MdConfigWidget(self.plugin_info.get_data_dir())
w.add(widget)
w.present()
w.show_all()
w.show_all() # immonde mais reproduit le comportement de libpeas

def export_doc(self, *args):
dialog = MdExportDialog(self.preview.recognize_format(), self.window, self._settings)
Expand Down Expand Up @@ -325,7 +325,7 @@ def populate_popup(self, view, popup):
item.set_sensitive(False)
popup.append(item)

def recognize_format(self): # FIXME doc.get_language()
def recognize_format(self): # TODO doc.get_language()
doc = self.view.get_buffer()
name = doc.get_short_name_for_display()
temp = name.split('.')
Expand Down
42 changes: 31 additions & 11 deletions markdown_preview/backend_box.ui
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,16 @@
</object>
</child>
<child>
<object class="GtkFlowBox" id="extensions_flowbox">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="selection_mode">none</property>
<property name="expand">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkFlowBox" id="extensions_flowbox">
<property name="visible">True</property>
<property name="selection_mode">none</property>
</object>
</child>
</object>
</child>
<child>
Expand Down Expand Up @@ -142,23 +149,33 @@
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="expand">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTextView" id="pandoc_command_entry">
<property name="visible">True</property>
<property name="wrap-mode">word-char</property>
<property name="accepts-tab">False</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="expand">False</property>
<property name="visible">True</property>
<property name="spacing">16</property>
<child>
<object class="GtkFrame">
<object class="GtkLabel" id="help_label_pandoc">
<property name="visible">True</property>
<child>
<object class="GtkTextView" id="pandoc_command_entry">
<property name="visible">True</property>
<property name="expand">True</property>
<property name="wrap-mode">word-char</property>
<property name="accepts-tab">False</property>
</object>
</child>
<property name="wrap">True</property>
<property name="use-markup">True</property>
<property name="max-width-chars">50</property>
<style><class name="dim-label"/></style>
</object>
</child>
<child>
Expand All @@ -167,6 +184,9 @@
<property name="valign">center</property>
<property name="label" translatable="yes">Remember</property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
</object>
</child>
Expand Down
Loading

0 comments on commit c8d30db

Please sign in to comment.