-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy documentation content from docs to docs-main
- Loading branch information
Showing
124 changed files
with
14,468 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
site-dev.yml | ||
yarn-error.log | ||
cache/ | ||
node_modules/ | ||
public/ | ||
pdf_web/ | ||
tmp/ | ||
.DS_Store | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"printWidth": 99, | ||
"singleQuote": true, | ||
"semi": false, | ||
"trailingComma": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,36 @@ | ||
# docs-main | ||
# ownCloud Main Page | ||
|
||
**Table of Contents** | ||
|
||
* [Building the Main Page Docs](#building-the-main-page-docs) | ||
* [General Notes](#general-notes) | ||
* [Generating the Documentation](#generating-the-documentation) | ||
* [Target Branch and Backporting](#target-branch-and-backporting) | ||
* [Branching Workflow](#branching-workflow) | ||
* [Create a New Version Branch for ownCloud Server](#create-a-new-version-branch-for-owncloud-server) | ||
|
||
## Building the Main Page Docs | ||
|
||
The ownCloud Main Page documentation is not built independently. Instead, it is built together with the [documentation](https://github.com/owncloud/docs/). However, you can build a local copy of the ownCloud Server documentation to preview changes you are making. | ||
|
||
Whenever a Pull Request of this repo gets merged, it automatically triggers a full docs build. | ||
|
||
## General Notes | ||
|
||
To make life easier, most of the content written in [docs](https://github.com/owncloud/docs#readme) applies also here. For ease of reading, the most important steps are documented here too. For more information see the link provided. Only a few topics of this repo are unique like the branching. | ||
|
||
## Generating the Documentation | ||
|
||
See the [Generating the Documentation](https://github.com/owncloud/docs#generating-the-documentation) in the docs repo for more details as it applies to all documentation repositories. | ||
|
||
## Target Branch and Backporting | ||
|
||
See the the [following section](https://github.com/owncloud/docs#target-branch-and-backporting) as the same rules and notes apply. | ||
|
||
## Branching Workflow | ||
|
||
Please refer to the [Branching Workflow for ownCloud Server](./docs/the-branching-workflow.md) for more information. | ||
|
||
## Create a New Version Branch for ownCloud Server | ||
|
||
Please refer to [Create a New Version Branch for ownCloud Server](./docs/new-version-branch.md) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: docs_main | ||
title: ownCloud Main Page | ||
version: next | ||
start_page: ROOT:index.adoc | ||
nav: | ||
- modules/ROOT/partials/nav.adoc | ||
|
||
asciidoc: | ||
attributes: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,275 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# This script checks which .adoc files are possibly orphaned | ||
# It can cover single and multi manual environments | ||
# | ||
# Note that filenames MUST NOT contain blanks | ||
|
||
AVAILABLE_MANUALS=( ROOT ) | ||
# dependend of root or not, the manual name gets a postfix added, name see below | ||
ROOT_NAME="ROOT" | ||
# all main nav files from the modules have the name nav.adoc | ||
NAV_FILENAME="nav.adoc" | ||
PARTIALS_NAME="partials" | ||
# https://docs.antora.org/antora/2.3/page/resource-id/#id-coordinates | ||
FAMILY='{partialsdir}' | ||
#FAMILY="partial$" | ||
MANUAL_NAME= | ||
MANUAL_POSTFIX="_manual" | ||
PARTIAL_FILES=() | ||
PAGES_FILES=() | ||
PAGES_DIR= | ||
PARTIALS_DIR= | ||
NAV_FILE= | ||
|
||
function get_antora_nav_list() | ||
{ | ||
local filename="$1" | ||
|
||
while read line; do | ||
if [[ ${line} =~ \]$ ]]; then | ||
# remove xref, the level (*), the description ([]), the manual-name | ||
# in case of ROOT, if exists, additionally removes all leading dots and a leading colon | ||
revised_line=$(echo "$line" | sed 's/xref//' | sed 's/\[.*\]//g' | sed -r 's/^\*{1,} //' | sed -E 's/^:.*?://' | sed 's/^\.*//g' | sed 's/^://g') | ||
echo "${revised_line}" | ||
fi | ||
done < "${filename}" | ||
} | ||
|
||
function validate_manual() | ||
{ | ||
# make a comma-separated list of the modules | ||
local list=$(echo ${AVAILABLE_MANUALS[@]} | sed -r 's/[ ]+/, /g') | ||
local manual="$1" | ||
|
||
# ok if manual is in the list of possible manuals | ||
if [[ ${AVAILABLE_MANUALS[@]} =~ (^|[[:space:]])"${manual}"($|[[:space:]]) ]]; then | ||
return 0 | ||
fi | ||
|
||
echo | ||
echo "[${manual}] is not a valid manual." | ||
echo "Available manuals are: ${list}." | ||
echo | ||
exit | ||
} | ||
|
||
function usage() | ||
{ | ||
# create a list of modules separated by | | ||
local list=$(echo ${AVAILABLE_MANUALS[@]} | sed -r 's/[ ]+/|/g') | ||
|
||
echo | ||
echo "Usage: ./bin/find-orphaned-adoc-files [-h] [-n <${list}>]" | ||
echo | ||
echo "-h ... Help" | ||
echo "-n ... Check manual <name>" | ||
echo | ||
echo "Note, files not added by its proper path like ../file.adoc" | ||
echo "are reported as false positives !" | ||
} | ||
|
||
function find_orphans() | ||
{ | ||
local search_pattern= | ||
|
||
validate_manual "$MANUAL_NAME" | ||
|
||
# escape the dollar sign in the search pattern if exists | ||
search_pattern="include::${FAMILY//$/\\$}" | ||
|
||
# define the global variables | ||
# the base directory name depends if there is a single or are multiple manuals available | ||
if [[ ${MANUAL_NAME} = ${ROOT_NAME} ]]; then | ||
BASE_DIR="./modules/${MANUAL_NAME}" | ||
else | ||
BASE_DIR="./modules/${MANUAL_NAME}${MANUAL_POSTFIX}" | ||
fi | ||
# | ||
PAGES_DIR="${BASE_DIR}/pages" | ||
|
||
# define the navigation file | ||
NAV_FILE="${BASE_DIR}/${PARTIALS_NAME}/${NAV_FILENAME}" | ||
|
||
# --> important: the partials dir may change to base_dir/partials_name | ||
PARTIALS_DIR="${BASE_DIR}/${PARTIALS_NAME}" | ||
|
||
# get content for all partials but exclude the nav file, however we call it | ||
# partials directory may not be present | ||
if [ -d "${PARTIALS_DIR}" ]; then | ||
PARTIAL_FILES=($(find "${PARTIALS_DIR}" -type f \( -name '*.adoc' ! -name ${NAV_FILENAME} \) -print | sed "s|$PARTIALS_DIR\/||g" | sort)) | ||
#echo "${PARTIAL_FILES[@]}" | tr ' ' '\n' | ||
#exit | ||
fi | ||
|
||
find_orphans_for_manual "$MANUAL_NAME" | ||
} | ||
|
||
function find_orphans_for_manual() | ||
{ | ||
local not_in_path='-path "**/.DS_Store" -o -path "**/vendor" -o -path "**/.gitkeep"' | ||
local files_with_relative_include=() | ||
local nav_list=() | ||
local not_in_nav=() | ||
local not_in_nav_filename_only=() | ||
local includes_found=() | ||
local true_not_in_nav=() | ||
local search_list=() | ||
local xrefed=() | ||
local not_xrefed=() | ||
local partial_list=() | ||
local not_partial=() | ||
local output=() | ||
local grep_list= | ||
|
||
echo | ||
echo "Finding orphans in the ${MANUAL_NAME} manual" | ||
echo | ||
|
||
# # get a list of all .adoc files but exclude the partials dir | ||
# this list starts with _partial - needs later removal when checking | ||
PAGES_FILES=($(find "${PAGES_DIR}" -type d \( -path "${PARTIALS_DIR}" -o $not_in_path \) -prune -o -type f \( -name '*.adoc' \) -print | sort | sed "s|${PAGES_DIR}/||")) | ||
#echo "${PAGES_FILES[@]}" | tr ' ' '\n' | ||
#exit | ||
|
||
# get all files which have a relative include statement | ||
# (include a file relative the current adoc file) | ||
# this is necessary because these includes need further processing to remove false positives. | ||
# the result includes the relative path of the files | ||
files_with_relative_include=($(grep -oF 'include::./' "${PAGES_FILES[@]/#/${PAGES_DIR}/}" | sed "s|:include::.\/||g" | sort | uniq)) | ||
#echo "${files_with_relative_include[@]}" | tr ' ' '\n' | ||
#exit | ||
|
||
# get all files referenced via xref in the navigation file | ||
nav_list=(`get_antora_nav_list "$NAV_FILE"`) | ||
#echo "${nav_list[@]}" | tr ' ' '\n' | ||
#exit | ||
|
||
# create an array diff of unique files not referenced in the navigation | ||
not_in_nav=($(echo ${PAGES_FILES[@]} ${nav_list[@]} | tr ' ' '\n' | sort | uniq -u)) | ||
#echo "${not_in_nav[@]}" | tr ' ' '\n' | ||
#exit | ||
|
||
# run only if there are files with an include:: statement found | ||
# if not found, true_not_in_nav will not be set | ||
# ${#files_with_relative_include[@]} counts the occurrences | ||
if (( ${#files_with_relative_include[@]} )); then | ||
# make a list of all include lines only keeping the path/file | ||
includes_found=($(grep -w "include:." "${files_with_relative_include[@]}" | sed "s|include::.\/||g" | sed "s/\[[^\[]*$//" | uniq -u)) | ||
#echo "${includes_found[@]}" | tr ' ' '\n' | ||
#exit | ||
|
||
# create a grep-able list in the for of a|b|c... | ||
grep_list=$(echo ${includes_found[@]} | tr ' ' '|') | ||
|
||
# get all items which are not in the nav list | ||
true_not_in_nav=($(echo "${not_in_nav[@]}" | tr ' ' '\n' | grep -vE "${grep_list}")) | ||
#echo "${true_not_in_nav[@]}" | tr ' ' '\n' | ||
#exit | ||
else | ||
true_not_in_nav=${not_in_nav[@]} | ||
#echo "${true_not_in_nav[@]}" | tr ' ' '\n' | ||
#exit | ||
fi | ||
|
||
# if all files found are referenced in the navigation, you do not have orphaned .adoc files | ||
if [ -z "$true_not_in_nav" ]; then | ||
echo -e "\e[1;36mNo orphaned .adoc files in pages from navigation and includes.\e[0m" | ||
echo | ||
fi | ||
|
||
# create a search list like: "xref:path/filename.adoc" | ||
# based on all files found not referenced in the nav file or via include (like the occ commands) | ||
search_list="${true_not_in_nav[@]/#/xref:}" | ||
#echo "${search_list[@]}" | tr ' ' '\n' | ||
#exit | ||
|
||
# get all items which match the search list | ||
xrefed=($(cat "${PAGES_FILES[@]/#/${PAGES_DIR}/}" | grep -of <(echo ${search_list[@]}| tr ' ' '\n') | sort | uniq | sed "s|xref:||")) | ||
#echo ${xrefed[@]} | tr ' ' '\n' | ||
#exit | ||
|
||
# now make a diff of the not in nav and the xrefed match list | ||
# this is the list which is not xref'ed in any adoc file located in pages | ||
not_xrefed=($(echo ${true_not_in_nav[@]} ${xrefed[@]} | tr ' ' '\n' | sort | uniq -u)) | ||
#echo ${not_xrefed[@]} | tr ' ' '\n' | ||
#exit | ||
|
||
if (( ${#not_xrefed[@]} )); then | ||
echo | ||
echo -e "\e[1;35mFollowing files are not listed in nav.adoc or included/xrefed in the pages dir.\e[0m" | ||
echo -e "\e[1;35mCheck if this is intended.\e[1;31m" | ||
echo | ||
printf '%s\n' "${not_xrefed[@]/#/' '${PAGES_DIR}/}" | ||
echo -e "\e[0m" | ||
echo "You may want to check the orphan history via:" | ||
echo | ||
echo "git log --full-history -- full_path_file_from_above" | ||
echo | ||
else | ||
echo -e "\e[1;36mNo orphaned .adoc files in the pages dir (xref).\e[0m" | ||
echo | ||
fi | ||
|
||
# now check if there are orphaned partials files | ||
|
||
# get all files which have an include + family statement | ||
include_list=($(cat "${PAGES_FILES[@]/#/${PAGES_DIR}/}" | grep "${search_pattern}" | sort | uniq)) | ||
#echo ${include_list[@]} | tr ' ' '\n' | ||
#exit | ||
|
||
# get the list of files which are included as a partial | ||
partial_list=($((echo "${include_list[@]}" | tr ' ' '\n') | grep -of <(echo ${PARTIAL_FILES[@]}| tr ' ' '\n'))) | ||
#echo ${partial_list[@]} | tr ' ' '\n' | ||
#exit | ||
|
||
# | ||
not_partial=($(echo ${PARTIAL_FILES[@]} ${partial_list[@]} | tr ' ' '\n' | sort | uniq -u)) | ||
#echo ${not_partial[@]}| tr ' ' '\n' | ||
#exit | ||
|
||
if (( ${#not_partial[@]} )); then | ||
echo -e "\e[1;35mFollowing partial files are not linked anywhere and therefore orphaned.\e[0m" | ||
echo -e "\e[1;35mCheck if this is intended.\e[1;31m" | ||
echo | ||
printf '%s\n' "${not_partial[@]/#/' '${PARTIALS_DIR}/}" | ||
echo -e "\e[0m" | ||
echo "You may want to check the orphan history via:" | ||
echo | ||
echo "git log --full-history -- full_path_file_from_above" | ||
echo | ||
else | ||
echo -e "\e[1;36mNo orphaned .adoc files in partials dir (include).\e[0m" | ||
echo | ||
fi | ||
} | ||
|
||
|
||
while getopts ":hn:" o | ||
do | ||
case ${o} in | ||
n ) | ||
MANUAL_NAME=$OPTARG | ||
ACTION="FIND_ORPHANS" | ||
;; | ||
: ) | ||
echo "Invalid option: $OPTARG requires an argument" 1>&2 | ||
exit 1 | ||
;; | ||
h|* ) | ||
ACTION="HELP" | ||
;; | ||
esac | ||
done | ||
shift $((OPTIND-1)) | ||
|
||
case "$ACTION" in | ||
FIND_ORPHANS) | ||
find_orphans | ||
;; | ||
HELP | *) | ||
usage | ||
exit | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# This script checks the ownCloud documentation manual(s) to | ||
# see if attachment files are orphaned. | ||
# The file is included by another script which defines the variables needed ! | ||
# | ||
# Note that filenames MUST NOT contain blanks | ||
|
||
AVAILABLE_MANUALS=( ROOT ) | ||
ROOT_NAME="ROOT" | ||
BASE_DIR="" | ||
MANUAL_POSTFIX="_manual" | ||
TASK="ATTACHMENT" | ||
TARGET_DIR="attachments" | ||
# depending on the target, there may be a trailing slash necessary or not | ||
# check how the file is included | ||
SEARCH_PATTERN='link:{attachmentsdir}/' | ||
|
||
# get the full path of the directory where the script runs | ||
DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" | ||
|
||
# load the working script | ||
source ${DIR}/find-orphaned-base | ||
|
||
# start scanning | ||
start_scan |
Oops, something went wrong.