[Libreoffice-commits] core.git: 2 commits - solenv/bin xmloff/README xmloff/README.md

Kohei Yoshida kohei.yoshida at collabora.com
Sat May 20 00:44:19 UTC 2017


 solenv/bin/mkdocs.sh |   46 ++++++++++++++++++++++++++++++++++++----------
 xmloff/README.md     |   11 +++++------
 2 files changed, 41 insertions(+), 16 deletions(-)

New commits:
commit 624ec199068090d2c60854cc8618116d7feaf1c9
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri May 19 20:43:04 2017 -0400

    This README is in markdown format now.
    
    Change-Id: Ibaf47feb4b281cf6048cc50366019b48fbc53fb4

diff --git a/xmloff/README b/xmloff/README.md
similarity index 89%
rename from xmloff/README
rename to xmloff/README.md
index 293666bc3a49..47469fda2cbf 100644
--- a/xmloff/README
+++ b/xmloff/README.md
@@ -6,7 +6,7 @@ via its UNO API, which has the advantage that the same import/export
 code can be used for text in all applications (from/to Writer/EditEngine).
 The filter consumes/produces via SAX UNO API interface (implemented in
 "sax").  Various bits of the ODF filters are also implemented in
-applications, for example sw/source/filter/xml.
+applications, for example [git:sw/source/filter/xml].
 
 There is a central list of all element or attribute names in
 include/xmloff/xmltoken.hxx.  The main class of the import filter
@@ -32,8 +32,7 @@ from/to ODF, i.e., when importing a document the transform library reads
 the SAX events from the file and generates SAX events that are then
 consumed by the ODF import filter.
 
-http://www.openoffice.org/xml/general.html
-http://www.openoffice.org/xml/xml_specification.pdf
+[OpenOffice.org XML File Format](http://www.openoffice.org/xml/general.html)
 
 There is some stuff in the "dtd" directory which is most likely related
 to the OpenOffice.org XML format but is possibly outdated and obsolete.
@@ -43,7 +42,7 @@ to the OpenOffice.org XML format but is possibly outdated and obsolete.
 When adding a new XML token, you need to add its entry in the following three
 files:
 
-* include/xmloff/xmltoken.hxx
-* xmloff/source/core/xmltoken.cxx
-* xmloff/source/token/tokens.txt
+* [git:include/xmloff/xmltoken.hxx]
+* [git:xmloff/source/core/xmltoken.cxx]
+* [git:xmloff/source/token/tokens.txt]
 
commit 78315e1da16da0466a8b5d564c63142b6b99f5b8
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri May 19 20:41:08 2017 -0400

    Support markdown format for module README file.
    
    Now you can author a module README file in markdown format.  To
    distinguish it from the existing format, you need to save it as
    README.md then it'll be treated as a markdown file.
    
    Change-Id: Iebf3ae32608d348768b2da7157d122954a7b72f7

diff --git a/solenv/bin/mkdocs.sh b/solenv/bin/mkdocs.sh
index 84b137900470..cd2a33f6d485 100755
--- a/solenv/bin/mkdocs.sh
+++ b/solenv/bin/mkdocs.sh
@@ -84,6 +84,21 @@ function proc_text {
   | awk 'BEGIN { print "<p>" } { print } END { print "</p>" }'
 }
 
+function proc_text_markdown {
+  sed -re ' s/\[\[([-_a-zA-Z0-9]+)\]\]/<a href="\1.html">\1<\/a>/g' - \
+  | sed -re ' s/\[git:([^]]+)\]/<a href="http:\/\/cgit.freedesktop.org\/libreoffice\/core\/tree\/\1">\1<\/a>/g'
+}
+
+function check_cmd {
+  cmd_needed="$1"
+  error_msg="$2"
+
+  which $cmd_needed > /dev/null 2>&1 || {
+    echo "$error_msg" >&2
+    exit 1
+  }
+}
+
 function setup {
   parm=$1
   if [ -z "${!parm}" ] ; then
@@ -98,14 +113,9 @@ function setup {
 }
 
 # binaries that we need
-which doxygen > /dev/null 2>&1 || {
-    echo "You need doxygen for doc generation" >&2
-    exit 1
-}
-which dot > /dev/null 2>&1 || {
-    echo "You need the graphviz tools to create the nice inheritance graphs" >&2
-    exit 1
-}
+check_cmd doxygen "You need doxygen for doc generation"
+check_cmd dot "You need the graphviz tools to create the nice inheritance graphs"
+check_cmd markdown "You need markdown in order to convert README.md into html"
 
 # suck setup
 setup "SOLARINC"
@@ -212,7 +222,15 @@ for module_name in *; do
     if [ -f "$cur_file" ]; then
       # write index.html entry
       text="<h2><a href=\"${module_name}.html\">${module_name}</a></h2>\n"
-      text="${text}$(head -n1 $cur_file | proc_text )"
+
+      if [ ${cur_file: -3} == ".md" ]; then
+        # This is a markdown file.
+        header_text="$(head -n1 $cur_file)"
+        header_text="$(echo ${header_text} | sed -e 's/^\#*//g')"
+        text="${text}${header_text}"
+      else
+        text="${text}$(head -n1 $cur_file | proc_text)"
+      fi
       echo -e $text >> "$BASE_OUTPUT/index.html"
 
       # write detailed module content
@@ -224,13 +242,21 @@ for module_name in *; do
       fi
       text="${text} </p><p> </p>"
       echo -e $text >> "$BASE_OUTPUT/${module_name}.html"
-      proc_text < $cur_file >> "$BASE_OUTPUT/${module_name}.html"
+
+      if [ ${cur_file: -3} == ".md" ]; then
+        # This is a markdown file.
+        text="$(markdown $cur_file | proc_text_markdown)"
+        echo $text >> "$BASE_OUTPUT/${module_name}.html"
+      else
+        proc_text < $cur_file >> "$BASE_OUTPUT/${module_name}.html"
+      fi
       footer "$BASE_OUTPUT/${module_name}.html"
     else
       empty_modules[${#empty_modules[*]}]=$module_name
     fi
   fi
 done
+
 if [ ${#empty_modules[*]} -gt 0 ]; then
   echo -e "<p> </p><p>READMEs were not available for these modules:</p><ul>\n" >> "$BASE_OUTPUT/index.html"
   for module_name in "${empty_modules[@]}"; do


More information about the Libreoffice-commits mailing list