diff --git a/api/rendering/SyntaxHighlighter.cfc b/api/rendering/SyntaxHighlighter.cfc
index e67d3fd..a165201 100644
--- a/api/rendering/SyntaxHighlighter.cfc
+++ b/api/rendering/SyntaxHighlighter.cfc
@@ -18,7 +18,7 @@ component {
var jars = [ "../lib/pyg-in-blankets-1.0-SNAPSHOT-jar-with-dependencies.jar" ];
var highlighter = CreateObject( 'java', 'com.dominicwatson.pyginblankets.PygmentsWrapper', jars );
- if ( arguments.language == "luceescript" || arguments.language == "cfc" ) {
+ if ( arguments.language == "luceescript" ) {
arguments.language = "cfs";
}
if ( arguments.language == "lucee" ) {
@@ -30,7 +30,6 @@ component {
} catch( any e ) {
throw( type="docs.syntax.highlight.error", message="Error highlighting code for language [#arguments.language#]: [#arguments.code#]")
}
- return arguments.code;
}
// PRIVATE HELPERS
diff --git a/builders/dash/Builder.cfc b/builders/dash/Builder.cfc
new file mode 100644
index 0000000..6841357
--- /dev/null
+++ b/builders/dash/Builder.cfc
@@ -0,0 +1,144 @@
+component extends="builders.html.Builder" {
+
+// PUBLIC API
+ public void function build( docTree, buildDirectory ) {
+ var tree = docTree.getTree();
+ var docsetRoot = arguments.buildDirectory & "/presidecms.docset/";
+ var contentRoot = docsetRoot & "Contents/";
+ var resourcesRoot = contentRoot & "Resources/";
+ var docsRoot = resourcesRoot & "Documents/";
+ var ignorePages = [ "download" ]
+
+
+ if ( !DirectoryExists( arguments.buildDirectory ) ) { DirectoryCreate( arguments.buildDirectory ); }
+ if ( !DirectoryExists( docsetRoot ) ) { DirectoryCreate( docsetRoot ); }
+ if ( !DirectoryExists( contentRoot ) ) { DirectoryCreate( contentRoot ); }
+ if ( !DirectoryExists( resourcesRoot ) ) { DirectoryCreate( resourcesRoot ); }
+ if ( !DirectoryExists( docsRoot ) ) { DirectoryCreate( docsRoot ); }
+
+ try {
+ _setupSqlLite( resourcesRoot );
+
+ for( var page in tree ) {
+ if ( !ignorePages.find( page.getId() ) ) {
+ _writePage( page, docsRoot, docTree );
+ _storePageInSqliteDb( page );
+ }
+ }
+ } catch ( any e ) {
+ rethrow;
+ } finally {
+ _closeDbConnection();
+ }
+
+ _copyResources( docsetRoot );
+ _renameSqlLiteDb( resourcesRoot );
+ _setupFeedXml( arguments.buildDirectory & "/" );
+ }
+
+ public string function renderLink( any page, required string title ) {
+
+ if ( IsNull( arguments.page ) ) {
+ return '#HtmlEditFormat( arguments.title )#';
+ }
+
+ var link = page.getId() & ".html";
+
+ return '#HtmlEditFormat( arguments.title )#';
+ }
+
+// PRIVATE HELPERS
+ private string function _getHtmlFilePath( required any page, required string buildDirectory ) {
+ if ( arguments.page.getPath() == "/home" ) {
+ return arguments.buildDirectory & "/index.html";
+ }
+
+ return arguments.buildDirectory & arguments.page.getId() & ".html";
+ }
+
+ private void function _copyResources( required string rootDir ) {
+ FileCopy( "/builders/dash/resources/Info.plist", arguments.rootDir & "Contents/Info.plist" );
+ FileCopy( "/builders/dash/resources/icon.png", arguments.rootDir & "icon.png" );
+ DirectoryCopy( "/builders/html/assets/css/", arguments.rootDir & "Contents/Resources/Documents/assets/css", true, "*", true );
+ DirectoryCopy( "/builders/html/assets/images/", arguments.rootDir & "Contents/Resources/Documents/assets/images", true, "*", true );
+ DirectoryCopy( "/docs/_images/", arguments.rootDir & "Contents/Resources/Documents/images", true, "*", true );
+ }
+
+ private void function _setupSqlLite( required string rootDir ) {
+ variables.sqlite = _getSqlLiteCfc();
+ variables.dbFile = sqlite.createDb( dbName="docSet", destDir=arguments.rootDir & "/" );
+ variables.dbConnection = sqlite.getConnection( dbFile );
+
+ sqlite.executeSql( dbFile, "CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT)", false, dbConnection );
+ sqlite.executeSql( dbFile, "CREATE UNIQUE INDEX anchor ON searchIndex (name, type, path)", false, dbConnection );
+ }
+
+ private any function _getSqlLiteCfc() {
+ return new api.sqlitecfc.SqliteCFC(
+ tempdir = ExpandPath( "/api/sqlitecfc/tmp/" )
+ , libdir = ExpandPath( "/api/sqlitecfc/lib/" )
+ , model_path = "/api/sqlitecfc"
+ , dot_model_path = "api.sqlitecfc"
+ );
+ }
+
+ private void function _storePageInSqliteDb( required any page ) {
+ var dashPageType = "Guide";
+
+ switch( page.getPageType() ){
+ case "function":
+ dashPageType = "Function";
+ break;
+ case "method":
+ dashPageType = "Method";
+ break;
+ case "service":
+ dashPageType = "Service";
+ break;
+ case "presideobject":
+ dashPageType = "Object";
+ break;
+ case "form":
+ dashPageType = "File";
+ break;
+ case "category":
+ dashPageType = "Category";
+ break;
+ }
+
+ var data = {
+ name = Replace( page.getTitle(), "'", "''", "all" )
+ , type = dashPageType
+ , path = page.getId() & ".html"
+ };
+
+ data.path = page.getId() & ".html";
+
+ sqlite.executeSql( dbFile, "INSERT OR IGNORE INTO searchIndex(name, type, path) VALUES ('#data.name#', '#data.type#', '#data.path#')", false, dbConnection );
+
+ for( var child in page.getChildren() ){
+ _storePageInSqliteDb( child );
+ }
+ }
+
+ private void function _closeDbConnection() {
+ if ( StructKeyExists( variables, "dbConnection" ) ) {
+ dbConnection.close();
+ }
+ }
+
+ private void function _renameSqlLiteDb( required string rootDir ) {
+ FileMove( rootDir & "docSet.db", rootDir & "docSet.dsidx" );
+ }
+
+ private void function _setupFeedXml( required string rootDir ) {
+ var feedXml = FileRead( "/builders/dash/resources/feed.xml" );
+ var buildProps = new api.build.BuildProperties();
+
+ feedXml = Replace( feedXml, "{url}" , buildProps.getDashDownloadUrl(), "all" );
+ feedXml = Replace( feedXml, "{version}", buildProps.getDashBuildNumber(), "all" );
+
+ FileWrite( arguments.rootDir & "presidecms.xml", feedXml );
+
+ }
+}
\ No newline at end of file
diff --git a/builders/dash/layouts/breadcrumbs.cfm b/builders/dash/layouts/breadcrumbs.cfm
new file mode 100644
index 0000000..631a556
--- /dev/null
+++ b/builders/dash/layouts/breadcrumbs.cfm
@@ -0,0 +1,14 @@
+ There are no pages tagged with this category.#HtmlEditFormat( args.page.getTitle() )#
+ See also
+
+
+ #UCase( firstLetter )#
+ #( pageTypeTitles[ page.getPageType() ] ?: "Other articles" )#
+
+