123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421 |
- <?xml version="1.0" encoding="utf-8"?>
- <!-- Created by Leo: http://leoeditor.com/leo_toc.html -->
- <leo_file xmlns:leo="http://leoeditor.com/namespaces/leo-python-editor/1.1" >
- <leo_header file_format="2"/>
- <globals/>
- <preferences/>
- <find_panel_settings/>
- <vnodes>
- <v t="caminhante.20210809161116.1"><vh>@settings</vh>
- <v t="caminhante.20200618180759.1"><vh>@command terminal-here @key=Alt-T</vh></v>
- <v t="caminhante.20200619162742.1"><vh>@command open-url-here @key=Ctrl-U</vh></v>
- <v t="caminhante.20200313155940.99"><vh>nodeActions</vh>
- <v t="caminhante.20200604232050.1"><vh>@cmd *</vh></v>
- <v t="caminhante.20200619161501.1"><vh>@download *</vh></v>
- <v t="caminhante.20200619155412.1"><vh>@duck *</vh></v>
- <v t="caminhante.20200927204806.1"><vh>@gcc|@gcc .* [X]</vh></v>
- <v t="caminhante.20200808174417.1"><vh>@js|@js .* [X]</vh></v>
- <v t="caminhante.20200912185313.1"><vh>@lua|@lua .* [X]</vh></v>
- <v t="caminhante.20210430163831.1"><vh>@mkdir *</vh></v>
- <v t="caminhante.20210430170244.1"><vh>@mv file://*</vh></v>
- <v t="caminhante.20200619213937.1"><vh>@node|@node .* [X]</vh></v>
- <v t="caminhante.20210608171556.1"><vh>@odt *</vh></v>
- <v t="caminhante.20210905232208.1"><vh>@rm *</vh></v>
- <v t="caminhante.20210430164404.1"><vh>@rmdir /*/</vh></v>
- <v t="caminhante.20200618203115.1"><vh>@run|@run .* [X]</vh></v>
- <v t="caminhante.20200619154823.1"><vh>@web *</vh></v>
- </v>
- </v>
- <v t="caminhante.20210809161032.2"><vh>MetaG</vh>
- <v t="caminhante.20210809161105.1"><vh>@path .</vh>
- <v t="caminhante.20210809161108.6"><vh>/.git/</vh></v>
- <v t="caminhante.20210809161108.4"><vh>@auto README.md</vh></v>
- <v t="caminhante.20210809161108.5"><vh>@edit LICENSE</vh></v>
- <v t="caminhante.20210807141115.1"><vh>@file parser.js</vh></v>
- <v t="caminhante.20210809161411.1"><vh>@file SourceCodeToTokenize.hpp</vh></v>
- <v t="caminhante.20210809161108.2"><vh>metag.leo</vh></v>
- </v>
- </v>
- </vnodes>
- <tnodes>
- <t tx="caminhante.20200313155940.99">@language python
- </t>
- <t tx="caminhante.20200604232050.1">import subprocess
- def execute (cmd):
- return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
- if c.isChanged(): c.save()
- path = c.getNodePath(c.p)
- g.os.chdir(path)
- command = ''.join(c.p.h.split('@cmd ')[1:])
- command = "cat <<'EOFEOFEOFEOFEOFEOF' | bash\n"+command+'\nEOFEOFEOFEOFEOFEOF'
- g.es(c.p.h)
- c.p.b += execute(command)
- c.save()
- </t>
- <t tx="caminhante.20200618180759.1">@language python
- import subprocess
- def execute (cmd):
- return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
- if c.isChanged(): c.save()
- path = c.getNodePath(c.p)
- execute('terminator --working-directory="'+path+'"')
- </t>
- <t tx="caminhante.20200618203115.1">@language python
- import subprocess
- def execute (cmd):
- return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
- path = c.getNodePath(c.p)
- g.os.chdir(path)
- w = c.frame.body.wrapper
- s1,s2 = w.getSelectionRange()
- if s1 == s2:
- code = c.p.b
- else:
- linebr = c.p.b.find('\n',s2)
- if linebr == -1: linebr = len(c.p.b)
- code = c.p.b[s1:s2]
- g.es(c.p.h)
- command = "cat <<'EOFEOFEOFEOFEOFEOF' | bash\n"+code+'\nEOFEOFEOFEOFEOFEOF'
- cpc = c.p.copy()
- novoNo = cpc.insertAsLastChild()
- novoNo.h = c.p.h
- novoNo.b = execute(command)
- c.redraw()
- c.save()
- w.setSelectionRange(s1,s2)
- </t>
- <t tx="caminhante.20200619154823.1">import subprocess
- def execute (cmd):
- return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
- if c.isChanged(): c.save()
- url = ''.join(c.p.h.split('@web ')[1:])
- command = 'lynx -image_links -dump "'+url+'"'
- g.es(c.p.h)
- c.p.b = execute(command)
- c.save()
- </t>
- <t tx="caminhante.20200619155412.1">import subprocess
- import urllib.parse
- def execute (cmd):
- return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
- if c.isChanged(): c.save()
- search = ''.join(c.p.h.split('@duck ')[1:])
- searchenc = urllib.parse.quote(search)
- command = 'lynx -dump "https://duckduckgo.com/html/?q='+searchenc+'&t=seamonkey"'
- g.es(c.p.h)
- c.p.b = execute(command)
- c.save()
- </t>
- <t tx="caminhante.20200619161501.1">import subprocess
- def execute (cmd):
- return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
- if c.isChanged(): c.save()
- path = c.getNodePath(c.p)
- g.os.chdir(path)
- url = ''.join(c.p.h.split('@download ')[1:])
- command = 'wget --no-config --continue --no-verbose --adjust-extension --tries=3 --content-on-error "'+url+'"'
- g.es(c.p.h)
- c.p.b += execute(command)
- c.save()
- </t>
- <t tx="caminhante.20200619162742.1">@language python
- # if c.isChanged(): c.save()
- w = c.frame.body.wrapper
- b = c.p.b
- i,j = w.getSelectionRange()
- selecao = b[i:j]
- cpc = c.p.copy()
- novoNo = cpc.insertAsLastChild()
- c.setHeadString(novoNo, '@web '+selecao)
- c.selectPosition(novoNo)
- c.redraw()
- </t>
- <t tx="caminhante.20200619213937.1">import subprocess
- import re
- def execute (cmd):
- return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
- path = c.getNodePath(c.p)
- g.os.chdir(path)
- code = re.sub(r'^#|\s+#', '\n///', g.getScript(c,c.p))
- g.es(c.p.h)
- command = "cat <<'EOFEOFEOFEOFEOFEOF' | node\n"+code+'\nEOFEOFEOFEOFEOFEOF'
- c.p.b += '\n' + execute(command)
- </t>
- <t tx="caminhante.20200808174417.1">import subprocess
- import re
- def execute (cmd):
- return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
- path = c.getNodePath(c.p)
- g.os.chdir(path)
- code = re.sub(r'^#|\s+#', '\n///', g.getScript(c,c.p))
- g.es(c.p.h)
- command = "cat <<'EOFEOFEOFEOFEOFEOF' | js\n"+code+'\nEOFEOFEOFEOFEOFEOF'
- c.p.b += '\n' + execute(command)
- </t>
- <t tx="caminhante.20200912185313.1">import subprocess
- import re
- def execute (cmd):
- return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
- path = c.getNodePath(c.p)
- g.os.chdir(path)
- code = re.sub(r'^#|\s+#', '\n---', g.getScript(c,c.p))
- g.es(c.p.h)
- command = "cat <<'EOFEOFEOFEOFEOFEOF' | lua\n"+code+'\nEOFEOFEOFEOFEOFEOF'
- c.p.b += '\n' + execute(command)
- </t>
- <t tx="caminhante.20200927204806.1">import subprocess
- import re
- def execute (cmd):
- return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
- path = c.getNodePath(c.p)
- g.os.chdir(path)
- code = re.sub(r'^#@|\s+#@', '\n///', g.getScript(c,c.p))
- args = ''.join(c.p.h.split('@gcc ')[1:])
- g.es(c.p.h)
- command = "cat <<'EOFEOFEOFEOFEOFEOF' | gcc -Wall -Werror -std=gnu11 -x c - -o t && ./t "+args+"\n"+code+'\nEOFEOFEOFEOFEOFEOF'
- c.p.b += '\n' + execute(command)
- </t>
- <t tx="caminhante.20210430163831.1">import subprocess
- def execute (cmd):
- return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
- path = c.getNodePath(c.p)
- g.os.chdir(path)
- path = ''.join(c.p.h.split('@mkdir ')[1:])
- cmd = 'mkdir -p "' + path + '"'
- g.es(c.p.h)
- execute(cmd)
- c.p.h = '/'+path+'/'
- c.p.b = '@path ' + path</t>
- <t tx="caminhante.20210430164404.1">import subprocess
- import shutil
- def execute (cmd):
- return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
- ps = c.p.parents()
- for par in ps:
- break
- path = c.getNodePath(par)
- g.os.chdir(path)
- path = ''.join(c.p.h.split('@rmdir /')[1:]).split('/')[0]
- shutil.rmtree(path)</t>
- <t tx="caminhante.20210430170244.1">import subprocess
- def execute (cmd):
- return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
- path = c.getNodePath(c.p)
- g.os.chdir(path)
- path = ''.join(c.p.h.split('@mv file://')[1:])
- cmd = 'mv -v "' + path + '" ./'
- g.es(c.p.h)
- g.es(execute(cmd))</t>
- <t tx="caminhante.20210608171556.1">import subprocess
- import re
- def execute (cmd):
- return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
- def writeFile (_file,_content):
- f = open(_file, "w")
- f.write(_content)
- f.close()
- path = c.getNodePath(c.p)
- g.os.chdir(path)
- docName = ''.join(c.p.h.split('@odt ')[1:])
- docPath = './.odt/'+docName+'/'
- manifest_xml = """<?xml version="1.0" encoding="UTF-8"?>
- <manifest:manifest
- xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2"
- xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0">
- <manifest:file-entry manifest:full-path="/" manifest:version="1.2" manifest:media-type="application/vnd.oasis.opendocument.text"/>
- <manifest:file-entry manifest:full-path="content.xml" manifest:media-type="text/xml"/>
- <manifest:file-entry manifest:full-path="meta.xml" manifest:media-type="text/xml"/>
- <manifest:file-entry manifest:full-path="manifest.rdf" manifest:media-type="application/rdf+xml"/>
- <manifest:file-entry manifest:full-path="styles.xml" manifest:media-type="text/xml"/>
- </manifest:manifest>
- """
- mimetype = "application/vnd.oasis.opendocument.text"
- content_xml = (
- """<?xml version="1.0" encoding="UTF-8"?>
- <office:document-content
- xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
- xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
- xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
- xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
- xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
- xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
- xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
- xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
- xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
- xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
- xmlns:math="http://www.w3.org/1998/Math/MathML"
- xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
- xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
- xmlns:ooo="http://openoffice.org/2004/office"
- xmlns:ooow="http://openoffice.org/2004/writer"
- xmlns:oooc="http://openoffice.org/2004/calc"
- xmlns:dom="http://www.w3.org/2001/xml-events"
- xmlns:xforms="http://www.w3.org/2002/xforms"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:rpt="http://openoffice.org/2005/report"
- xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2"
- xmlns:xhtml="http://www.w3.org/1999/xhtml"
- xmlns:grddl="http://www.w3.org/2003/g/data-view#"
- xmlns:officeooo="http://openoffice.org/2009/office"
- xmlns:tableooo="http://openoffice.org/2009/table"
- xmlns:drawooo="http://openoffice.org/2010/draw"
- xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
- xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
- xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0"
- xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
- xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2">
- <office:body>
- <office:text>
- """,
- re.sub(r'^#@[^\n]+|\s+#@[^\n]+', '', g.getScript(c,c.p)),
- """
- </office:text>
- </office:body>
- </office:document-content>
- """
- )
- manifest_rdf = """<?xml version="1.0" encoding="utf-8"?>
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
- <rdf:Description rdf:about="styles.xml">
- <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/odf#StylesFile"/>
- </rdf:Description>
- <rdf:Description rdf:about="">
- <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="styles.xml"/>
- </rdf:Description>
- <rdf:Description rdf:about="content.xml">
- <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/odf#ContentFile"/>
- </rdf:Description>
- <rdf:Description rdf:about="">
- <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="content.xml"/>
- </rdf:Description>
- <rdf:Description rdf:about="">
- <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#Document"/>
- </rdf:Description>
- </rdf:RDF>
- """
- meta_xml = f"""<?xml version="1.0" encoding="UTF-8"?>
- <office:document-meta
- xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
- xmlns:ooo="http://openoffice.org/2004/office"
- xmlns:grddl="http://www.w3.org/2003/g/data-view#" office:version="1.2">
- <office:meta>
- <meta:generator>LeoEditor/6.4$Linux_x64</meta:generator>
- <dc:title>{docName}</dc:title>
- </office:meta>
- </office:document-meta>
- """
- generate_odt = f"""cp -f styles.xml '{docPath}/styles.xml'; cd '{docPath}'; zip -q9ru doc.odt META-INF manifest.rdf meta.xml content.xml styles.xml mimetype"""
- generate_pdf = f"""libreoffice --headless --convert-to pdf '{docPath}/doc.odt' && mv 'doc.pdf' '{docName}.pdf'"""
- execute('mkdir -p "'+docPath+'/META-INF/"')
- writeFile(docPath+'/META-INF/manifest.xml', manifest_xml)
- writeFile(docPath+'/mimetype', mimetype)
- writeFile(docPath+'/content.xml',''.join(content_xml))
- writeFile(docPath+'/manifest.rdf', manifest_rdf)
- writeFile(docPath+'/meta.xml', meta_xml)
- # writeFile(docPath+'/styles.xml', styles_xml)
- execute(generate_odt)
- g.es(execute(generate_pdf))
- </t>
- <t tx="caminhante.20210809161032.2"></t>
- <t tx="caminhante.20210809161105.1">@tabwidth -2</t>
- <t tx="caminhante.20210809161108.2"></t>
- <t tx="caminhante.20210809161108.6">@path .git</t>
- <t tx="caminhante.20210809161116.1"></t>
- <t tx="caminhante.20210905232208.1">import subprocess
- def execute (cmd):
- return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
- path = c.getNodePath(c.p)
- g.os.chdir(path)
- filename = ''.join(c.p.h.split('@rm ')[1:])
- cmd = 'rm -vf "' + filename + '"'
- g.es(c.p.h)
- g.es(execute(cmd))</t>
- </tnodes>
- </leo_file>
|