@@ -801,7 +801,7 @@ def html_head(f)
801801 < head >
802802 < meta charset ="utf-8 " />
803803 < meta name ="viewport " content ="width=device-width, initial-scale=1 " />
804- < title > Page with Tables & Sidebar Navigation </ title >
804+ < title > Normative Rules per Chapter </ title >
805805 < style >
806806 : root {
807807 --sidebar-width : 200px ;
@@ -828,7 +828,7 @@ def html_head(f)
828828 overflow-y : auto;
829829 scrollbar-width : auto; /* show only when needed in Firefox */
830830 }
831- sidebar ::-webkit-scrollbar {
831+ . sidebar ::-webkit-scrollbar {
832832 width : 8px ;
833833 }
834834 .sidebar ::-webkit-scrollbar-thumb {
@@ -838,13 +838,27 @@ def html_head(f)
838838 .sidebar ::-webkit-scrollbar-thumb : hover {
839839 background : rgba (0 , 0 , 0 , 0.3 );
840840 }
841+ .sidebar ul {
842+ list-style : none;
843+ padding : 0 ;
844+ margin : 0 ;
845+ }
846+ .sidebar li {
847+ margin : 2px 0 ; /* reduce vertical gap between items */
848+ }
841849 .sidebar ::-webkit-scrollbar-track {
842850 background : transparent;
843851 }
844852 .sidebar h2 {margin : 0 0 12px ;font-size : 18px }
845- .nav {display : flex;flex-direction : column;gap : 8 px }
853+ .nav {display : flex;flex-direction : column;gap : 2 px }
846854 .nav a {
847- display : block;padding : 10px 12px ;border-radius : 8px ;text-decoration : none;color : var (--accent );font-weight : 600 ;
855+ display : block;
856+ font-size : 14px ;
857+ padding : 6px 10px ;
858+ border-radius : 6px ;
859+ text-decoration : none;
860+ color : var (--accent );
861+ font-weight : 600 ;
848862 }
849863 .nav a .subtitle {display : block;font-weight : 400 ;color : var (--muted );font-size : 12px }
850864 .nav a .active {background : rgba (3 , 102 , 214 , 0.12 );color : var (--accent )}
@@ -997,19 +1011,34 @@ def html_script(f)
9971011end
9981012
9991013# Cleanup the tag text to be suitably displayed.
1000- # TODO: When https://github.com/riscv/docs-resources/issues/112 improves table format,
1001- # update this to allow small tables to be displayed.
10021014def handle_tables ( text )
10031015 raise ArgumentError , "Expected String for text but was passed a #{ text } .class" unless text . is_a? ( String )
10041016
1017+ # This is the detection pattern for an entire table being tagged from the "tags.rb" AsciiDoctor backend.
10051018 if text . end_with? ( "\n ===" )
1006- # This is the currentl weak detection pattern for an entire table being tagged .
1007- "ENTIRE TABLE"
1019+ # Limit table size displayed .
1020+ truncate_after_newlines ( text , 12 )
10081021 else
10091022 text
10101023 end
10111024end
10121025
1026+ def truncate_after_newlines ( text , max_newlines )
1027+ # Split the string into lines
1028+ lines = text . split ( "\n " )
1029+
1030+ # Take only up to the allowed number of lines
1031+ truncated_lines = lines . first ( max_newlines + 1 )
1032+
1033+ # Join them back together with newline characters
1034+ truncated_text = truncated_lines . join ( "\n " )
1035+
1036+ # If there were more lines than allowed, indicate truncation.
1037+ truncated_text += "\n ..." if lines . size > max_newlines + 1
1038+
1039+ truncated_text
1040+ end
1041+
10131042# Convert newlines to <br>.
10141043def html_handle_newlines ( text )
10151044 raise ArgumentError , "Expected String for text but was passed a #{ text } .class" unless text . is_a? ( String )
@@ -1049,5 +1078,4 @@ def html_handle_newlines(text)
10491078 raise "Unknown output_format of #{ output_format } "
10501079end
10511080
1052-
10531081exit 0
0 commit comments