GEdit configuration

Submitted by code_admin on Wed, 07/25/2018 - 10:26

Steps I have taking when configuring gedit:

Getting XML Format working

(Ubuntu)

Enable External Tools in gedit.

Install python lxml:

  1. sudo apt-get install python-lxml

Then add a tool:
tools -> manage external tools
Press +
XML Format
Paste:

! /usr/bin/env python

import sys
import lxml.etree as etree
import traceback

result = ''
for line in sys.stdin:
result += line
try:
x = etree.fromstring(result)
result = etree.tostring(x, pretty_print=True, xml_declaration=True, encoding="UTF-8")
except:
etype, evalue, etraceback = sys.exc_info()
traceback.print_exception(etype, evalue, etraceback, file=sys.stderr)
print result
Input: Current Document
Output: Replace Current Document

RJM Article Type
Work Notes