| Conditions | 1 |
| Total Lines | 76 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | from unittest import TestCase |
||
| 55 | def test_referencing_link_latex(self): |
||
| 56 | verify_conversion( |
||
| 57 | self, |
||
| 58 | r""" |
||
| 59 | --- |
||
| 60 | pandoc-numbering: |
||
| 61 | exercise: |
||
| 62 | general: |
||
| 63 | cite-shortcut: True |
||
| 64 | latex: |
||
| 65 | format-link-classic: '**%D %d %g %s %n %p**' |
||
| 66 | format-link-title: '**%D %d %T %t %g %s %n %p**' |
||
| 67 | --- |
||
| 68 | |||
| 69 | Title |
||
| 70 | ===== |
||
| 71 | |||
| 72 | Exercise -.#first |
||
| 73 | |||
| 74 | Exercise (Title) -.#second |
||
| 75 | |||
| 76 | See @exercise:first |
||
| 77 | |||
| 78 | See @exercise:second |
||
| 79 | """, |
||
| 80 | r""" |
||
| 81 | --- |
||
| 82 | header-includes: |
||
| 83 | - | |
||
| 84 | ` |
||
| 85 | \makeatletter |
||
| 86 | \@ifpackageloaded{subfig}{ |
||
| 87 | \usepackage[subfigure]{tocloft} |
||
| 88 | }{ |
||
| 89 | \usepackage{tocloft} |
||
| 90 | } |
||
| 91 | \makeatother |
||
| 92 | `{=tex} |
||
| 93 | - "`\\usepackage{etoolbox}`{=tex}" |
||
| 94 | - "`\\ifdef{\\mainmatter}{\\let\\oldmainmatter\\mainmatter\\renewcommand{\\mainmatter}[0]{\\oldmainmatter}}{}`{=tex}" |
||
| 95 | pandoc-numbering: |
||
| 96 | exercise: |
||
| 97 | general: |
||
| 98 | cite-shortcut: true |
||
| 99 | latex: |
||
| 100 | format-link-classic: "**%D %d %g %s %n %p**" |
||
| 101 | format-link-title: "**%D %d %T %t %g %s %n %p**" |
||
| 102 | --- |
||
| 103 | |||
| 104 | ` |
||
| 105 | \makeatletter |
||
| 106 | \@ifpackageloaded{subfig}{ |
||
| 107 | \usepackage[subfigure]{tocloft} |
||
| 108 | }{ |
||
| 109 | \usepackage{tocloft} |
||
| 110 | } |
||
| 111 | \makeatother |
||
| 112 | `{=tex} |
||
| 113 | |||
| 114 | `\usepackage{etoolbox}`{=tex} |
||
| 115 | |||
| 116 | `\ifdef{\mainmatter}{\let\oldmainmatter\mainmatter\renewcommand{\mainmatter}[0]{\oldmainmatter}}{}`{=tex} |
||
| 117 | |||
| 118 | `\ifdef{\mainmatter}{}{}`{=tex} |
||
| 119 | |||
| 120 | # Title |
||
| 121 | |||
| 122 | `\phantomsection\addcontentsline{exercise}{exercise}{\protect\numberline {1.1}{\ignorespaces {Exercise}}}`{=tex}[]{#exercise:title.1}[**Exercise 1**]{#exercise:first .pandoc-numbering-text .exercise} |
||
| 123 | |||
| 124 | `\phantomsection\addcontentsline{exercise}{exercise}{\protect\numberline {1.2}{\ignorespaces {Title}}}`{=tex}[]{#exercise:title.title}[**Exercise 2** *(Title)*]{#exercise:second .pandoc-numbering-text .exercise} |
||
| 125 | |||
| 126 | See [[**Exercise exercise 1.1 1 1 `\pageref{exercise:first}`{=tex}**]{.pandoc-numbering-link .exercise}](#exercise:first "Exercise 1") |
||
| 127 | |||
| 128 | See [[**Exercise exercise Title title 1.2 1 2 `\pageref{exercise:second}`{=tex}**]{.pandoc-numbering-link .exercise}](#exercise:second "Exercise 2 (Title)") |
||
| 129 | """, |
||
| 130 | "latex", |
||
| 131 | ) |
||
| 258 |