"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/highlight-langs2adoc.sh" (12 May 2020, 5193 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "highlight-langs2adoc.sh": 3.53_vs_3.54.

    1 #!/bin/bash
    2 
    3 # "highlight-langs2adoc.sh" v1.1.0 2019/03/30 | by Tristano Ajmone | MIT License
    4 # ******************************************************************************
    5 # *                                                                            *
    6 # *                    Highlight Languages 2 AsciiDoc Page                     *
    7 # *                                                                            *
    8 # ******************************************************************************
    9 # The script queries Highlight for its version and the full list of packaged
   10 # languages, it then creates a well formatted AsciiDoc file.
   11 #
   12 # Created for autoupdating the Highlight README_LANGLIST page that lists all the
   13 # supported languages by the latest Highlight version:
   14 #
   15 #   https://gitlab.com/saalen/highlight/README_LANGLIST.adoc
   16 #
   17 # You're free to adapt this script to your own needs, but please do honour its
   18 # license terms and duely credit me!
   19 # ------------------------------------------------------------------------------
   20 echo "==========================================="
   21 echo "Autogenerating Highlight langs list page..."
   22 echo "==========================================="
   23 
   24 # ===========================
   25 # Setup Environment Variables
   26 # ===========================
   27 # The output AsciiDoc file:
   28 OUT_FILE="./README_LANGLIST.adoc"
   29 
   30 # =========================
   31 # Retrieve Highlight Version
   32 # =========================
   33 HL_VER="$(highlight --version | grep -P -o -m1 '\d\.\d\d')"
   34 echo "Highlight version found: ${HL_VER}"
   35 
   36 # ================================
   37 # Retrieve Current Date (Moth Year)
   38 # ================================
   39 CURR_DATE="$(LANG=en_US.utf8 date -u '+%B %Y')"
   40 echo "Current date: ${CURR_DATE}"
   41 
   42 # =================================
   43 # Write Document Chunk #1 -- Header
   44 # =================================
   45 cat << EOF > $OUT_FILE
   46 = HIGHLIGHT LANGUAGES LIST
   47 André Simon
   48 v${HL_VER}, ${CURR_DATE}
   49 :lang: en
   50 :experimental:
   51 :icons: font
   52 :linkattrs:
   53 :toc!:
   54 // GitHub Settings for Admonitions Icons:
   55 ifdef::env-github[]
   56 :caution-caption: :fire:
   57 :important-caption: :heavy_exclamation_mark:
   58 :note-caption: :information_source:
   59 :tip-caption: :bulb:
   60 :warning-caption: :warning:
   61 endif::[]
   62 
   63 ////
   64 *****************************************
   65 * THIS IS AN AUTO-GENERATED DOCUMENT!!! *
   66 *****************************************
   67 Any manual changes to this document will be
   68 overwritten by automated scripted updates!
   69 ////
   70 
   71 // =====================================
   72 // Custom Attributes for Reference Links
   73 // =====================================
   74 :README: pass:q[link:README.adoc[\`README\`]]
   75 :filetypes_conf: pass:q[link:filetypes.conf[\`filetypes.conf\`^]]
   76 :script: pass:q[link:highlight-langs2md.sh[script^,title="View source of 'highlight-langs2md.sh' script"]]
   77 
   78 The table below lists all supported languages, their syntax definition filenames,
   79 and the associated file extensions (configured in {filetypes_conf}).
   80 
   81 By default, the \`*.lang\` files are located in \`/usr/share/highlight/langDefs/\`.
   82 See the {README} for other user defined locations.
   83 
   84 # Languages List
   85 
   86 Packaged language definitions, obtained via \`highlight --list-scripts=langs\`
   87 
   88 [cols="<4d,<1m,<5m"]
   89 |==========================================
   90 | Language | Filename | Extensions
   91 
   92 EOF
   93 # =====================================
   94 # Write Document Chunk #2 -- Langs List
   95 # =====================================
   96 highlight --list-scripts=langs |\
   97     grep -x -E '^(.*?)( *: )(.*?)$' |\
   98     sed -E 's/^(.*?): *(\w+)(( +\()(.*?)( +\)))?/| \1 | link:.\/langDefs\/\2.lang[`\2.lang`,title="View source file"] | \5/g' |\
   99     sort -\
  100     >> $OUT_FILE
  101 # =================================
  102 # Write Document Chunk #3 -- Footer
  103 # =================================
  104 cat << EOF >> $OUT_FILE
  105 |==========================================
  106 
  107 [NOTE]
  108 This page is autogenerated via a {script}.
  109 Any manual edits to the page will be lost when the page is updated.
  110 
  111 
  112 EOF
  113 
  114 # ------------------------------------------------------------------------------
  115 # MIT License
  116 #
  117 # Copyright (c) 2018 Tristano Ajmone <tajmone@gmail.com>
  118 #
  119 # Permission is hereby granted, free of charge, to any person obtaining a copy
  120 # of this software and associated documentation files (the "Software"), to deal
  121 # in the Software without restriction, including without limitation the rights
  122 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  123 # copies of the Software, and to permit persons to whom the Software is
  124 # furnished to do so, subject to the following conditions:
  125 #
  126 # The above copyright notice and this permission notice shall be included in all
  127 # copies or substantial portions of the Software.
  128 #
  129 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  130 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  131 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  132 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  133 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  134 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  135 # SOFTWARE.
  136 # ------------------------------------------------------------------------------