{"action":"closed","issue":{"url":"https://api.github.com/repos/cvogt/scala-dash/issues/1","labels_url":"https://api.github.com/repos/cvogt/scala-dash/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/cvogt/scala-dash/issues/1/comments","events_url":"https://api.github.com/repos/cvogt/scala-dash/issues/1/events","html_url":"https://github.com/cvogt/scala-dash/issues/1","id":103984814,"number":1,"title":"Remove dashing dependency","user":{"login":"cvogt","id":274947,"avatar_url":"https://avatars.githubusercontent.com/u/274947?v=3","gravatar_id":"","url":"https://api.github.com/users/cvogt","html_url":"https://github.com/cvogt","followers_url":"https://api.github.com/users/cvogt/followers","following_url":"https://api.github.com/users/cvogt/following{/other_user}","gists_url":"https://api.github.com/users/cvogt/gists{/gist_id}","starred_url":"https://api.github.com/users/cvogt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvogt/subscriptions","organizations_url":"https://api.github.com/users/cvogt/orgs","repos_url":"https://api.github.com/users/cvogt/repos","events_url":"https://api.github.com/users/cvogt/events{/privacy}","received_events_url":"https://api.github.com/users/cvogt/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-31T05:05:54Z","updated_at":"2015-09-13T09:46:04Z","closed_at":"2015-09-13T09:46:04Z","body":"This project currently offloads the tasks of html parsing and docset xml file and sqlite index db generation to dashing (https://github.com/technosophos/dashing).\r\n\r\nDashing is too limited with regards to the control it allows over what indices are generated for Dash. In particular it only allows for selectors by nested tags and no way to clean up the content. Play's h1s contains garbage § characters, Spray, cats and sbt mention more general information before the actual title in it's title tags, sbt includes source files with h1 tags. In order to clean up the generated indices, we need more flexibility.\r\n\r\nTo get rid of dashing we need to parse the html ourselves, traverse it to find the right things and clean them up before generating an sqlite db of indices from them. We also need to generate the xml file that dash requires.\r\n\r\nTo generate a docset, the html files go into  `Contents/Resources/Documents/` in the docset folder.\r\n\r\nFor traversal we can use scala's xpath like xml queries. In order to parse the html into clean xml this snippet should be helpful:\r\n\r\n```scala\r\n  // http://blog.dub.podval.org/2010/08/scala-and-tag-soup.html\r\n\r\n  import scala.xml.{Elem, XML}\r\n  import scala.xml.factory.XMLLoader\r\n    \r\n  import org.ccil.cowan.tagsoup.jaxp.SAXFactoryImpl\r\n    \r\n    \r\n  object TagSoupXmlLoader {\r\n    \r\n    private val factory = new SAXFactoryImpl()\r\n  \r\n    \r\n    def get(): XMLLoader[Elem] = {\r\n      XML.withSAXParser(factory.newSAXParser())\r\n    }\r\n  }\r\n\r\n// Strictly speaking, the class is not needed; one-liner \r\nXML.withSAXParser(new org.ccil.cowan.tagsoup.jaxp.SAXFactoryImpl().newSAXParser())\r\n```\r\n\r\nThe index sqlite db goes here `Contents/Resources/docSet.dsidx`.\r\n\r\nDashing uses the following commands to create it and insert the index values:\r\n\r\n`CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT)``\r\ndb.Exec(`INSERT OR IGNORE INTO searchIndex(name, type, path) VALUES (?,?,?)`, ref.name, ref.etype, ref.href)\r\n\r\nDashing uses the following template for the docset xml file:\r\n\r\n```\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\r\n<plist version=\"1.0\">\r\n<dict>\r\n  <key>CFBundleIdentifier</key>\r\n  <string>{{.Name}}</string>\r\n  <key>CFBundleName</key>\r\n  <string>{{.FancyName}}</string>\r\n  <key>DocSetPlatformFamily</key>\r\n  <string>{{.Name}}</string>\r\n  <key>isDashDocset</key>\r\n  <true/>\r\n  <key>DashDocSetFamily</key>\r\n  <string>dashtoc</string>\r\n  <key>dashIndexFilePath</key>\r\n  <string>{{.Index}}</string>\r\n  <key>isJavaScriptEnabled</key><{{.AllowJS}}/>\r\n</dict>\r\n</plist>\r\n```"}}