Skip to content

Commit

Permalink
Pdf SBV (#42)
Browse files Browse the repository at this point in the history
Pdf SBV

Reviewed-by: Tino Schr
  • Loading branch information
SebastianGode authored Dec 9, 2024
1 parent 4c10728 commit 69db411
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
9 changes: 9 additions & 0 deletions doc/source/examples/directives_bd.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Business Dashboard
==================


.. directive_wrapper::
:class: container-sbv

.. service_card::
:service_type: bd
13 changes: 13 additions & 0 deletions doc/source/examples/directives_geminidb_internal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
GeminiDB - Internal
===================

.. directive_wrapper::
:class: container-sbv
:id: test2

.. service_card::
:environment: internal
:service_type: geminidb
:umn: This document describes basic concepts, functions, key terms, and FAQs of ECSs and provides instructions for applying for and using ECSs.
:api-ref: This document describes application programming interfaces (APIs) of Elastic Cloud Server (ECS) and provides API parameter description and example values.
:dev: This document describes how to call the APIs of Elastic Cloud Server (ECS) to use ECS functions.
2 changes: 2 additions & 0 deletions doc/source/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Documentation Examples
directives_obs_clean
directives_ecs
directives_ecs_internal
directives_bd
directives_geminidb_internal
directives_docsportal
container_item
card_item
Expand Down
19 changes: 17 additions & 2 deletions otc_sphinx_directives/service_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def service_card_html(self, node):
docs = sort_docs(service['documents'])

for doc in docs:

environment = doc.get('environment')
if environment == "hidden":
continue
Expand All @@ -113,7 +114,7 @@ def service_card_html(self, node):
else:
link = doc['link']

data = '<div class="card item-sbv">'
data = '<div class="card item-sbv item-sbv-flex">'
data += (f'<a href="{link}">')
data += (
'<div class="card-body">'
Expand All @@ -126,8 +127,22 @@ def service_card_html(self, node):
data += (
f'<p>{node[doc["type"]]}</p>'
)
data += '</div></a></div>'
data += '</div></a>'
try:
if doc["pdf_enabled"]:
data += (f'''
<scale-button variant="secondary" class="pdf-button-sbv" href="/{node['service_type']}-{doc["type"]}.pdf" target="_blank">
<scale-icon-user-file-pdf-file accessibility-title="pdf-file"></scale-icon-user-file-pdf-file>
<span style="font-weight: normal;">Download PDF</span>
</scale-button>
''')
except Exception:
print("Service " + node['service_type'] + " has not defined pdf_enabled!")

data += '</div>'

self.body.append(data)

raise nodes.SkipNode


Expand Down

0 comments on commit 69db411

Please sign in to comment.