ossarga commented on code in PR #121:
URL: https://github.com/apache/cassandra-website/pull/121#discussion_r841307662


##########
site-content/docker-entrypoint.sh:
##########
@@ -196,14 +196,87 @@ generate_site_yaml() {
 
 render_site_content_to_html() {
   pushd "${CASSANDRA_WEBSITE_DIR}/site-content" > /dev/null
-  echo "Building the site HTML content."
+  log_message "INFO" "Building the site HTML content."
   antora --generator antora-site-generator-lunr site.yaml
-  echo "Rendering complete!"
+  log_message "INFO" "Rendering complete!"
   popd > /dev/null
 }
 
+
+prepare_site_html_for_publication() {
+  pushd "${CASSANDRA_WEBSITE_DIR}" > /dev/null
+
+  # copy everything to content/ directory
+  log_message "INFO" "Moving site HTML to content/"
+  mkdir -p content/doc
+  cp -r site-content/build/html/* content/
+
+  # remove hardcoded domain name, and empty domain names first before we 
duplicate and documentation
+  content_files_to_change=($(grep -rl 'https://cassandra.apache.org/' 
content/))
+  log_message "INFO" "Removing hardcoded domain names in 
${#content_files_to_change[*]} files"
+  for content_file in ${content_files_to_change[*]}
+  do
+    log_message "DEBUG" "Processing file ${content_file}"
+    # sed automatically uses the character following the 's' as a delimiter.
+    # In this case we will use the ',' so we can avoid the need to escape the 
'/' characters
+    sed -i 's,https://cassandra.apache.org/,/,g' ${content_file}
+  done
+
+  content_files_to_change=($(grep -rl 'href="//' content/))
+  log_message "INFO" "Removing empty domain names in 
${#content_files_to_change[*]} files"
+  for content_file in ${content_files_to_change[*]}
+  do
+    log_message "DEBUG" "Processing file ${content_file}"
+    sed -i 's,href="//,href="/,g' ${content_file}
+  done
+
+  # move around the in-tree docs if generated
+  if [ "${COMMAND_GENERATE_DOCS}" = "run" ]
+  then
+    log_message "INFO" "Moving versioned documentation HTML to content/doc"
+    move_intree_document_directories "3.11" "3.11.11" "3.11.12"
+    move_intree_document_directories "4.0" "4.0.0" "4.0.1" "4.0.2" "4.0.3" 
"stable"
+    move_intree_document_directories "trunk" "4.1" "latest"

Review Comment:
   Agreed. I have been thinking about this for some time. It will be addressed 
in [CASSANDRA-17517](https://issues.apache.org/jira/browse/CASSANDRA-17517).



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

To unsubscribe, e-mail: dev-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to