Browse Source

Refactored text.alignment documentation

Marcin Ziąbek 1 year ago
parent
commit
3cff9d082c

+ 14 - 62
Source/QuestPDF/Fluent/TextExtensions.cs

@@ -68,73 +68,49 @@ namespace QuestPDF.Fluent
             TextBlock = textBlock;
             TextBlock = textBlock;
         }
         }
 
 
-        /// <summary>
-        /// Aligns text horizontally to the left side.
-        /// </summary>
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.alignment.left"]/*' />
         public TextBlockDescriptor AlignLeft()
         public TextBlockDescriptor AlignLeft()
         {
         {
             TextBlock.Alignment = TextHorizontalAlignment.Left;
             TextBlock.Alignment = TextHorizontalAlignment.Left;
             return this;
             return this;
         }
         }
         
         
-        /// <summary>
-        /// Aligns text horizontally to the center, ensuring equal space on both left and right sides.
-        /// </summary>
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.alignment.center"]/*' />
         public TextBlockDescriptor AlignCenter()
         public TextBlockDescriptor AlignCenter()
         {
         {
             TextBlock.Alignment = TextHorizontalAlignment.Center;
             TextBlock.Alignment = TextHorizontalAlignment.Center;
             return this;
             return this;
         }
         }
         
         
-        /// <summary>
-        /// Aligns content horizontally to the right side.
-        /// </summary>
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.alignment.right"]/*' />
         public TextBlockDescriptor AlignRight()
         public TextBlockDescriptor AlignRight()
         {
         {
             TextBlock.Alignment = TextHorizontalAlignment.Right;
             TextBlock.Alignment = TextHorizontalAlignment.Right;
             return this;
             return this;
         }
         }
         
         
-        /// <summary>
-        /// <para>
-        /// Justifies the text within its container.
-        /// </para>
-        ///
-        /// <para>
-        /// This method sets the horizontal alignment of the text to be justified, meaning it aligns along both the left and right margins.
-        /// This is achieved by adjusting the spacing between words and characters as necessary so that each line of text stretches from one end of the text column to the other.
-        /// This creates a clean, block-like appearance for the text.
-        /// </para>
-        /// </summary>
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.alignment.justify"]/*' />
         public TextBlockDescriptor Justify()
         public TextBlockDescriptor Justify()
         {
         {
             TextBlock.Alignment = TextHorizontalAlignment.Justify;
             TextBlock.Alignment = TextHorizontalAlignment.Justify;
             return this;
             return this;
         }
         }
         
         
-        /// <summary>
-        /// Aligns the text horizontally to the start of the container. 
-        /// This method sets the horizontal alignment of the text to the start (left for left-to-right languages, right for right-to-left languages).
-        /// </summary>
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.alignment.start"]/*' />
         public TextBlockDescriptor AlignStart()
         public TextBlockDescriptor AlignStart()
         {
         {
             TextBlock.Alignment = TextHorizontalAlignment.Start;
             TextBlock.Alignment = TextHorizontalAlignment.Start;
             return this;
             return this;
         }
         }
         
         
-        /// <summary>
-        /// Aligns the text horizontally to the end of the container. 
-        /// This method sets the horizontal alignment of the text to the end (right for left-to-right languages, start for right-to-left languages).
-        /// </summary>
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.alignment.end"]/*' />
         public TextBlockDescriptor AlignEnd()
         public TextBlockDescriptor AlignEnd()
         {
         {
             TextBlock.Alignment = TextHorizontalAlignment.End;
             TextBlock.Alignment = TextHorizontalAlignment.End;
             return this;
             return this;
         }
         }
 
 
-        /// <summary>
-        /// Sets the maximum number of lines to display. 
-        /// </summary>
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.clampLines"]/*' />
         public TextBlockDescriptor ClampLines(int maxLines)
         public TextBlockDescriptor ClampLines(int maxLines)
         {
         {
             TextBlock.LineClamp = maxLines;
             TextBlock.LineClamp = maxLines;
@@ -165,67 +141,43 @@ namespace QuestPDF.Fluent
             DefaultStyle = style(TextStyle.Default);
             DefaultStyle = style(TextStyle.Default);
         }
         }
   
   
-        /// <summary>
-        /// Aligns text horizontally to the left side.
-        /// </summary>
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.alignment.left"]/*' />
         public void AlignLeft()
         public void AlignLeft()
         {
         {
             TextBlock.Alignment = TextHorizontalAlignment.Left;
             TextBlock.Alignment = TextHorizontalAlignment.Left;
         }
         }
         
         
-        /// <summary>
-        /// Aligns text horizontally to the center, ensuring equal space on both left and right sides.
-        /// </summary>
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.alignment.center"]/*' />
         public void AlignCenter()
         public void AlignCenter()
         {
         {
             TextBlock.Alignment = TextHorizontalAlignment.Center;
             TextBlock.Alignment = TextHorizontalAlignment.Center;
         }
         }
         
         
-        /// <summary>
-        /// Aligns content horizontally to the right side.
-        /// </summary>
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.alignment.right"]/*' />
         public void AlignRight()
         public void AlignRight()
         {
         {
             TextBlock.Alignment = TextHorizontalAlignment.Right;
             TextBlock.Alignment = TextHorizontalAlignment.Right;
         }
         }
         
         
-        /// <summary>
-        /// <para>
-        /// Justifies the text within its container.
-        /// </para>
-        ///
-        /// <para>
-        /// This method sets the horizontal alignment of the text to be justified, meaning it aligns along both the left and right margins.
-        /// This is achieved by adjusting the spacing between words and characters as necessary so that each line of text stretches from one end of the text column to the other.
-        /// This creates a clean, block-like appearance for the text.
-        /// </para>
-        /// </summary>
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.alignment.justify"]/*' />
         public void Justify()
         public void Justify()
         {
         {
             TextBlock.Alignment = TextHorizontalAlignment.Justify;
             TextBlock.Alignment = TextHorizontalAlignment.Justify;
         }
         }
         
         
-        /// <summary>
-        /// Aligns the text horizontally to the start of the container. 
-        /// This method sets the horizontal alignment of the text to the start (left for left-to-right languages, right for right-to-left languages).
-        /// </summary>
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.alignment.start"]/*' />
         public void AlignStart()
         public void AlignStart()
         {
         {
             TextBlock.Alignment = TextHorizontalAlignment.Start;
             TextBlock.Alignment = TextHorizontalAlignment.Start;
         }
         }
         
         
-        /// <summary>
-        /// Aligns the text horizontally to the end of the container. 
-        /// This method sets the horizontal alignment of the text to the end (right for left-to-right languages, start for right-to-left languages).
-        /// </summary>
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.alignment.end"]/*' />
         public void AlignEnd()
         public void AlignEnd()
         {
         {
             TextBlock.Alignment = TextHorizontalAlignment.End;
             TextBlock.Alignment = TextHorizontalAlignment.End;
         }
         }
 
 
-        /// <summary>
-        /// Sets the maximum number of lines to display. 
-        /// </summary>
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="text.clampLines"]/*' />
         public void ClampLines(int maxLines)
         public void ClampLines(int maxLines)
         {
         {
             TextBlock.LineClamp = maxLines;
             TextBlock.LineClamp = maxLines;

+ 54 - 0
Source/QuestPDF/Resources/Documentation.xml

@@ -139,6 +139,60 @@
             <para>Additionally, it provides formatting options, like displaying the page number in custom text format (e.g. Roman numerals).</para>
             <para>Additionally, it provides formatting options, like displaying the page number in custom text format (e.g. Roman numerals).</para>
         </returns>
         </returns>
     </doc>
     </doc>
+
+    <doc for="text.clampLines">
+        <summary>
+            Sets the maximum number of lines to display.
+        </summary>
+    </doc>
+
+    <!-- TEXT ELEMENT -->
+
+    <doc for="text.alignment.left">
+        <summary>
+        Aligns text horizontally to the left side.
+        </summary>
+    </doc>
+
+    <doc for="text.alignment.center">
+        <summary>
+            Aligns text horizontally to the center, ensuring equal space on both left and right sides.
+        </summary>
+    </doc>
+
+    <doc for="text.alignment.right">
+        <summary>
+            Aligns content horizontally to the right side.
+        </summary>
+    </doc>
+
+    <doc for="text.alignment.start">
+        <summary>
+            Aligns the text horizontally to the start of the container.
+            This method sets the horizontal alignment of the text to the start (left for left-to-right languages, right for right-to-left languages).
+        </summary>
+    </doc>
+
+    <doc for="text.alignment.end">
+        <summary>
+            Aligns the text horizontally to the end of the container.
+            This method sets the horizontal alignment of the text to the end (right for left-to-right languages, start for right-to-left languages).
+        </summary>
+    </doc>
+
+    <doc for="text.alignment.justify">
+        <summary>
+            <para>
+            Justifies the text within its container.
+            </para>
+            
+            <para>
+            This method sets the horizontal alignment of the text to be justified, meaning it aligns along both the left and right margins.
+            This is achieved by adjusting the spacing between words and characters as necessary so that each line of text stretches from one end of the text column to the other.
+            This creates a clean, block-like appearance for the text.
+            </para>
+        </summary>
+    </doc>
     
     
     <!-- TEXT ATTRIBUTES -->
     <!-- TEXT ATTRIBUTES -->