Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tobias Hunger
qt-creator
Commits
b86ffdff
Commit
b86ffdff
authored
Dec 08, 2010
by
Oswald Buddenhagen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix fixing of navigation with multiple files
parent
274af0f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
117 additions
and
43 deletions
+117
-43
doc/fixnavi.pl
doc/fixnavi.pl
+117
-43
No files found.
doc/fixnavi.pl
View file @
b86ffdff
...
...
@@ -2,37 +2,82 @@
use
strict
;
@ARGV
==
1
or
die
"
usage: $0 <qdoc-file>
\n
";
my
$file
=
$ARGV
[
0
];
open
FILE
,
$file
or
die
"
File
$file
cannot be opened.
\n
";
my
@files
=
();
my
%
defines
=
();
for
(
@ARGV
)
{
if
(
/^-D(.*)$/
)
{
$defines
{
$1
}
=
1
;
}
elsif
(
/^-/
)
{
printf
STDERR
"
Unknown option '
"
.
$_
.
"
'
\n
";
exit
1
;
}
else
{
push
@files
,
$_
;
}
}
int
(
@files
)
or
die
"
usage: $0 [-D<define>]... <qdoc-file>
\n
";
my
@toc
=
();
my
%
title2page
=
();
my
$doctitle
=
"";
my
$curpage
=
"";
my
$intoc
=
0
;
while
(
<
FILE
>
)
{
if
(
keys
(
%
title2page
)
==
1
&&
/^\h*\\list/
)
{
$intoc
++
;
}
elsif
(
!
$intoc
)
{
if
(
/^\h*\\page\h+(\H+)/
)
{
$curpage
=
$1
;
}
elsif
(
/^\h*\\title\h+(.+)$/
)
{
if
(
$curpage
eq
"")
{
die
"
Title '$1' appears in no
\\
page.
\n
";
my
%
prev_skips
=
();
my
%
next_skips
=
();
my
%
define_skips
=
();
my
%
polarity_skips
=
();
my
$prev_skip
=
"";
my
$next_skip
=
"";
my
$define_skip
=
"";
my
$polarity_skip
=
0
;
for
my
$file
(
@files
)
{
my
$skipping
=
0
;
# no nested ifs!
open
FILE
,
$file
or
die
"
File
$file
cannot be opened.
\n
";
while
(
<
FILE
>
)
{
if
(
/^\h*\\if\h+defined\h*\(\h*(\H+)\h*\)/
)
{
$skipping
=
!
defined
(
$defines
{
$1
});
if
(
!
$intoc
)
{
$define_skip
=
$1
;
$polarity_skip
=
$skipping
;
}
}
elsif
(
/^\h*\\else/
)
{
$skipping
=
1
-
$skipping
;
}
elsif
(
/^\h*\\endif/
)
{
$skipping
=
0
;
}
elsif
(
keys
(
%
title2page
)
==
1
&&
/^\h*\\list/
)
{
$intoc
++
;
}
elsif
(
!
$intoc
)
{
if
(
$skipping
&&
/^\h*\\previouspage\h+(\H+)/
)
{
$prev_skip
=
$1
;
}
elsif
(
$skipping
&&
/^\h*\\nextpage\h+(\H+)/
)
{
$next_skip
=
$1
;
}
elsif
(
/^\h*\\page\h+(\H+)/
)
{
$curpage
=
$1
;
}
elsif
(
/^\h*\\title\h+(.+)$/
)
{
if
(
$curpage
eq
"")
{
die
"
Title '$1' appears in no
\\
page.
\n
";
}
if
(
length
(
$define_skip
))
{
$define_skips
{
$1
}
=
$define_skip
;
$polarity_skips
{
$1
}
=
$polarity_skip
;
$prev_skips
{
$1
}
=
$prev_skip
;
$next_skips
{
$1
}
=
$next_skip
;
$define_skip
=
$prev_skip
=
$next_skip
=
"";
}
$title2page
{
$1
}
=
$curpage
;
$doctitle
=
$1
if
(
!
$doctitle
);
$curpage
=
"";
}
}
else
{
if
(
/^\h*\\endlist/
)
{
$intoc
--
;
}
elsif
(
!
$skipping
&&
/^\h*\\o\h+\\l\h*{(.*)}$/
)
{
push
@toc
,
$1
;
}
$title2page
{
$1
}
=
$curpage
;
$doctitle
=
$1
if
(
!
$doctitle
);
$curpage
=
"";
}
}
else
{
if
(
/^\h*\\endlist/
)
{
$intoc
--
;
}
elsif
(
/^\h*\\o\h+\\l\h*{(.*)}$/
)
{
push
@toc
,
$1
;
}
}
close
FILE
;
}
close
FILE
;
my
%
prev
=
();
my
%
next
=
();
...
...
@@ -43,28 +88,57 @@ for my $title (@toc) {
$last
=
$title
;
}
open
IN
,
$file
or
die
"
File
$file
cannot be opened a second time?!
\n
";
open
OUT
,
'
>
'
.
$file
.
"
.out
"
or
die
"
File
$file
.out cannot be created.
\n
";
my
$cutting
=
0
;
while
(
<
IN
>
)
{
if
(
!
$cutting
)
{
if
(
/^\h*\\contentspage/
)
{
$cutting
=
1
;
}
}
else
{
if
(
/^\h*\\title\h+(.+)$/
)
{
print
OUT
"
\\
previouspage
"
.
$prev
{
$1
}
if
(
$prev
{
$1
});
print
OUT
"
\\
page
"
.
$title2page
{
$1
};
print
OUT
"
\\
nextpage
"
.
$next
{
$1
}
if
(
$next
{
$1
});
print
OUT
"
\n
";
$cutting
=
0
;
for
my
$file
(
@files
)
{
open
IN
,
$file
or
die
"
File
$file
cannot be opened a second time?!
\n
";
open
OUT
,
'
>
'
.
$file
.
"
.out
"
or
die
"
File
$file
.out cannot be created.
\n
";
my
$cutting
=
0
;
while
(
<
IN
>
)
{
if
(
!
$cutting
)
{
if
(
/^\h*\\contentspage/
)
{
$cutting
=
1
;
}
}
else
{
next
;
if
(
/^\h*\\title\h+(.+)$/
)
{
if
(
defined
(
$define_skips
{
$1
}))
{
print
OUT
"
\\
if defined(
"
.
$define_skips
{
$1
}
.
"
)
\n
";
if
(
$polarity_skips
{
$1
})
{
print
OUT
"
\\
previouspage
"
.
$prev_skips
{
$1
}
if
(
$prev_skips
{
$1
});
print
OUT
"
\\
else
\n
";
}
}
print
OUT
"
\\
previouspage
"
.
$prev
{
$1
}
if
(
$prev
{
$1
});
if
(
defined
(
$define_skips
{
$1
}))
{
if
(
!
$polarity_skips
{
$1
})
{
print
OUT
"
\\
else
\n
";
print
OUT
"
\\
previouspage
"
.
$prev_skips
{
$1
}
if
(
$prev_skips
{
$1
});
}
print
OUT
"
\\
endif
\n
";
}
print
OUT
"
\\
page
"
.
$title2page
{
$1
};
if
(
defined
(
$define_skips
{
$1
}))
{
print
OUT
"
\\
if defined(
"
.
$define_skips
{
$1
}
.
"
)
\n
";
if
(
$polarity_skips
{
$1
})
{
print
OUT
"
\\
nextpage
"
.
$next_skips
{
$1
}
if
(
$next_skips
{
$1
});
print
OUT
"
\\
else
\n
";
}
}
print
OUT
"
\\
nextpage
"
.
$next
{
$1
}
if
(
$next
{
$1
});
if
(
defined
(
$define_skips
{
$1
}))
{
if
(
!
$polarity_skips
{
$1
})
{
print
OUT
"
\\
else
\n
";
print
OUT
"
\\
nextpage
"
.
$next_skips
{
$1
}
if
(
$next_skips
{
$1
});
}
print
OUT
"
\\
endif
\n
";
}
print
OUT
"
\n
";
$cutting
=
0
;
}
else
{
next
;
}
}
print
OUT
$_
;
}
print
OUT
$_
;
close
OUT
;
close
IN
;
rename
(
$file
.
"
.out
",
$file
)
or
die
"
Cannot replace
$file
with new version.
\n
";
}
close
OUT
;
close
IN
;
rename
(
$file
.
"
.out
",
$file
)
or
die
"
Cannot replace
$file
with new version.
\n
";
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment