You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/04/03 21:54:11 UTC

[GitHub] [incubator-druid] justinborromeo commented on a change in pull request #7406: Console SQL function doc generation

justinborromeo commented on a change in pull request #7406: Console SQL function doc generation
URL: https://github.com/apache/incubator-druid/pull/7406#discussion_r271947952
 
 

 ##########
 File path: web-console/script/create-sql-function-doc.js
 ##########
 @@ -0,0 +1,104 @@
+#!/usr/bin/env node
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+const fs = require('fs-extra');
+const readfile='../docs/content/querying/sql.md'
+const writefile='lib/sql-function-doc.ts'
+
+const license = '/*\n' +
+  ' * Licensed to the Apache Software Foundation (ASF) under one\n' +
+  ' * or more contributor license agreements.  See the NOTICE file\n' +
+  ' * distributed with this work for additional information\n' +
+  ' * regarding copyright ownership.  The ASF licenses this file\n' +
+  ' * to you under the Apache License, Version 2.0 (the\n' +
+  ' * "License"); you may not use this file except in compliance\n' +
+  ' * with the License.  You may obtain a copy of the License at\n' +
+  ' *\n' +
+  ' *     http://www.apache.org/licenses/LICENSE-2.0\n' +
+  ' *\n' +
+  ' * Unless required by applicable law or agreed to in writing, software\n' +
+  ' * distributed under the License is distributed on an "AS IS" BASIS,\n' +
+  ' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n' +
+  ' * See the License for the specific language governing permissions and\n' +
+  ' * limitations under the License.\n' +
+  ' */\n\n';
+
+const comment = '// This file is auto generated and should not be modified\n\n';
+
+const interfaceStr = 'export interface FunctionDescription {\n' +
+  '  syntax: string;\n' +
+  '  description: string;\n' +
+  '}\n\n';
+
+const disableTSlint = '/* tslint:disable */\n\n';
+
+const readDoc = async () => {
+  try {
+
+    let content = license + comment + interfaceStr + disableTSlint + "export const SQLFunctionDoc: FunctionDescription[] = [\n";
+
+    const data = await fs.readFile(readfile, 'utf-8');
+    const sections = data.toString().split("##");
 
 Review comment:
   This seems like it's sensitive to the subtitle levels in the SQL docs.  For example, if someone were to change a `##` to `#` for some stylistic reason, it would likely mess up this parser.  Is there a way to make it less sensitive to those types of changes?  If not, it might be good to add a comment in the SQL doc that the existing formatting must be maintained so that this won't break.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org