diff options
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | Makefile.am | 61 | ||||
-rwxr-xr-x | html-gen.sh | 141 |
4 files changed, 154 insertions, 60 deletions
@@ -2,7 +2,7 @@ The following people have made contibutions to this project. Please keep this list in alphabetical order. Lillian Angel <[email protected]> -Andrew Azores <[email protected]> +Andrew Azores <[email protected]> Deepak Bhole <[email protected]> Ricardo MartÃn Camarero <[email protected]> Danesh Dadachanji <[email protected]> @@ -1,4 +1,12 @@ -2013-06-06 Jiri Vanek <[email protected]> +2013-07-11 Andrew Azores <[email protected]> + + * Makefile.am (stamps/html-gen): moved plaintext-to-HTML logic into new + shell script + * html-gen.sh: contains plaintext-to-HTML logic previously found in + Makefile.am. Added a sed expression to cause ChangeLog file listing + entries to be underlined. + +2013-07-06 Jiri Vanek <[email protected]> Andrew Azores <[email protected]> New about dialogue diff --git a/Makefile.am b/Makefile.am index eec2fe3..90359df 100644 --- a/Makefile.am +++ b/Makefile.am @@ -462,64 +462,9 @@ stamps/netx-html-gen.stamp: (cd $$NETX_SRCDIR/..; \ mkdir -p html-gen; \ cp AUTHORS NEWS COPYING ChangeLog html-gen/; \ - cd html-gen/; \ - for FILE in NEWS AUTHORS COPYING ChangeLog; \ - do \ - sed -r \ - -e "s/\t/ /g" $(: Convert tabs into four spaces) \ - -e "s/\&/\&/g" $(: "&" -> "&") \ - -e "s/ /\ \ /g" $(: Double-spaces into HTML whitespace for formatting) \ - -e "s/</\</g" $(: "<" -> "<") \ - -e "s/>/\>/g" $(: ">" -> ">") \ - -e 's/(\<)?(https?:\/\/[^ ]*)(\>| |$$)/\1<a href="\2">\2<\/a>\3/i' $(: Creates hyperlinks from http/https URLs) \ - -e 's/\<(.*@.*)\>/\<<a href="mailto:\1\?subject=IcedTea-Web">\1<\/a>\>/i' $(: Create mailto links from email addresses formatted as <[email protected]>) \ - -e "s/$$/<br>/g" $(: "\n" -> "<br>") \ - "./$$FILE" > "./$$FILE.html"; \ - done; \ - sed -i '4i <center>' AUTHORS.html; \ - sed -i '5i <br><img src="jamIcon.jpg" alt="Jam Icon" width="87" height="84"><br><br>' AUTHORS.html; $(: Insert jamIcon into AUTHORS.html and center the authors list)\ - echo "</center>" >> AUTHORS.html; \ - for FILE in NEWS.html ChangeLog.html; \ - do \ - mv $$FILE "$$FILE.old"; \ - COUNTER=0; \ - while read LINE; \ - do \ - BOLD=1; \ - if [[ $$FILE == "NEWS.html" ]]; \ - then \ - if [[ $$LINE =~ New\ in\ release* ]]; \ - then \ - BOLD=0; \ - COUNTER=$$(( $$COUNTER + 1 )); \ - fi; \ - if [[ $$COUNTER -gt 2 ]]; $(: Cut to two releases)\ - then \ - break; \ - fi; \ - else \ - if [[ $$LINE =~ .*\<\;.*\@.*\>\; ]]; $(: Matches eg <[email protected]>, after HTML-escaping)\ - then \ - BOLD=0; \ - fi; \ - if [[ $$LINE =~ [0-9]{4}-[0-9]{2}-[0-9]{2}* ]]; $(: Matches eg 2013-07-01)\ - then \ - COUNTER=$$(( $$COUNTER + 1 )); \ - fi; \ - if [[ $$COUNTER -gt 10 ]]; $(: Cut to ten changesets)\ - then \ - break; \ - fi; \ - fi; \ - if [[ $$BOLD -eq 0 ]]; $(: Highlight "New In Release" in News, and author name lines in ChangeLog) \ - then \ - echo "<b>$$LINE</b>" >> $$FILE; \ - else \ - echo "$$LINE" >> $$FILE; \ - fi; \ - done < "$$FILE.old"; \ - rm $$FILE.old; \ - done) + export HTML_GEN_DEBUG=true; \ + bash html-gen.sh; \ + unset HTML_GEN_DEBUG) ${INSTALL_DATA} $(NETX_SRCDIR)/../html-gen/*.html $(NETX_RESOURCE_DIR) rm -r $(NETX_SRCDIR)/../html-gen/ mkdir -p stamps diff --git a/html-gen.sh b/html-gen.sh new file mode 100755 index 0000000..5502f89 --- /dev/null +++ b/html-gen.sh @@ -0,0 +1,141 @@ +#!/bin/bash + +# html-gen.sh +# Copyright (C) 2013 Red Hat +# +# This file is part of IcedTea. +# +# IcedTea is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# IcedTea is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with IcedTea; see the file COPYING. If not, write to the +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA. +# +# Linking this library statically or dynamically with other modules is +# making a combined work based on this library. Thus, the terms and +# conditions of the GNU General Public License cover the whole +# combination. +# +# As a special exception, the copyright holders of this library give you +# permission to link this library with independent modules to produce an +# executable, regardless of the license terms of these independent +# modules, and to copy and distribute the resulting executable under +# terms of your choice, provided that you also meet, for each linked +# independent module, the terms and conditions of the license of that +# module. An independent module is a module which is not derived from +# or based on this library. If you modify this library, you may extend +# this exception to your version of the library, but you are not +# obligated to do so. If you do not wish to do so, delete this +# exception statement from your version. + +################################################################################ + +# This script is used by the stamps/html-gen target in Makefile.am. Its purpose +# is to produce HTML-escaped and formatted documents from a set of plaintext +# documents, namely AUTHORS, NEWS, ChangeLog, and COPYING, located in the +# same directory as this script. These generated HTML documents are then used +# in the netx About Dialog, which can be invoked with "javaws -about". + +# Currently the script is not configurable in any way and the files it processes +# are hardcoded. To run the script manually, create a directory "html-gen" in the +# same directory as this script, containing files named AUTHORS, NEWS, ChangeLog, +# and COPYING. Note that these files WILL be modified in-place during the HTML +# "conversion" process. Setting the environment variable "HTML_GEN_DEBUG" to "true" +# will enable some output from the script, which may be useful if you encounter +# issues with this script's processing of an input file. + +if [ -z "$HTML_GEN_DEBUG" ]; then HTML_GEN_DEBUG="false"; fi + +print_debug() { + if [ "$HTML_GEN_DEBUG" == "true" ]; then echo "$1"; fi +} + +start_time=$(date +%s.%N) + +cd html-gen + +print_debug "Starting sed substitutions" +for FILE in NEWS AUTHORS COPYING ChangeLog +do + print_debug "Processing $FILE..." + sed -i -r 's/\t/ /g' "./$FILE" # Convert tabs into four spaces + sed -i -r 's/\&/\&/g' "./$FILE" # "&" -> "&" + sed -i -r 's/ /\ \ /g' "./$FILE" # Double-spaces into HTML whitespace for format preservation + sed -i -r 's/</\</g' "./$FILE" # "<" -> "<" + sed -i -r 's/>/\>/g' "./$FILE" # ">" -> ">" + sed -i -r 's_(\<)?(https?://[^ ]*)(\>| |$)_\1<a href="\2">\2</a>\3_i' "./$FILE" # Create hyperlinks from http(s) URLs + sed -i -r 's/\<(.*@.*)\>/\<<a href="mailto:\1\?subject=IcedTea-Web">\1<\/a>\>/i' "./$FILE" # Create mailto links from email addresses formatted as <[email protected]> + sed -i -r 's/$/<br>/' "./$FILE" # "\n" -> "<br>" + + mv "$FILE" "$FILE.html" + print_debug "$FILE.html finished." +done + +print_debug "Done sed subs. Starting in-place additions" + +# Centre the column of author names in the Authors file +sed -i '4i <center>' AUTHORS.html +# Insert jamIcon above author names +sed -i '5i <br><img src="jamIcon.jpg" alt="Jam Icon" width="87" height="84"><br><br>' AUTHORS.html +echo "</center>" >> AUTHORS.html + +print_debug "Done. Starting formatting (bolding, mailto and hyperlink creation)" + +for FILE in NEWS.html ChangeLog.html +do + print_debug "Processing $FILE..." + mv $FILE "$FILE.old" + COUNTER=0 + while read LINE + do + BOLD=1 + if [[ $FILE == "NEWS.html" ]] + then + if [[ $LINE =~ New\ in\ release* ]] + then + BOLD=0 + COUNTER=$(( $COUNTER + 1 )) + fi + if [[ $COUNTER -gt 2 ]] # Cut to two releases + then + break + fi + else + if [[ $LINE =~ .*\<\;.*\@.*\>\; ]] # Matches eg <[email protected]>, after HTML-escaping + then + BOLD=0 + fi + if [[ $LINE =~ [0-9]{4}-[0-9]{2}-[0-9]{2}* ]] # Matches eg 2013-07-01 + then + COUNTER=$(( $COUNTER + 1 )) + fi + if [[ $COUNTER -gt 10 ]] # Cut to ten changesets + then + break + fi + fi + if [[ $BOLD -eq 0 ]] # Highlight "New In Release" in News, and author name lines in ChangeLog + then + LINE="<b>$LINE</b>" + fi + echo "$LINE" >> $FILE + done < "$FILE.old" + rm "$FILE.old" + print_debug "$FILE finished" +done + +sed -i -r 's|(\*\ .*):|<u>\1</u>:|' ChangeLog.html # Underline changed files in ChangeLog, eg "* Makefile.am:" + +end_time=$(date +%s.%N) + +print_debug "HTML generation complete" +print_debug "Total elapsed time: $(echo "$end_time - $start_time" | bc )" |