Este plugin é escrito para o Python 2, mas desde o gedit 3.8, somente os plugins do Python 3 são suportados. Portanto, algumas pequenas mudanças são necessárias.
-
Modifique o instalador (
gedit-markdown.sh
) para instalar o módulo markdown do python3:Este é um patch que você pode aplicar no arquivo existente (ou você pode simplesmente copiar a versão completa modificada disponível aqui ):
--- gedit-markdown_ori.sh 2014-05-14 16:14:58.386700310 +0200 +++ gedit-markdown.sh 2014-05-14 15:42:21.038783248 +0200 @@ -263,7 +263,9 @@ # Note: sous Archlinux, «/usr/bin/python» correspond à Python 3. On teste donc les # chemins pour Python 2 en premier. -if type -p python2.7 > /dev/null; then +if type -p python3 > /dev/null; then + binPython=$(type -p python3) +elif type -p python2.7 > /dev/null; then binPython=$(type -p python2.7) elif type -p python2.6 > /dev/null; then binPython=$(type -p python2.6) @@ -287,15 +289,15 @@ cheminPythonMarkdown=python-markdown/python2 cheminPythonSitePackages=$("$binPython" -m site --user-site) fi -# elif [[ ${versionPython:0:1} == 3 ]]; then -# compareVersions "$versionPython" "3.1" -# -# if [[ $? == 2 ]]; then -# bonneVersionPython=false -# else -# cheminPythonMarkdown=python-markdown/python3 -# cheminPythonSitePackages=$("$binPython" -m site --user-site) -# fi + elif [[ ${versionPython:0:1} == 3 ]]; then + compareVersions "$versionPython" "3.1" + + if [[ $? == 2 ]]; then + bonneVersionPython=false + else + cheminPythonMarkdown=python-markdown/python3 + cheminPythonSitePackages=$("$binPython" -m site --user-site) + fi else bonneVersionPython=false fi
-
Executar
./gedit-markdown.sh install
Você deve ver o python 3.4 em vez de 2.7:
############################################################ ## ## Installation of gedit-markdown ## ############################################################ ## First step: check dependencies - gedit: 3.10.4 - Python: 3.4 [...]
-
Altere o carregador de plug-ins para python3
Substitua
/home/aarold/.local/share/gedit/plugins/markdown-preview.plugin
por:[Plugin] Loader=python3 Module=markdown-preview IAge=3 Name=Markdown Preview Name[fr]=Aperçu Markdown Description=Show the HTML version of the Markdown text you're editing Description[fr]=Affiche l'aperçu en HTML du document Markdown en cours d'édition Authors=Michele Campeotto <[email protected]>\nJean-Philippe Fleury <[email protected]> Copyright=Copyright © 2005, 2006 Michele Campeotto\nCopyright © 2009, 2011-2012 Jean-Philippe Fleury Website=http://www.jpfleury.net/logiciels/gedit-markdown.php
-
Converta
/home/aarold/.local/share/gedit/plugins/markdown-preview/__init__.py
em python3:Executar:
2to3 -w /home/aarold/.local/share/gedit/plugins/markdown-preview/__init__.py
Por fim, abra este arquivo e edite a linha 86 (remova o modo binário,
"wb"
- >"w"
):with open(confFile, "w") as confFile:
-
Ative o plug-in no Gedit como você fez.