mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-07 00:15:48 -04:00
When a list item is immediately followed by a new list, condense the
two -- it's likely that there's extraneous newlines in the middle of the list
This commit is contained in:
parent
481ece3da3
commit
e293a9da8f
@ -42,6 +42,8 @@ my $PREVIOUS_WAS_BLANKLINE = 0;
|
||||
my $INSIDE_DOX_BLOCK = 0;
|
||||
my $INSIDE_DOX_LIST = 0;
|
||||
my $PREVIOUS_WAS_DOX_BLANKLINE = 0;
|
||||
my $JUST_FINISHED_A_LIST = 0;
|
||||
my $BUFFERED_LINE;
|
||||
|
||||
while ($LINE_IDX < $LINE_COUNT){
|
||||
my $new_line = $INPUT_LINES[$LINE_IDX];
|
||||
@ -76,19 +78,30 @@ while ($LINE_IDX < $LINE_COUNT){
|
||||
}
|
||||
elsif ( $INSIDE_DOX_BLOCK ){
|
||||
if ( $new_line =~ m/^\s*\*\s*$/ ){
|
||||
print $out_handle $new_line."\n";
|
||||
# print $out_handle "blank line!\n";
|
||||
$PREVIOUS_WAS_DOX_BLANKLINE = 1;
|
||||
if ( $INSIDE_DOX_LIST ) {
|
||||
$INSIDE_DOX_LIST = 0;
|
||||
$JUST_FINISHED_A_LIST = 1;
|
||||
$BUFFERED_LINE = $new_line;
|
||||
# print $out_handle "end list\n";
|
||||
}
|
||||
else {
|
||||
print $out_handle $new_line . "\n";
|
||||
}
|
||||
}
|
||||
elsif ( $new_line =~ m/^(\s*)\*\s*\-(?![-\d>])(?: )*(.*)/ ){
|
||||
if ( !$INSIDE_DOX_LIST && !$PREVIOUS_WAS_DOX_BLANKLINE ){
|
||||
print $out_handle "$1*\n";
|
||||
}
|
||||
if ($JUST_FINISHED_A_LIST ){
|
||||
# print $out_handle "just finished a list, continuing the same one!!\n";
|
||||
$BUFFERED_LINE = "";
|
||||
}
|
||||
# print $out_handle "start list\n";
|
||||
print $out_handle "$1* - $2\n";
|
||||
$INSIDE_DOX_LIST = 1;
|
||||
$JUST_FINISHED_A_LIST = 0;
|
||||
}
|
||||
elsif ($INSIDE_DOX_LIST && $new_line =~ m/^(\s*)\*\s{2,}(.*)$/ ){
|
||||
# print $out_handle "list continuation\n";
|
||||
@ -99,17 +112,28 @@ while ($LINE_IDX < $LINE_COUNT){
|
||||
# print $out_handle "end list without line break\n";
|
||||
print $out_handle "$1*\n";
|
||||
print $out_handle $new_line."\n";
|
||||
$JUST_FINISHED_A_LIST = 1;
|
||||
}
|
||||
elsif ( $new_line =~ m/^(\s*)\*\/\s*$/ ){
|
||||
$INSIDE_DOX_BLOCK = 0;
|
||||
$INSIDE_DOX_LIST = 0;
|
||||
$JUST_FINISHED_A_LIST = 0;
|
||||
if ( $BUFFERED_LINE ) {
|
||||
print $out_handle $BUFFERED_LINE."\n";
|
||||
$BUFFERED_LINE = "";
|
||||
}
|
||||
print $out_handle $new_line."\n";
|
||||
# print $out_handle "end_block\n";
|
||||
}
|
||||
else {
|
||||
if ( $BUFFERED_LINE ) {
|
||||
print $out_handle $BUFFERED_LINE."\n";
|
||||
$BUFFERED_LINE = "";
|
||||
}
|
||||
print $out_handle $new_line."\n";
|
||||
# print $out_handle "normal dox\n";
|
||||
$PREVIOUS_WAS_DOX_BLANKLINE = 0;
|
||||
$JUST_FINISHED_A_LIST = 0;
|
||||
}
|
||||
}
|
||||
elsif ( $new_line =~ m/^(\s*)\/\*\*(?!\*)\s*(.*)$/ ){
|
||||
@ -128,6 +152,10 @@ while ($LINE_IDX < $LINE_COUNT){
|
||||
# print $out_handle "start_block\n";
|
||||
}
|
||||
else {
|
||||
if ( $BUFFERED_LINE ) {
|
||||
print $out_handle $BUFFERED_LINE."\n";
|
||||
$BUFFERED_LINE = "";
|
||||
}
|
||||
print $out_handle $new_line."\n";
|
||||
}
|
||||
$LINE_IDX++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user