pyegeria 5.3.3.13.dev2__py3-none-any.whl → 5.3.3.13.dev4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,35 +42,7 @@ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
42
42
  EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
43
43
  EGERIA_MERMAID_FOLDER = os.environ.get("EGERIA_MERMAID_FOLDER", "./work/mermaid_graphs")
44
44
 
45
- # Check Mermaid.js version
46
- # def check_mermaid_version():
47
- # """Check the version of Mermaid.js loaded in Jupyter Notebook"""
48
- # display(HTML("""
49
- # <script>
50
- # function checkMermaid() {
51
- # if (window.mermaid && typeof window.mermaid.version !== "undefined") {
52
- # console.log("Mermaid.js version:", mermaid.version);
53
- # alert("Mermaid.js version: " + mermaid.version);
54
- # } else {
55
- # console.warn("Mermaid.js is not loaded yet. Please ensure it's properly injected.");
56
- # alert("Mermaid.js is not loaded yet. Please ensure it's properly injected.");
57
- # }
58
- # }
59
- # // Delay execution to ensure Mermaid.js has had time to load
60
- # setTimeout(checkMermaid, 1000);
61
- # </script>
62
- # """))
63
-
64
- # another site to get mermaid from is "https://cdnjs.cloudflare.com/ajax/libs/mermaid/11.4.1/mermaid.min.js";
65
- # below was:
66
- #<script src="https://unpkg.com/mermaid@11.4.0/dist/mermaid.min.js"></script>
67
- # <script type="text/javascript">
68
- # if (!window.mermaid) {
69
- # var mermaidScript = document.createElement('script');
70
- # mermaidScript.src = https://unpkg.com/mermaid@11.4.1/dist/mermaid.min.js"
71
- # document.head.appendChild(mermaidScript);
72
- # }
73
- # </script>
45
+
74
46
  def load_mermaid():
75
47
  """Inject Mermaid.js library"""
76
48
  # Alternative CDN URL via unpkg
@@ -83,32 +55,26 @@ def load_mermaid():
83
55
  </script>
84
56
 
85
57
  """
86
- # mermaid_js = """
87
- # <script src="https://unpkg.com/mermaid@11.4.0/dist/mermaid.min.js"></script>
88
- # <script>
89
- # document.addEventListener('DOMContentLoaded', function() {{
90
- # mermaid.initialize({{"startOnLoad": true}});
91
- # }});
92
- # </script>
93
- #
94
- # """
58
+
95
59
  display(HTML(mermaid_js))
96
60
 
97
61
 
62
+ # def render_mermaid(mermaid_code):
63
+ # """Function to display a Mermaid diagram in a Jupyter notebook"""
64
+ # mermaid_html = f"""
65
+ # <div class="mermaid">
66
+ # {mermaid_code}
67
+ # </div>
68
+ # <script type="text/javascript">
69
+ # if (window.mermaid) {{
70
+ # mermaid.initialize({{startOnLoad: true}});
71
+ # mermaid.contentLoaded();
72
+ # }}
73
+ # </script>
74
+ # """
75
+ # display(HTML(mermaid_html))
98
76
  def render_mermaid(mermaid_code):
99
- """Function to display a Mermaid diagram in a Jupyter notebook"""
100
- mermaid_html = f"""
101
- <div class="mermaid">
102
- {mermaid_code}
103
- </div>
104
- <script type="text/javascript">
105
- if (window.mermaid) {{
106
- mermaid.initialize({{startOnLoad: true}});
107
- mermaid.contentLoaded();
108
- }}
109
- </script>
110
- """
111
- display(HTML(mermaid_html))
77
+ return display(HTML(construct_mermaid_html(mermaid_code)))
112
78
 
113
79
 
114
80
  def parse_mermaid_code(mermaid_code):
@@ -124,15 +90,15 @@ def construct_mermaid_html(mermaid_str: str) -> str:
124
90
  """Function to display a HTML code in a Jupyter notebook"""
125
91
  title, mermaid_code = parse_mermaid_code(mermaid_str)
126
92
 
127
- html_prefix = """
93
+ html_section1 = """
128
94
  <html>
129
95
  <head>
130
96
  <style type="text/css">
131
97
  #mySvgId {
132
98
  width: 100%;
133
- height: 100%;
134
- overflow: hidden;
135
- border: 1px solid #ccc;
99
+ height: 600px;
100
+ overflow: scroll;
101
+ border: 2px solid #ccc;
136
102
  position: relative;
137
103
  margin-bottom: 10px;
138
104
  }
@@ -142,8 +108,13 @@ def construct_mermaid_html(mermaid_str: str) -> str:
142
108
 
143
109
  </style>
144
110
  </head>
145
-
111
+ """
112
+ html_section2 = """"
113
+ <title>{title}</title>
114
+ """
115
+ html_section3 = """
146
116
  <body>
117
+
147
118
  <div id="graphDiv"></div>
148
119
  <script src="https://bumbu.me/svg-pan-zoom/dist/svg-pan-zoom.min.js"></script>
149
120
  <script type="module">
@@ -176,7 +147,7 @@ def construct_mermaid_html(mermaid_str: str) -> str:
176
147
  const graphDefinition = `
177
148
  """
178
149
 
179
- html_postfix = """`;
150
+ html_section4 = """`;
180
151
  const {svg} = await mermaid.render('mySvgId', graphDefinition);
181
152
  element.innerHTML = svg.replace(/( )*max-width:( 0-9\.)*px;/i, '');
182
153
 
@@ -233,7 +204,7 @@ def construct_mermaid_html(mermaid_str: str) -> str:
233
204
  </body>
234
205
  """
235
206
 
236
- return html_prefix + mermaid_code + html_postfix
207
+ return html_section1 + html_section2 + html_section3 + mermaid_code + html_section4
237
208
 
238
209
  def save_mermaid_html(title: str, mermaid_str: str, folder:str = EGERIA_MERMAID_FOLDER):
239
210
  """Save a Mermaid diagram to a file"""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyegeria
3
- Version: 5.3.3.13.dev2
3
+ Version: 5.3.3.13.dev4
4
4
  Summary: A python client for Egeria
5
5
  License: Apache 2.0
6
6
  Keywords: egeria,metadata,governance
@@ -229,7 +229,7 @@ pyegeria/feedback_manager_omvs.py,sha256=B66e3ZCaC_dirb0mcb2Nz3PYh2ZKsoMAYNOb3eu
229
229
  pyegeria/full_omag_server_config.py,sha256=k3fUfopAFAE3OKkFR7zZPiki_FYj6j2xQ4oD2SVaefQ,47350
230
230
  pyegeria/glossary_browser_omvs.py,sha256=NcitYaZJqwVODBO5zBtWpXPNUJJ3DKzEbRaOFSAyUlg,93554
231
231
  pyegeria/glossary_manager_omvs.py,sha256=tBjoHrrHJLasXoeQSpW-KpF3vEQdN_GR3jfcceTjt_c,132444
232
- pyegeria/mermaid_utilities.py,sha256=h1OTqYMGu6XZNL5NX-KOZN3c2-m5dKVbg_nZJyx30-0,19141
232
+ pyegeria/mermaid_utilities.py,sha256=dJgkRl_uG3qT0wID6QadKrcFjIxscFcZ-PspYTX3Pf8,17788
233
233
  pyegeria/metadata_explorer_omvs.py,sha256=XBg6q-JXOA8UYsT85nlpBVe4EQ6jxwj70MvE7tkVvH0,86905
234
234
  pyegeria/my_profile_omvs.py,sha256=DyECbUFEcgokrIbzdMMNljC3bqfqKGXAF2wZEpzvRYs,34666
235
235
  pyegeria/platform_services.py,sha256=CJIOYIFEbcIGwdWlApAQcXxZTsdrhFtpJcm4O3p7dG0,41646
@@ -242,8 +242,8 @@ pyegeria/template_manager_omvs.py,sha256=Sw5xsQAhy7a48xFCg59mg9_nqyhawoS9v4WyF-P
242
242
  pyegeria/utils.py,sha256=1h6bwveadd6GpbnGLTmqPBmBk68QvxdjGTI9RfbrgKY,5415
243
243
  pyegeria/valid_metadata_omvs.py,sha256=cCt5CCLv6BdzCu90n68r_PkG_PEQJjrtwCxio7K6yko,65034
244
244
  pyegeria/x_action_author_omvs.py,sha256=xu1IQ0YbhIKi17C5a7Aq9u1Az2czwahNPpX9czmyVxE,6454
245
- pyegeria-5.3.3.13.dev2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
246
- pyegeria-5.3.3.13.dev2.dist-info/METADATA,sha256=VJIumBR752V1gPFhdDTKMmv7RbeT7z56Xs3UW-oqqCY,2741
247
- pyegeria-5.3.3.13.dev2.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
248
- pyegeria-5.3.3.13.dev2.dist-info/entry_points.txt,sha256=cLnCR81Pm2c35hDDg7BOlQ9Mtvx5wofuvwXHnL1bGis,5956
249
- pyegeria-5.3.3.13.dev2.dist-info/RECORD,,
245
+ pyegeria-5.3.3.13.dev4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
246
+ pyegeria-5.3.3.13.dev4.dist-info/METADATA,sha256=W9zH0QLLrGpsrxHbB7HZVp3xMnfjrP1CwSk7BBS8eK8,2741
247
+ pyegeria-5.3.3.13.dev4.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
248
+ pyegeria-5.3.3.13.dev4.dist-info/entry_points.txt,sha256=cLnCR81Pm2c35hDDg7BOlQ9Mtvx5wofuvwXHnL1bGis,5956
249
+ pyegeria-5.3.3.13.dev4.dist-info/RECORD,,