Fix the documentation title in the search results.

In 61698b14e0 I changed the section title style, which caused an extra "= " in
front of the documentation titles in the Lucene index. Use a regular expression
to strip it out.

Change-Id: I550bcd32ee9e4475c8f71db1ab466895339d91f2
This commit is contained in:
Yuxuan 'fishy' Wang
2013-12-27 15:40:08 -08:00
parent a76877cfb0
commit b71ac62312

View File

@@ -39,10 +39,13 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipOutputStream;
public class DocIndexer {
private static final Version LUCENE_VERSION = Version.LUCENE_46;
private static final Pattern SECTION_HEADER = Pattern.compile("^=+ (.*)");
@Option(name = "-z", usage = "output zip file")
private String zipFile;
@@ -94,6 +97,10 @@ public class DocIndexer {
title = titleReader.readLine();
}
titleReader.close();
Matcher matcher = SECTION_HEADER.matcher(title);
if (matcher.matches()) {
title = matcher.group(1);
}
String outputFile = AsciiDoctor.mapInFileToOutFile(
inputFile, inExt, outExt);