1920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson/* 2920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * Copyright (C) 2010 Google Inc. 3920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * 4920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * Licensed under the Apache License, Version 2.0 (the "License"); 5920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * you may not use this file except in compliance with the License. 6920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * You may obtain a copy of the License at 7920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * 8920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * http://www.apache.org/licenses/LICENSE-2.0 9920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * 10920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * Unless required by applicable law or agreed to in writing, software 11920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * distributed under the License is distributed on an "AS IS" BASIS, 12920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * See the License for the specific language governing permissions and 14920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * limitations under the License. 15920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson */ 16920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 17920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodsonpackage com.google.doclava; 18920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 19920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodsonimport com.google.clearsilver.jsilver.data.Data; 20920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 21920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodsonimport java.io.*; 22920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodsonimport java.util.regex.Pattern; 23920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodsonimport java.util.regex.Matcher; 24920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 25920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 26920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodsonpublic class DocFile { 2771bf8d2ae787c28691910bb228a5d9efca9b153dScott Main public static final Pattern LINE = Pattern.compile("(.*)[\r]?\n", Pattern.MULTILINE); 2871bf8d2ae787c28691910bb228a5d9efca9b153dScott Main public static final Pattern PROP = Pattern.compile("([^=]+)=(.*)"); 29920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 30920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson public static String readFile(String filename) { 31920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson try { 32920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson File f = new File(filename); 33920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson int length = (int) f.length(); 34920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson FileInputStream is = new FileInputStream(f); 35920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson InputStreamReader reader = new InputStreamReader(is, "UTF-8"); 36920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson char[] buf = new char[length]; 37920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson int index = 0; 38920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson int amt; 39920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson while (true) { 40920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson amt = reader.read(buf, index, length - index); 41920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 42920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson if (amt < 1) { 43920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson break; 44920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 45920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 46920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson index += amt; 47920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 48920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson return new String(buf, 0, index); 49920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } catch (IOException e) { 50920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson return null; 51920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 52920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 53920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 54f9d9cb045339e902b36391d19be3c665b1585ab8Dirk Dougherty public static String[] DEVSITE_VALID_LANGS = {"en", "es","ja", "ko", 55f9d9cb045339e902b36391d19be3c665b1585ab8Dirk Dougherty "ru", "zh-cn", "zh-tw", "pt-br"}; 569b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty 579b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty public static String getPathRoot(String filename) { 588bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty //look for a valid lang string in the file path. If found, 598bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty //snip the intl/lang from the path. 608bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty for (String t : DEVSITE_VALID_LANGS) { 618bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty int langStart = filename.indexOf("/" + t + "/"); 628bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty if (langStart > -1) { 638bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty int langEnd = filename.indexOf("/", langStart + 1); 648bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty filename = filename.substring(langEnd + 1); 658bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty break; 669b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty } 679b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty } 688bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty return filename; 699b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty } 708bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty 718a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty public static Data getPageMetadata (String docfile, Data hdf) { 728a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty //utility method for extracting metadata without generating file output. 738a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty if (hdf == null) { 748a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty hdf = Doclava.makeHDF(); 758a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty } 768a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty String filedata = readFile(docfile); 778a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty 788a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty // The document is properties up until the line "@jd:body". 798a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty // Any blank lines are ignored. 808a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty int start = -1; 818a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty int lineno = 1; 828a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty Matcher lines = LINE.matcher(filedata); 838a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty String line = null; 848a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty while (lines.find()) { 858a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty line = lines.group(1); 868a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty if (line.length() > 0) { 878a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty if (line.equals("@jd:body")) { 888a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty start = lines.end(); 898a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty break; 908a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty } 918a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty Matcher prop = PROP.matcher(line); 928a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty if (prop.matches()) { 938a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty String key = prop.group(1); 948a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty String value = prop.group(2); 958a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty hdf.setValue(key, value); 968a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty } else { 978a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty break; 988a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty } 998a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty } 1008a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty lineno++; 1018a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty } 1028a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty if (start < 0) { 1038a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty System.err.println(docfile + ":" + lineno + ": error parsing docfile"); 1048a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty if (line != null) { 1058a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty System.err.println(docfile + ":" + lineno + ":" + line); 1068a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty } 1078a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty System.exit(1); 1088a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty } 1098a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty return hdf; 1108a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty } 1118a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty 112e52f6d819e7d95e19e9b315f358bb7ac293413d8Dirk Dougherty public static void writePage(String docfile, String relative, String outfile, Data hdf) { 113920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 114920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson /* 115920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * System.out.println("docfile='" + docfile + "' relative='" + relative + "'" + "' outfile='" + 116920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson * outfile + "'"); 117920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson */ 118e52f6d819e7d95e19e9b315f358bb7ac293413d8Dirk Dougherty if (hdf == null) { 119e52f6d819e7d95e19e9b315f358bb7ac293413d8Dirk Dougherty hdf = Doclava.makeHDF(); 120e52f6d819e7d95e19e9b315f358bb7ac293413d8Dirk Dougherty } 121920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson String filedata = readFile(docfile); 122920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 123920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson // The document is properties up until the line "@jd:body". 124920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson // Any blank lines are ignored. 125920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson int start = -1; 126920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson int lineno = 1; 127920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson Matcher lines = LINE.matcher(filedata); 128920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson String line = null; 129920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson while (lines.find()) { 130920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson line = lines.group(1); 131920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson if (line.length() > 0) { 132920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson if (line.equals("@jd:body")) { 133920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson start = lines.end(); 134920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson break; 135920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 136920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson Matcher prop = PROP.matcher(line); 137920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson if (prop.matches()) { 138920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson String key = prop.group(1); 139920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson String value = prop.group(2); 140920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson hdf.setValue(key, value); 141920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } else { 142920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson break; 143920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 144920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 145920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson lineno++; 146920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 147920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson if (start < 0) { 148920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson System.err.println(docfile + ":" + lineno + ": error parsing docfile"); 149920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson if (line != null) { 150920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson System.err.println(docfile + ":" + lineno + ":" + line); 151920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 152920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson System.exit(1); 153920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 154920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 155920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson // if they asked to only be for a certain template, maybe skip it 156920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson String fromTemplate = hdf.getValue("template.which", ""); 157920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson String fromPage = hdf.getValue("page.onlyfortemplate", ""); 158920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson if (!"".equals(fromPage) && !fromTemplate.equals(fromPage)) { 159920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson return; 160920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 161920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 162920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson // and the actual text after that 163920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson String commentText = filedata.substring(start); 164920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 165920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson Comment comment = new Comment(commentText, null, new SourcePositionInfo(docfile, lineno, 1)); 166920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson TagInfo[] tags = comment.tags(); 167920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 168920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson TagInfo.makeHDF(hdf, "root.descr", tags); 169920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 170920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson hdf.setValue("commentText", commentText); 171920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson 172920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson // write the page using the appropriate root template, based on the 173920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson // whichdoc value supplied by build 174920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson String fromWhichmodule = hdf.getValue("android.whichmodule", ""); 175920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson if (fromWhichmodule.equals("online-pdk")) { 176920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson // leaving this in just for temporary compatibility with pdk doc 177920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson hdf.setValue("online-pdk", "true"); 178920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson // add any conditional login for root template here (such as 179920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson // for custom left nav based on tab etc. 180920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson ClearPage.write(hdf, "docpage.cs", outfile); 181920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } else { 1823c925b473212325cbf5f734cb5d1d57588ea83e3Scott Main String filename = outfile; 1839b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty // Strip out the intl and lang id substr and get back just the 1849b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty // guide, design, distribute, etc. 1859b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty filename = getPathRoot(filename); 1869b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty if (filename.indexOf("design") == 0) { 1873352706b85f0c1aa8a0391b26c08c8b6f9e5746fRoman Nurik hdf.setValue("design", "true"); 188f9d9cb045339e902b36391d19be3c665b1585ab8Dirk Dougherty hdf.setValue("page.type", "design"); 1899b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty } else if (filename.indexOf("develop") == 0) { 1903c925b473212325cbf5f734cb5d1d57588ea83e3Scott Main hdf.setValue("develop", "true"); 1918bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty hdf.setValue("page.type", "develop"); 1929b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty } else if (filename.indexOf("guide") == 0) { 1933c925b473212325cbf5f734cb5d1d57588ea83e3Scott Main hdf.setValue("guide", "true"); 194f9d9cb045339e902b36391d19be3c665b1585ab8Dirk Dougherty hdf.setValue("page.type", "guide"); 1959b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty } else if (filename.indexOf("training") == 0) { 1963c925b473212325cbf5f734cb5d1d57588ea83e3Scott Main hdf.setValue("training", "true"); 197f9d9cb045339e902b36391d19be3c665b1585ab8Dirk Dougherty hdf.setValue("page.type", "training"); 1989b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty } else if (filename.indexOf("more") == 0) { 1993c925b473212325cbf5f734cb5d1d57588ea83e3Scott Main hdf.setValue("more", "true"); 2009b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty } else if (filename.indexOf("google") == 0) { 2013c925b473212325cbf5f734cb5d1d57588ea83e3Scott Main hdf.setValue("google", "true"); 202f9d9cb045339e902b36391d19be3c665b1585ab8Dirk Dougherty hdf.setValue("page.type", "google"); 2031b45d1d08a4ff984e1d0741dd13f0759f6527ebfDirk Dougherty } else if (filename.indexOf("samples") == 0) { 2041b45d1d08a4ff984e1d0741dd13f0759f6527ebfDirk Dougherty hdf.setValue("samples", "true"); 205f9d9cb045339e902b36391d19be3c665b1585ab8Dirk Dougherty hdf.setValue("page.type", "samples"); 2068a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty if (Doclava.samplesNavTree != null) { 2078a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty hdf.setValue("samples_toc_tree", Doclava.samplesNavTree.getValue("samples_toc_tree", "")); 2088a8f7912692bcf9f984a7a24eaf47da69b6d2992Dirk Dougherty } 2099b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty } else if (filename.indexOf("distribute") == 0) { 2103c925b473212325cbf5f734cb5d1d57588ea83e3Scott Main hdf.setValue("distribute", "true"); 211f9d9cb045339e902b36391d19be3c665b1585ab8Dirk Dougherty hdf.setValue("page.type", "distribute"); 2128bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty if (filename.indexOf("distribute/googleplay") == 0) { 2138bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty hdf.setValue("googleplay", "true"); 2148bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty } else if (filename.indexOf("distribute/essentials") == 0) { 2158bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty hdf.setValue("essentials", "true"); 2168bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty } else if (filename.indexOf("distribute/users") == 0) { 2178bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty hdf.setValue("users", "true"); 2188bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty } else if (filename.indexOf("distribute/engage") == 0) { 2198bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty hdf.setValue("engage", "true"); 2208bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty } else if (filename.indexOf("distribute/monetize") == 0) { 2218bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty hdf.setValue("monetize", "true"); 2229bb6767395b15d8f7762dd226eb85a219950f2a1Dirk Dougherty } else if (filename.indexOf("distribute/analyze") == 0) { 2239bb6767395b15d8f7762dd226eb85a219950f2a1Dirk Dougherty hdf.setValue("analyze", "true"); 2248bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty } else if (filename.indexOf("distribute/tools") == 0) { 2258bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty hdf.setValue("disttools", "true"); 2268bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty } else if (filename.indexOf("distribute/stories") == 0) { 2278bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty hdf.setValue("stories", "true"); 2288bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty } 2299b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty } else if (filename.indexOf("about") == 0) { 2303c925b473212325cbf5f734cb5d1d57588ea83e3Scott Main hdf.setValue("about", "true"); 231f9d9cb045339e902b36391d19be3c665b1585ab8Dirk Dougherty hdf.setValue("page.type", "about"); 2329b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty } else if ((filename.indexOf("tools") == 0) || (filename.indexOf("sdk") == 0)) { 2333c925b473212325cbf5f734cb5d1d57588ea83e3Scott Main hdf.setValue("tools", "true"); 234f9d9cb045339e902b36391d19be3c665b1585ab8Dirk Dougherty hdf.setValue("page.type", "tools"); 2359b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty fromTemplate = hdf.getValue("page.template", ""); 23688c435bb4d6c81c41107e23503b59af2e08acd8dRobert Ly } else if (filename.indexOf("devices") == 0) { 23788c435bb4d6c81c41107e23503b59af2e08acd8dRobert Ly hdf.setValue("devices", "true"); 238f9d9cb045339e902b36391d19be3c665b1585ab8Dirk Dougherty hdf.setValue("page.type", "devices"); 23988c435bb4d6c81c41107e23503b59af2e08acd8dRobert Ly } else if (filename.indexOf("source") == 0) { 24088c435bb4d6c81c41107e23503b59af2e08acd8dRobert Ly hdf.setValue("source", "true"); 24188c435bb4d6c81c41107e23503b59af2e08acd8dRobert Ly } else if (filename.indexOf("accessories") == 0) { 24288c435bb4d6c81c41107e23503b59af2e08acd8dRobert Ly hdf.setValue("accessories", "true"); 24388c435bb4d6c81c41107e23503b59af2e08acd8dRobert Ly } else if (filename.indexOf("compatibility") == 0) { 24488c435bb4d6c81c41107e23503b59af2e08acd8dRobert Ly hdf.setValue("compatibility", "true"); 24516010db22b89093d45ff9bf19e184a54ae374e39Scott Main } else if (filename.indexOf("wear") == 0) { 24616010db22b89093d45ff9bf19e184a54ae374e39Scott Main hdf.setValue("wear", "true"); 24732f2de2c795891219f436d3128b37bee70656c7fRobert Ly } else if (filename.indexOf("preview") == 0) { 24832f2de2c795891219f436d3128b37bee70656c7fRobert Ly hdf.setValue("preview", "true"); 24932f2de2c795891219f436d3128b37bee70656c7fRobert Ly } else if (filename.indexOf("auto") == 0) { 25032f2de2c795891219f436d3128b37bee70656c7fRobert Ly hdf.setValue("auto", "true"); 25132f2de2c795891219f436d3128b37bee70656c7fRobert Ly } else if (filename.indexOf("tv") == 0) { 25232f2de2c795891219f436d3128b37bee70656c7fRobert Ly hdf.setValue("tv", "true"); 2533c925b473212325cbf5f734cb5d1d57588ea83e3Scott Main } 2548bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty //set metadata for this file in jd_lists_unified 2558bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty PageMetadata.setPageMetadata(docfile, relative, outfile, hdf, Doclava.sTaglist); 2568bfc32ba1c79cdc576101944346f66112b1a3776Dirk Dougherty 2579b316c84e2e15268db79772d9cef60da1df488ecDirk Dougherty if (fromTemplate.equals("sdk")) { 2583c925b473212325cbf5f734cb5d1d57588ea83e3Scott Main ClearPage.write(hdf, "sdkpage.cs", outfile); 259920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } else { 2603c925b473212325cbf5f734cb5d1d57588ea83e3Scott Main ClearPage.write(hdf, "docpage.cs", outfile); 261920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 262920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } 263920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson } // writePage 264920dbbbaca6aa578f3b26d89e99d12754c26ed60Ben Dodson} 265