Skip to content

Commit

Permalink
Add check for pdf visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianGode committed Dec 10, 2024
1 parent 302facf commit 902106b
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 7 deletions.
15 changes: 15 additions & 0 deletions doc/source/examples/directives_as.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Auto Scaling
============

Long Long Long Auto Scaling description which is very important.


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

.. service_card::
:service_type: as
:umn: This document describes basic concepts, functions, key terms, and FAQs of ASs and provides instructions for applying for and using ASs.
:api-ref: This document describes application programming interfaces (APIs) of AS (ECS) and provides API parameter description and example values.
:dev: This document describes how to call the APIs of AS (AS) to use AS functions.
16 changes: 16 additions & 0 deletions doc/source/examples/directives_as_internal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Auto Scaling - Internal
=======================

Long Long Long Auto Scaling description which is very important.


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

.. service_card::
:environment: internal
:service_type: as
:umn: This document describes basic concepts, functions, key terms, and FAQs of ASs and provides instructions for applying for and using ASs.
:api-ref: This document describes application programming interfaces (APIs) of AS (AS) and provides API parameter description and example values.
:dev: This document describes how to call the APIs of AS (AS) 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_as
directives_as_internal
directives_bd
directives_geminidb_internal
directives_docsportal
Expand Down
18 changes: 11 additions & 7 deletions otc_sphinx_directives/service_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,19 @@ def service_card_html(self, node):
)
data += '</div></a>'
try:
pdf_environment = doc.get('pdf_environment')
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>
''')
if pdf_environment == "hidden":
print("PDF not enabled anywhere!")
elif ((pdf_environment == "internal" and node['environment'] == "internal") or (pdf_environment == "public")):
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!")
print("Service " + node['service_type'] + " has not defined pdf_enabled or pdf_environment!")

data += '</div>'

Expand Down

0 comments on commit 902106b

Please sign in to comment.