From 649a0278dda427e8b02223886ff400297ce5f6b4 Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Thu, 18 Jan 2024 00:31:15 -0600 Subject: [PATCH] bug fixes: links in markdown documents --- cms/cloud.py | 13 +- index.py | 1 + static/css/default.css | 322 +---------------------------------------- static/js/menu.js | 2 +- templates/header.html | 2 +- templates/index.html | 7 +- templates/pane.html | 2 +- 7 files changed, 21 insertions(+), 328 deletions(-) diff --git a/cms/cloud.py b/cms/cloud.py index d13113a..724bc84 100644 --- a/cms/cloud.py +++ b/cms/cloud.py @@ -20,7 +20,8 @@ def _format_root_folder (_root): _root = _root[1:] if _root[-1] == '/' : _root = _root[:-1] - return _root + + return _root.replace('//','/') def content(_args): """ :url @@ -92,13 +93,19 @@ def html (uri,_config) : _prefix = '/'.join (uri.split('/')[:-1]) + _link = '/'.join(['{{context}}api/cloud/download?doc='+_prefix,'.attachments.']) + print ([_link]) # _link = '/'.join(['api/cloud/download?doc='+_prefix,'_images']) - _html = _handler.get_file_contents(uri).decode('utf-8').replace('.attachments.',_link) + _html = _handler.get_file_contents(uri).decode('utf-8')#.replace('.attachments.', copy.deepcopy(_link)) # print ([uri,uri[-2:] ,uri[-2:] in ['md','MD','markdown']]) _handler.logout() # if uri.endswith('.md'): - # _html = _html.replace(_root,('{{context}}api/cloud/download?doc='+_root)) + + _html = _html.replace(_root,('{{context}}api/cloud/download?doc='+_root)).replace('.attachments.', copy.deepcopy(_link)) + if '.attachments.' in _html : + print (_html) + # _html = _html.replace('
','') return markdown(_html) if uri[-2:] in ['md','MD','Md','mD'] else _html # def update (_config): # """ diff --git a/index.py b/index.py index 2c08ea8..fce5c8a 100644 --- a/index.py +++ b/index.py @@ -81,6 +81,7 @@ def _dialog (): _system = copy.deepcopy(_config['system']) _html = cms.components.html(_uri,_id,_config,_system) + e = Environment(loader=BaseLoader()).from_string(_html) if 'source' in _system : del _system['source'] diff --git a/static/css/default.css b/static/css/default.css index 5208706..77e81d3 100644 --- a/static/css/default.css +++ b/static/css/default.css @@ -14,86 +14,9 @@ body { font-size:16px; font-family: sans-serif; font-weight:lighter; -} -.main{ - margin-left:10%; - margin-right:10%; - display:grid; - grid-template-rows:120px 48px auto 48px; - grid-template-columns: 70% auto; - gap:8px; - - min-height:98vh; - - -} -.bold {font-weight:bold} -.menu { - padding:8px; - border:1px solid #CAD5E0 ; - - display:grid; - grid-column: 1 / span 2; - grid-template-columns: 92px repeat(7,auto); - gap:4px; - text-transform: capitalize; - align-items: center; - -} -.menu .item { - font-weight:bold; - cursor:pointer; - padding:4px; - text-align: left; - - - - - -} - -.menu .sub-menu { - - display:none; - position:absolute; - - margin-top:2px; - min-width:10%; - z-index:90; - padding:8px; - font-weight:lighter; - text-align:left; - align-items:left; - background-color: rgba(255,255,255,0.8); - -} - -.menu .item:hover .sub-menu{ - - display:block; - height:auto; -} -.header { - - display:grid; - grid-column: 1 / span 2; - grid-template-columns: 128px auto; - gap:4px; - align-items:center ; - align-content: center; - text-transform: capitalize; - /* background-color: rgba(255,255,255,0.8); */ - - - } -.header .title { - display:grid; - align-content: center; - font-size:24px; - font-weight:bold; -} +.bold {font-weight:bold} .header img { width:100%;} @@ -113,42 +36,8 @@ body { grid-column: 1 /span 2; } -.main .content { - padding:8px; - - /* box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.25); */ - /* transition: all 0.2s; */ - -} -.main .content img {width:78%} - -.index { - height:100%; - padding:4px; - display:grid; - align-items: center; - grid-template-rows: 80% auto; - align-content: center; - text-align: center; - - -} .large-text {font-size: 24px; font-weight: bold;} -.index .background { - - - border:2px solid transparent; - padding:2px; - /* Add the blur effect */ - filter: blur(1.5px); - -webkit-filter: blur(1.5px); - -} -.pane { - padding:8px; - border-left:1px solid #CAD5E0; - /* background-color: rgba(255,255,255,0.8); */ -} + .active { padding:4px; cursor:pointer; @@ -190,210 +79,3 @@ body { grid-template-columns: auto 115px; gap:4px; } -/* -* components: people -*/ -.people .current, .alumni { - display:grid; - grid-template-columns: repeat(3,1fr); - overflow:hidden; - gap:30px; -} -/* .people .alumni { - display:grid; - grid-template-columns: repeat(3,1fr); - - gap:10px; -} */ - -.people .person { - box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.25); - /* background: radial-gradient(#1fe4f5, #3fbafe); */ - display:grid; - min-height:150px; - grid-template-columns: 120px auto ; - gap:2px; - align-items:center; - overflow:hidden; - - - - - -} -.people .person .name{ - - font-size:22px; text-transform:capitalize; font-weight:normal; - - width:200px; overflow:hidden; - text-transform:capitalize; - -o-text-overflow:ellipsis; - text-overflow:ellipsis; - white-space:nowrap; - overflow:hidden; -} -.person .position { - width:200px; overflow:hidden; - text-transform:capitalize; - -o-text-overflow:ellipsis; - text-overflow:ellipsis; - white-space:nowrap; - overflow:hidden; - - -} -.person .picture { - width:120px; - height:120px; - overflow:hidden; - - - display:grid; - align-content:center ; - align-items:center; - justify-content: center; - justify-items: center; -} -.person .picture .frame { width:100px; height:100px; overflow:hidden;} -.person .picture img { - width:120px; - height:120px; - display:block; margin:auto; -} - - - -/** -* components: search -*/ -.search .frame .suggestion-frame { - width:98%; - overflow: hidden; - overflow-y: auto; - word-wrap: normal; - margin-top:2px; - border-right:1px solid #CAD5E0; -} -.search .frame .suggestion-frame .suggestions { - display:none; - position:absolute; - width:55%; - height:55%; - z-index:9; - overflow:hidden; - overflow-y: auto; - padding:4px;; - - - - -} -.search .frame .input-frame{ - display:grid; - grid-template-columns: auto 32px 48px ; - gap:4px; - align-items: center; - align-content:center; - padding:4px; - background-color: rgba(255,255,255,0.8); -} -.search .frame .input-frame i {color:#000000} -.search .frame .input-frame .found { font-size:11px; color:maroon; text-align: center;} -.search .frame input[type="text"] { - - padding:8px; - font-size:14px; - font-weight:normal; - border:2px solid transparent; - outline: 0px; - background-color:#D3D3D3; - -} - -.search .frame .suggestions .item { - display:grid; - grid-template-columns: 60px auto ; - height:60px; - gap:4px; - padding:8px; - align-items:center; -} - -.search .frame .suggestions .item .title { width:85%; overflow:hidden; font-size:14px; font-weight: normal; text-transform:capitalize; text-overflow: ellipsis; white-space: nowrap;} -.search .frame .suggestions .item .author {width:80%; overflow:hidden; font-size:14px; font-weight: lighter;text-transform: capitalize;text-overflow: ellipsis; white-space: nowrap;} -.search .frame .suggestions .item .picture{ - height:50px; - display:grid; - grid-template-columns: auto; - padding:4px; -} -.search .frame .suggestions .item .link { - display:grid; - grid-template-columns: auto 120px; - - font-size:12px; - align-items:center; - align-content: center; - overflow:hidden; -} -.frame .suggestions .item .picture .frame {background-size: cover;} - - -.resume { - - display:grid; - grid-template-columns: 200px auto; - gap:4px; - text-transform: capitalize; - height:90vh; - -} -.resume .article { - margin:4px; - background-color:rgba(255,255,255,0.8); - padding:4px; - color:#000000; - display:grid; - grid-template-columns:5% 86% 8%; - grid-gap:4px; - align-items:center; - -} -.small {font-size:12px;} -.resume .picture {display:grid; height:300px; align-items:center; align-content: center; overflow:hidden} -.resume .picture div {height:200px; background-position: center;background-position-y: .5px; background-size: cover; background-repeat: no-repeat;} - -.resume .name {font-weight:bold; font-size:22px;} -.resume .position {word-wrap: break-word; margin-top:4px;} -.card {box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.25);} -.resume .article .title {overflow:hidden; font-weight:bold;; text-overflow: ellipsis; white-space: nowrap; } -.resume .article .citation {font-family:courier;} -.resume .publications {height:75%; overflow:hidden; overflow-y:auto; } - -.class { - display:grid; - grid-template-columns: auto repeat(3,1fr); - gap:1px; - background-color: rgba(255,255,255,0.8); - padding:4px; - color:black; font-size:18px; - -} - -.class .description { - font-size:22px; - font-weight:bold; - display:grid; - padding:8px; - align-items:center; - align-content: center; - justify-items: center; -} - -.news { - background-color: rgba(255, 255, 255, 0.25); - height:99%; - padding:9px; - overflow:hidden; - overflow-y: auto; -} \ No newline at end of file diff --git a/static/js/menu.js b/static/js/menu.js index faa61a0..4253b45 100644 --- a/static/js/menu.js +++ b/static/js/menu.js @@ -72,7 +72,7 @@ menu.apply_link =function(_args){ // jx.modal.show(_html) var http = HttpClient.instance() http.setHeader('uri',_args.uri) - http.setHeader('dom','dialog') + http.setHeader('dom',(_args.title)?_args.title:'dialog') // http.setHeader('dom',_args.text) http.get('/dialog',function(x){ diff --git a/templates/header.html b/templates/header.html index 5958df1..0a3d6b6 100644 --- a/templates/header.html +++ b/templates/header.html @@ -4,5 +4,5 @@ {% endif %}
{{layout.header.title}}
-
{{layout.header.subtitle}}
+
{{layout.header.subtitle}}
\ No newline at end of file diff --git a/templates/index.html b/templates/index.html index e1aef67..b2aff4d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -21,13 +21,16 @@ Vanderbilt University Medical Center - + + + + - + diff --git a/templates/pane.html b/templates/pane.html index dd85b40..8dc6779 100644 --- a/templates/pane.html +++ b/templates/pane.html @@ -3,4 +3,4 @@ Hard code whatever you want here @TODO: Perhaps have code to add things here onload --> - +