Coverage for sphinx_reports / LaTeX.py: 87%

15 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-05-16 00:05 +0000

1# ==================================================================================================================== # 

2# _ _ _ # 

3# ___ _ __ | |__ (_)_ __ __ __ _ __ ___ _ __ ___ _ __| |_ ___ # 

4# / __| '_ \| '_ \| | '_ \\ \/ /____| '__/ _ \ '_ \ / _ \| '__| __/ __| # 

5# \__ \ |_) | | | | | | | |> <_____| | | __/ |_) | (_) | | | |_\__ \ # 

6# |___/ .__/|_| |_|_|_| |_/_/\_\ |_| \___| .__/ \___/|_| \__|___/ # 

7# |_| |_| # 

8# ==================================================================================================================== # 

9# Authors: # 

10# Patrick Lehmann # 

11# # 

12# License: # 

13# ==================================================================================================================== # 

14# Copyright 2026-2026 Patrick Lehmann - Bötzingen, Germany # 

15# # 

16# Licensed under the Apache License, Version 2.0 (the "License"); # 

17# you may not use this file except in compliance with the License. # 

18# You may obtain a copy of the License at # 

19# # 

20# http://www.apache.org/licenses/LICENSE-2.0 # 

21# # 

22# Unless required by applicable law or agreed to in writing, software # 

23# distributed under the License is distributed on an "AS IS" BASIS, # 

24# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # 

25# See the License for the specific language governing permissions and # 

26# limitations under the License. # 

27# # 

28# SPDX-License-Identifier: Apache-2.0 # 

29# ==================================================================================================================== # 

30# 

31from textwrap import dedent 

32from typing import Tuple 

33 

34from sphinx.writers.latex import LaTeXTranslator 

35 

36from pyTooling.Decorators import export 

37from sphinx_reports.Common import visitFunc, departFunc 

38from sphinx_reports.Node import Landscape 

39 

40 

41__all__ = ["translateLandscape"] 

42 

43 

44@export 

45def visit_Landscape(translator: LaTeXTranslator, node: Landscape) -> None: 

46 """ 

47 Call back function for visiting a :class:`Landscape`. 

48 

49 This function begins a ``landscape`` environment in LaTeX. 

50 

51 :param translator: The LaTeX translator instance. 

52 :param node: The current node being visited. 

53 """ 

54 translator.body.append(dedent(""" 

55 \\begin{landscape} 

56 """) 

57 ) 

58 

59@export 

60def depart_Landscape(translator: LaTeXTranslator, node: Landscape) -> None: 

61 """ 

62 Call back function for departing a :class:`Landscape`. 

63 

64 This function ends a ``landscape`` environment in LaTeX. 

65 

66 :param translator: The LaTeX translator instance. 

67 :param node: The current node being departed. 

68 """ 

69 translator.body.append(dedent(""" 

70 \\end{landscape} 

71 """) 

72 ) 

73 

74 

75translateLandscape: Tuple[visitFunc, departFunc] = (visit_Landscape, depart_Landscape) 

76"""A tuple combining both ``visit_*`` and ``depart_*`` call back functions for a :class:`Landscape` node."""