Subversion Repositories KB4IT

Compare Revisions

Ignore whitespace Rev 63 → Rev 64

/branches/BR-0.5/kb4it/kb4it.py
20,6 → 20,7
import datetime as dt
from datetime import datetime
import traceback as tb
from urllib.parse import quote, unquote
from concurrent.futures import ThreadPoolExecutor as Executor
 
from .rdfdb import *
207,12 → 208,13
tagcloud = self.create_tagcloud_from_key(key)
alist = ''
for value in values:
alist += "* <<%s_%s.adoc#,%s>>\n" % (key, value, value)
alist += "* <<%s_%s.adoc#,%s>>\n" % (key, value, unquote(value))
 
return html % (tagcloud, alist)
 
 
def process_docs(self):
self.log.debug("H E L L O")
TOP_NAV_BAR = self.get_template('TPL_TOP_NAV_BAR')
attributes = self.graph.get_attributes()
for attribute in attributes:
227,9 → 229,10
for value in values:
# Create .adoc from value
docname = "%s/%s_%s.adoc" % (self.tmpdir, key, value)
self.log.debug("Document processed: %s", docname)
with open(docname, 'w') as fvalue:
TPL_VALUE = self.get_template('TPL_VALUE')
fvalue.write(TPL_VALUE % (key, value))
fvalue.write(TPL_VALUE % (key, unquote(value)))
 
# Search documents related to this key/value
docs = self.graph.subjects(RDF['type'], URIRef(KB4IT['Document']))
236,6 → 239,7
for doc in docs:
try:
objects = self.graph.objects(doc, attribute)
self.log.debug(objects)
if Literal(value) in list(objects):
title = self.graph.value(doc, KB4IT['hasTitle'])
fvalue.write("* <<%s#,%s>>\n" % (os.path.basename(doc)[:-5], title))
252,6 → 256,7
self.create_all_keys_page()
self.log.info("4. Document's metadata processed")
 
 
def create_tagcloud_from_key(self, key):
dkeyurl = {}
docs = list(self.graph.subjects(RDF['type'], URIRef(KB4IT['Document'])))
288,8 → 293,8
for word in lwords:
frequency = len(dkeyurl[word])
size = get_font_size(frequency, max_frequency)
url = "%s_%s.html" % (key, word)
chunk = "<div class=\"tagcloud-word\"><a style=\"text-decoration: none;\" href=\"%s\"><span style=\"font-size:%dpt;\">%s</span></a></div>" % (url, size, word)
url = "%s_%s.html" % (key, quote(word))
chunk = "<div class=\"tagcloud-word\"><a style=\"text-decoration: none;\" href=\"%s\"><span style=\"font-size:%dpt;\">%s</span></a></div>" % (url, size, unquote(word))
html += chunk
html += "</div>"
else:
438,7 → 443,7
for value in values:
if len(value) > 0:
key = predicate[predicate.rfind('/')+4:]
html += "<a class=\"metadata\" href=\"%s_%s.html\">%s</a> " % (key, value, value)
html += "<a class=\"metadata\" href=\"%s_%s.html\">%s</a> " % (key, quote(value), unquote(value))
else:
html = ''
except Exception as error:
/branches/BR-0.5/kb4it/utils.py
11,6 → 11,7
import logging
import traceback as tb
import shutil
from urllib.parse import quote, unquote
 
def copydir(source, dest):
"""Copy a directory structure overwriting existing files
78,7 → 79,7
if len(item) > 0:
if lower:
item = item.lower()
newlist.append(item.strip())
newlist.append(quote(item.strip()))
newlist.sort()
 
return newlist
/branches/BR-0.5/source/kb4it_about.adoc
1,5 → 1,5
= About KB4IT
:Author: t00mlabs
:Author: Tomás Vírseda, человек
:Revnumber: v0.2
:Revdate: 2018-09-05
:Category: Help
/branches/BR-0.5/source/kb4it_expimp.adoc
1,5 → 1,5
= Backup/Restore your repository
:Author: t00mlabs
:Author: Tomás Vírseda
:Revnumber: v0.1
:Revdate: 2018-07-27
:Category: Help
/branches/BR-0.5/source/kb4it_find.adoc
1,5 → 1,5
= How to find documents
:Author: t00mlabs
:Author: Tomás Vírseda
:Revnumber: v0.2
:Revdate: 2018-09-05
:Category: Help
/branches/BR-0.5/source/kb4it_publish.adoc
1,5 → 1,5
= How to publish documents
:Author: t00mlabs
:Author: Tomás Vírseda
:Revnumber: v0.2
:Revdate: 2018-09-05
:Category: Help
/branches/BR-0.5/source/kb4it_write.adoc
1,5 → 1,5
= How to write technical documentation
:Author: t00mlabs
:Author: Tomás Vírseda
:Revnumber: v0.2
:Revdate: 2018-09-05
:Category: Procedure
8,7 → 8,7
:Department:
:Team:
:Tag: help, asciidoctor, markdown, write, technical, documentation
:Priority: High
:Priority: Very High
 
// END-OF-HEADER. DO NOT MODIFY OR DELETE THIS LINE
 
/branches/BR-0.5/install_kb4it.sh
0,0 → 1,0
python3 setup.py install --user
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property