@@ -114,17 +114,24 @@ struct GenerateCommand: CommandProtocol {
114
114
return try interfaceForModule ( module. name, compilerArguments: module. compilerArguments)
115
115
}
116
116
117
+ fileprivate func documentate( _ sourcetext: String , module: String , options: GenerateCommandOptions ) throws {
118
+ let output = sourcetext
119
+ try createDirectory ( path: options. outputFolder)
120
+ try write ( to: options. outputFolder, module: module, documentation: output)
121
+ }
122
+
117
123
private func generateDocumentation( docs: [ String : SourceKitRepresentable ] , options: GenerateCommandOptions , module: String ) throws {
118
124
if options. clean {
119
125
try CleanCommand . removeModuleInterface ( path: options. outputFolder, module: module)
120
126
}
121
- guard let sourcetext = docs [ " key.sourcetext " ] as? String else {
127
+ if let sourcetext = docs [ " key.sourcetext " ] as? String {
128
+ try documentate ( sourcetext, module: module, options: options)
129
+ } else if let dictionary = docs [ " key.annotations " ] as? SwiftDoc , let sourcetext = process ( dictionary: dictionary, options: options) {
130
+ try documentate ( sourcetext, module: module, options: options)
131
+ } else {
122
132
let message = " Unable to parse module named \( module) "
123
133
throw ModuleInterface . Error. default ( message)
124
134
}
125
- let output = sourcetext
126
- try createDirectory ( path: options. outputFolder)
127
- try write ( to: options. outputFolder, module: module, documentation: output)
128
135
}
129
136
130
137
private func write( to path: String , module: String , documentation: String ) throws {
0 commit comments