#!/usr/bin/env bash # # This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # Doxygen / README doc generation # # See git for contributors #
function header {
title=$1
breadcrumb=$2
output=$3
cat - > $output <<EOF
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>$title</title>
function proc_text { # Local links: [[...]] # Git links: [git:...] # Other remote links: [...] # Headings: == bleh == # Paragraphs: \n\n
sed -re ' s/\[\[([-_a-zA-Z0-9]+)\]\]/<a href="\1.html">\1<\/a>/g' - \
| sed -re ' s/\[git:([^]]+)\]/<a href="https:\/\/git.libreoffice.org\/core\/+\/refs\/heads\/master\/\1">\1<\/a>/g' \
| sed -re ' s/\[([^]]+)\]/<a href="\1">\1<\/a>/g' \
| sed -re ' s/====([^=]+)====/<h4>\1<\/h4>/g' \
| sed -re ' s/===([^=]+)===/<h3>\1<\/h3>/g' \
| sed -re ' s/==([^=]+)==/<h2>\1<\/h2>/g' \
| sed -re ':a;N;$!ba;s/\n\n/<\/p><p>/g' \
| awk 'BEGIN { print "<p>" } { print } END { print "</p>" }'
}
function proc_text_markdown {
sed -re ' s/\[git:([^]]+)\]/<a href="\.\.\/\1">\1<\/a>/g'
}
function check_cmd {
cmds_needed="$1"
error_msg="$2"
found=0; cmd= for cmd_needed in $cmds_needed; do
command -v $cmd_needed > /dev/null && { found=1; cmd=$cmd_needed; } done if [ $found = 0 ]; then echo"$error_msg" >&2
exit 1 fi export"${cmds_needed%% *}"=$cmd
}
function setup {
parm=$1 if [ -z "${!parm}" ] ; then echo"grep \"${parm}=\" ./config_host.mk | sed -re \" s/${parm}=//\")" echo"$parm=$(grep \"${parm}=\" ./config_host.mk | sed -re \" s/${parm}=//\")" eval"$parm=$(grep \"${parm}=\" ./config_host.mk | sed -re \" s/${parm}=//\")" fi if [ -z "${!parm}" ] ; then echo"could not determine $parm" >&2
exit 1 fi
}
# binaries that we need
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 markdown2 markdown2-3""You need either markdown or markdown2 in order to convert README.md into html"
# suck setup
setup "SOLARINC"
shopt -s nullglob
# Title of the documentation
DOXYGEN_PROJECT_PREFIX="LibreOffice"
# get list of modules if [ -z "$INPUT_PROJECTS" ]; then
INPUT_PROJECTS="`ls */Module_*.mk | sed 's#/.*##'`" fi
# generate docs echo"generating doxygen docs"
DOXYGEN_REF_TAGFILES="" for PROJECT in $INPUT_PROJECTS; do # avoid processing of full project subdirs, only add source and inc
# project header files can be in $PROJECT/inc and/or include/$PROJECT if [ -d "$PROJECT/inc" ]; then
PROJECT_INCLUDE="$PROJECT/inc" else
PROJECT_INCLUDE="" fi
if [ -d "include/$PROJECT" ]; then
PROJECT_INCLUDE="$PROJECT_INCLUDE include/$PROJECT" if [ "$PROJECT" = "sal" ]; then
PROJECT_INCLUDE="$PROJECT_INCLUDE include/osl include/rtl" fi fi
# setup referenced tagfiles for next round
DOXYGEN_REF_TAGFILES="$DOXYGEN_REF_TAGFILES $DOXYGEN_OUR_TAGFILE=$BASE_URL/$PROJECT/html" done
# generate entry page echo"generating index page"
header "LibreOffice Modules"" ""$BASE_OUTPUT/index.html" for module_name in *; do if [ -d $module_name ]; then
cur_file=$(echo $module_name/README.md) if [ -f "$cur_file" ]; then # write index.html entry
text=$(echo -e "<h2><a href=\"${module_name}.html\">${module_name}</a></h2>\n")
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"
if [ ${cur_file: -3} == ".md" ]; then # This is a markdown file.
text="$(${markdown} $cur_file | proc_text_markdown)" echo -e "$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 10 ]; 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 # Do not process these directories if [[ "$module_name" =~ ^(autom4te.cache|dictionaries|docs|helpcompiler|helpcontent2|include|instdir|lo|translations|workdir)$ ]]; then
continue fi echo -e "<li><a href=\"https://git.libreoffice.org/core/+/refs/heads/master/${module_name}\">${module_name}</a></li>\n" >> "$BASE_OUTPUT/index.html" done echo -e "</ul>\n" >> "$BASE_OUTPUT/index.html" fi
footer "$BASE_OUTPUT/index.html"
## done
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-05-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.