1
0
mirror of https://github.com/chubin/cheat.sh.git synced 2026-06-20 13:16:44 +02:00

initial support for rosettacode integration (#112)

This commit is contained in:
Igor Chubin
2019-02-08 18:03:58 +00:00
parent bd05ce4193
commit 4d044c0456
4 changed files with 10 additions and 1 deletions
+1
View File
@@ -209,6 +209,7 @@ def _visualize(query, keyword, answers, request_options, html=None): # pylint: d
topic_type = get_topic_type(topic)
highlight = (highlight
and not topic.endswith('/:list')
and topic not in [":list", ":bash_completion"]
and topic_type not in ["unknown"]
)
+7 -1
View File
@@ -24,6 +24,8 @@ import adapter.cmd
import adapter.latenz
import adapter.question
import adapter.internal
import adapter.rosetta
import adapter.learnxiny
class Router(object):
@@ -59,6 +61,7 @@ class Router(object):
"cheat": adapter.cmd.Cheat(),
"fosdem": adapter.cmd.Fosdem(),
"translation": adapter.cmd.Translation(),
"rosetta": adapter.rosetta.Rosetta(),
}
self._topic_list = {
@@ -89,6 +92,7 @@ class Router(object):
("learnxiny", get_learnxiny),
("question", adapter.question.get_page),
("fosdem", self._adapter["fosdem"].get_page),
("rosetta", self._adapter["rosetta"].get_page),
("tldr", self._adapter["tldr"].get_page),
("internal", self._adapter["internal"].get_page),
("cheat", self._adapter["cheat"].get_page),
@@ -106,7 +110,7 @@ class Router(object):
return self._cached_topics_list
# merging all top level lists
sources_to_merge = ['tldr', 'cheat', 'cheat.sheets', 'learnxiny']
sources_to_merge = ['tldr', 'cheat', 'cheat.sheets', 'learnxiny', 'rosetta']
if not skip_dirs:
sources_to_merge.append("cheat.sheets dir")
if not skip_internal:
@@ -134,6 +138,8 @@ class Router(object):
if topic == "":
return "search"
if re.match('[^/]*/rosetta(/|$)', topic):
return "rosetta"
if topic.startswith(":"):
return "internal"
if topic.endswith("/:list"):
+2
View File
@@ -39,6 +39,7 @@ if USE_OS_PACKAGES:
PATH_CHEAT_SHEETS_SPOOL = "/home/igor/cheat.sheets/spool/"
PATH_LEARNXINY = "/home/igor/git/github.com/adambard/learnxinyminutes-docs"
PATH_LATENZ = "/home/igor/git/github.com/chubin/late.nz/bin"
ROSETTA_PATH = '/home/igor/git/github.com/acmeism/RosettaCodeData'
else:
PATH_TLDR_PAGES = os.path.join(MYDIR, "cheatsheets/tldr/*/*.md")
PATH_CHEAT_PAGES = os.path.join(MYDIR, "cheatsheets/cheat/*")
@@ -46,6 +47,7 @@ else:
PATH_CHEAT_SHEETS_SPOOL = os.path.join(MYDIR, "cheatsheets/spool/")
PATH_LEARNXINY = os.path.join(MYDIR, "cheatsheets/learnxinyminutes-docs")
PATH_LATENZ = os.path.join(MYDIR, "late.nz/bin")
ROSETTA_PATH = os.path.join(MYDIR, "acmeism/RosettaCodeData")
GITHUB_REPOSITORY = {
"late.nz" : 'chubin/late.nz',