Changeset 1240


Ignore:
Timestamp:
Jul 21, 2011, 9:37:08 PM (6 years ago)
Author:
stefan
Message:
 
Location:
trunk/tools/src/jlatexeditor/tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/src/jlatexeditor/tools/CommandUsageCounter.scala

    r1218 r1240  
    1010 */
    1111object CommandUsageCounter extends UsageCounter("commandUsageCounts.properties") {
    12   val names = ((XML.loadFile("packages.xml") ++ XML.loadFile("docclasses.xml")) \ "package" \ "command").map(node => (node \ "@name").text).sortBy(x => x).distinct
     12  lazy val names = ((XML.loadFile("packages.xml") ++ XML.loadFile("docclasses.xml")) \ "package" \ "command").map(node => (node \ "@name").text).sortBy(x => x).distinct
    1313  def getCode(name: String) = "\\\\" + name + "\\b"
    1414}
  • trunk/tools/src/jlatexeditor/tools/DocumentclassUsageCounter.scala

    r1217 r1240  
    99 */
    1010object DocumentclassUsageCounter extends UsageCounter("docclassUsageCounts.properties") {
    11   val names = (XML.loadFile("docclasses.xml") \ "package").map(node => (node \ "@name").text).sortBy(x => x).distinct
     11  lazy val names = (XML.loadFile("docclasses.xml") \ "package").map(node => (node \ "@name").text).sortBy(x => x).distinct
    1212  def getCode(name: String) = "\\\\documentclass(\\[[^\\]]*\\])?\\{" + name + "\\}"
    1313}
  • trunk/tools/src/jlatexeditor/tools/EnvironmentUsageCounter.scala

    r1218 r1240  
    99 */
    1010object EnvironmentUsageCounter extends UsageCounter("environmentUsageCounts.properties") {
    11   val names = ((XML.loadFile("packages.xml") ++ XML.loadFile("docclasses.xml")) \ "package" \ "environment").map(node => (node \ "@name").text).sortBy(x => x).distinct
     11  lazy val names = ((XML.loadFile("packages.xml") ++ XML.loadFile("docclasses.xml")) \ "package" \ "environment").map(node => (node \ "@name").text).sortBy(x => x).distinct
    1212  //val names2 = (XML.loadFile("packages.xml") \ "package" \ "environment").map(node => (node \ "@name").text).sortBy(x => x).distinct
    1313  def getCode(name: String) = "\\\\begin\\{" + name + "\\}"
  • trunk/tools/src/jlatexeditor/tools/PackageParser.scala

    r1236 r1240  
    1313 */
    1414object PackageParser {
    15   val DeclareOption = ".*\\\\DeclareOption\\s*\\{([^\\}]+)}".r
    16   val RequirePackage = ".*\\\\RequirePackage\\s*\\{([^\\}]+)}".r
     15  val DeclareOption = ".*\\\\DeclareOption\\s*\\{([^\\}]+)}.*".r
     16  val RequirePackage = ".*\\\\RequirePackage\\s*\\{([^\\}]+)}.*".r
    1717  val Def = ".*\\\\def\\s*\\\\(\\w+)([#\\[\\]\\d]*)\\s*\\{.*".r
    1818  val DefArgCount = "#+".r
    1919  val NewCommand = ".*\\\\newcommand\\{?\\\\(\\w+)\\}?(?:\\[(\\d+)\\])?(?:\\[([^\\]]+)\\])?.*".r
    2020  val NewEnvironment = ".*\\\\newenvironment\\{(\\w+)\\}(?:\\[(\\d+)\\])?(?:\\[([^\\]]+)\\])?.*".r
    21   val Input = ".*\\\\input\\{([^}]+)\\}".r
     21  val Input = ".*\\\\input\\s*\\{([^}]+)\\}.*".r
    2222  val DpkgResult = "([\\w\\.-]+): .*".r
    2323  val CtanPackSplit = "([^=]+)=(.*)".r
     
    3636
    3737  def main(args: Array[String]) {
    38     //parseFile(new File("/usr/share/texmf-texlive/tex/latex/algorithms/algorithmic.sty"))
    3938    /*
     39    val pack = new Package(new File("."), true, "report")
     40    parseFile(pack, new File("/usr/share/texmf-texlive/tex/latex/base/report.cls"))
     41    for (opt <- pack.options) {
     42      println(opt)
     43    }
     44
    4045    val p = findDebPackage(findFile("tikz.sty").getAbsolutePath)
    4146    println(p.name)
     
    5762
    5863    writeXmlFile("packages.xml", null, packs)
    59     writeXmlFile("docclasses.xml", "templates/built-in-docclasses.xml", classes)
     64    writeXmlFile("docclasses.xml", null, classes)
    6065
    6166    /*
     
    8186    }
    8287    for (pack <- packages) {
    83       val optionsPackString = if(pack.options.isEmpty) "" else " options=\"" + pack.options.mkString(",") + "\"";
     88      val optionsPackString = if(pack.options.isEmpty) "" else " options=\"" + pack.options.map(escape(_)).mkString(",") + "\"";
    8489      val requiresPackagesString = if(pack.requiresPackages.isEmpty) "" else " requiresPackages=\"" + pack.requiresPackages.mkString(",") + "\"";
    8590      val ctanPackString = pack.ctanPackInfo.map( pack => " title=\"" + escape(pack.title) + "\" description=\"" + escape(pack.desc) + "\"").getOrElse("")
  • trunk/tools/src/jlatexeditor/tools/PackageUsageCounter.scala

    r1214 r1240  
    1010 */
    1111object PackageUsageCounter extends UsageCounter("packageUsageCounts.properties") {
    12   val names = (XML.loadFile("packages.xml") \ "package").map(node => (node \ "@name").text).sortBy(x => x).distinct
     12  lazy val names = (XML.loadFile("packages.xml") \ "package").map(node => (node \ "@name").text).sortBy(x => x).distinct
    1313  def getCode(name: String) = "\\\\usepackage\\{" + name + "\\}"
    1414}
Note: See TracChangeset for help on using the changeset viewer.