Skip to content

Commit

Permalink
modify ebook-build 'init' more yaml vars. #2 plus some others.
Browse files Browse the repository at this point in the history
* very simple documents like README.md should be handled
  yaml `have_nav: false`
* add icon setting
* add font choice
* WIP. just checkpointing the current state.
  • Loading branch information
Cecil committed Jan 2, 2017
1 parent 75e50eb commit 5b971b8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
27 changes: 21 additions & 6 deletions ebook-builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
cfg = {}
stack do
para "Pick the directory with your document .md files"
para "Save will create and populate and .ebook folder there",
"that you should save at each phase You also need to point",
"to the top level github menu document like Home.md or README.md"
para "You also want to specify a Title"
para "Save will create an populate and .ebook folder there ",
"that you should save at each phase You can also to point ",
"to the top level github menu documents like Home.md if you have them"
para "You do want to specify a Title"
para "Custom icon is optional, but recommended"
flow do
para "Book Dir:"
@ebook_dir = edit_line width: 400
Expand All @@ -41,6 +42,13 @@
para "Title "
@ebook_title = edit_line width: 400
end
flow do
para "Your icon "
@ebook_icon = edit_line width: 400
button "Select" do
@ebook_icon.text = ask_open_file
end
end
button "Save" do
if @ebook_dir.text == nil || @ebook_title == nil || @ebook_menu == nil
alert "You are missing something!"
Expand All @@ -49,6 +57,10 @@
cfg['nested'] = false
cfg['input_format'] = 'GFM'
cfg['book_title'] = ""
cfg['icon'] = ""
cfg['base_font'] = 'Coolvetica'
cfg['have_nav'] = false
cfg['syntax_highlight'] = false
cfg['toc'] = {}
cfg['sections'] = {}
Dir.mkdir("#{dir}/.ebook") unless Dir.exist?("#{dir}/.ebook")
Expand Down Expand Up @@ -78,11 +90,14 @@
end
end
end
cfg['toc']['root'] = File.basename(@ebook_menu.text)
menu_name = @ebook_menu.text
cfg['toc']['root'] = File.basename(menu_name)
cfg['have_nav'] = (menu_name) && (menu_name != '')
cfg['toc']['files'] = [] # TODO: may not need
cfg['nested'] = true if cfg['sections'].size > 1
cfg['book_title'] = @ebook_title.text

icon_fl = @ebook_icon.text
cfg['icon'] = (icon_fl && icon_fl != '') ? icon_fl : "#{DIR}/static/app-icon.png"
# clean up on aisle 10 - remove toc document
tocfn = cfg['toc']['root']
#puts "cleaning find #{tocfn}"
Expand Down
2 changes: 1 addition & 1 deletion kd-render.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def highlight_codeblock(el)
##puts h.call(self, el.value, el.attr['class'], :span)
#puts syntax_highlighter(self, el.value, el.attr['class'], :span)
puts "SB #{el.inspect}"
nil
nil # until it's ready for Shoes to eval it.
end

def convert_strong(el)
Expand Down

0 comments on commit 5b971b8

Please sign in to comment.