You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/05/01 18:20:00 UTC

[GitHub] [lucene-solr] dweiss commented on a change in pull request #1477: LUCENE-9321: Port markdown task to Gradle

dweiss commented on a change in pull request #1477:
URL: https://github.com/apache/lucene-solr/pull/1477#discussion_r418669624



##########
File path: gradle/documentation/markdown.gradle
##########
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+
+import com.vladsch.flexmark.util.ast.Document;
+import com.vladsch.flexmark.ast.Heading;
+import com.vladsch.flexmark.html.HtmlRenderer;
+import com.vladsch.flexmark.parser.Parser;
+import com.vladsch.flexmark.parser.ParserEmulationProfile;
+import com.vladsch.flexmark.util.sequence.Escaping;
+import com.vladsch.flexmark.util.data.MutableDataSet;
+import com.vladsch.flexmark.ext.abbreviation.AbbreviationExtension;
+import com.vladsch.flexmark.ext.autolink.AutolinkExtension;
+
+buildscript {
+  repositories {
+    mavenCentral()
+  }
+
+  dependencies {
+    def flexmarkVersion = '0.61.24'
+  
+    classpath 'com.vladsch.flexmark:flexmark:' + flexmarkVersion
+    classpath 'com.vladsch.flexmark:flexmark-ext-autolink:' + flexmarkVersion
+    classpath 'com.vladsch.flexmark:flexmark-ext-abbreviation:' + flexmarkVersion
+  }
+}
+
+configure(subprojects.findAll { it.path == ':lucene' || it.path == ':solr' }) {
+  task markdownToHtml(type: Copy) {
+    filteringCharset = 'UTF-8'
+    includeEmptyDirs = false
+    from('.') {            // lucene
+      include 'MIGRATE.md'
+      include 'JRE_VERSION_MIGRATION.md'
+      include 'SYSTEM_REQUIREMENTS.md'
+    }
+    from('site') {         // solr
+      include '**/*.md'
+    }
+    into project.docroot
+    rename(/\.md$/, '.html')
+    filter(MarkdownFilter)
+  }
+  
+  task createDocumentationIndex {
+    // nocommit: this needs to be implemented next
+  }
+}
+
+class MarkdownFilter extends FilterReader {
+  public MarkdownFilter(Reader reader) throws IOException {
+    // this is a hack: it reads whole file, converts it and provides result as a StringReader

Review comment:
       Looks legit to me, not a hack? :)

##########
File path: gradle/documentation/markdown.gradle
##########
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+
+import com.vladsch.flexmark.util.ast.Document;
+import com.vladsch.flexmark.ast.Heading;
+import com.vladsch.flexmark.html.HtmlRenderer;
+import com.vladsch.flexmark.parser.Parser;
+import com.vladsch.flexmark.parser.ParserEmulationProfile;
+import com.vladsch.flexmark.util.sequence.Escaping;
+import com.vladsch.flexmark.util.data.MutableDataSet;
+import com.vladsch.flexmark.ext.abbreviation.AbbreviationExtension;
+import com.vladsch.flexmark.ext.autolink.AutolinkExtension;
+
+buildscript {
+  repositories {
+    mavenCentral()
+  }
+
+  dependencies {
+    def flexmarkVersion = '0.61.24'
+  
+    classpath 'com.vladsch.flexmark:flexmark:' + flexmarkVersion
+    classpath 'com.vladsch.flexmark:flexmark-ext-autolink:' + flexmarkVersion
+    classpath 'com.vladsch.flexmark:flexmark-ext-abbreviation:' + flexmarkVersion
+  }
+}
+
+configure(subprojects.findAll { it.path == ':lucene' || it.path == ':solr' }) {
+  task markdownToHtml(type: Copy) {
+    filteringCharset = 'UTF-8'
+    includeEmptyDirs = false
+    from('.') {            // lucene

Review comment:
       Right... same here.

##########
File path: gradle/documentation/documentation.gradle
##########
@@ -34,4 +36,11 @@ configure(subprojects.findAll { it.path == ':lucene' || it.path == ':solr' }) {
   ext {
     docroot = "${project.buildDir}/documentation"
   }
+  
+  task copyDocumentationAssets(type: Copy) {
+    includeEmptyDirs = false
+    from('site/html')      // lucene

Review comment:
       I'd rather have it as separate configure(":lucene"), configure(":solr") blocks... would be easier to separate the logic between the two?




----------------------------------------------------------------
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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org