Commit 417f66d6 authored by Etienne Nadji's avatar Etienne Nadji

modifié : plugin/vepub_css.py

	modifié :         plugin/vim_epub.py
	modifié :         plugin/vim_epub.vim
parent 0409143d
......@@ -8,30 +8,37 @@
from __future__ import unicode_literals
import os
def make_fontdef_summary(font_name,sources,output_file):
if sources:
#with open(output_file,"w") as out:
#out.write("\t+{0}-------------------------+\n".format())
#out.write("\t| Définitions of {0} font |\n".format(font_name))
#out.write("\t+{0}-------------------------+\n\n".format())
output_file = "{0}{1}{2}".format(os.path.realpath(os.curdir),os.sep,output_file)
fonts = []
print output_file
for ops in ["OEBPS","OPS"]:
if font_name.startswith(ops):
font_name = font_name[len(ops):]
print "Reading"
for font_def in sources:
file_def = font_def[0]
line_def = font_def[1]
with open(output_file,"w") as out:
tirets = len(font_name) * "-"
out.write("\t+{0}-------------------------+\n".format(tirets))
out.write("\t| Définitions of {0} font |\n".format(font_name))
out.write("\t+{0}-------------------------+\n\n".format(tirets))
fonts = []
for font_def in sources:
file_def = font_def[0]
line_def = font_def[1]
for ops in ["OEBPS","OPS"]:
if file_def.startswith(ops):
file_def = file_def[len(ops):]
for ops in ["OEBPS","OPS"]:
if file_def.startswith(ops):
file_def = file_def[len(ops):]
print font_name,file_def,line_def
out.write("File: {0}\nLine: {1}\n\n".format(file_def,line_def))
return output_file
else:
return False
......
......@@ -1403,6 +1403,11 @@ def get_split_cmd(vim,target):
split = vim.eval("g:VimEPUB_MetaSplit")
except:
return "vsp"
elif target == "fontdef":
try:
split = vim.eval("g:VimEPUB_FontDefSplit")
except:
return "vsp"
else:
return "sp"
......
......@@ -15,6 +15,7 @@ au BufReadCmd *.epub call zip#Browse(expand("<amatch>"))
" Options
au BufReadCmd *.epub let g:VimEPUB_DiffSplit = "horizontal"
au BufReadCmd *.epub let g:VimEPUB_MetaSplit = "vertical"
au BufReadCmd *.epub let g:VimEPUB_FontDefSplit = "vertical"
au BufReadCmd *.epub let g:VimEPUB_EReaderCommand = "none"
au BufReadCmd *.epub let g:VimEPUB_OpenMedia_Font = "none"
......@@ -340,24 +341,40 @@ with Open_EPUB(vim.buffers) as epubs:
if have_tmp_path:
epubs.extract()
cssf = []
for css in available_css_files:
css_file = "{0}{1}".format(epubs.temporary_epub["path"],css)
defs = cssparse.find_font_face_src(css_file)
cssf = []
for css in available_css_files:
css_file = "{0}{1}".format(epubs.temporary_epub["path"],css)
defs = cssparse.find_font_face_src(css_file)
if defs:
for fdef in defs:
if defs:
for fdef in defs:
if fdef["url"] in font_name:
cssf.append([css,fdef["line"]])
print cssf
cssf.append([css,fdef["line"]])
if cssf:
cssparse.make_fontdef_summary(font_name,cssf,"font_definitions")
if cssf:
epubs.remove_temp_dir()
summary = cssparse.make_fontdef_summary(
font_name,
cssf,
font_definitions
)
vim.command(
":{0} {1}".format(
get_split_cmd(vim,"fontdef"),
summary)
)
vim.command(":setl buftype=nofile bufhidden=wipe nobuflisted")
else:
# * xhtml *
# SI des fichiers (X)HTML
# * Essai 2 * Dans les fichiers (X)HTML: Balise <style> du header
# * Essai 3 * Dans les fichiers (X)HTML: Style en paramètre d’une balise
pass
# * xhtml *
# SI des fichiers (X)HTML
# * Essai 2 * Dans les fichiers (X)HTML: Balise <style> du header
# * Essai 3 * Dans les fichiers (X)HTML: Style en paramètre d’une balise
pass
endOfPython
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment