Skip to content

xpack/web-doxygen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

web-doxygen

This project is a test to build the Doxygen web site with Docusaurus.

Doxygen

Download

cd web-doxygen.git
version="1_14_0"
curl -L https://github.com/doxygen/doxygen/archive/refs/tags/Release_${version}.tar.gz | tar x
mv doxygen-Release_${version} doxygen

Patch

cd web-doxygen.git

sed -i.bak \
-e 's|GENERATE_XML      = NO|GENERATE_XML      = YES|' \
doxygen/doc/Doxyfile

sed -i.bak \
-e 's|GENERATE_XML           = NO|GENERATE_XML           = YES|' \
-e 's|CASE_SENSE_NAMES       = NO|CASE_SENSE_NAMES       = SYSTEM|' \
-e 's|HAVE_DOT               = YES|HAVE_DOT               = NO|' \
-e 's|EXTRACT_ANON_NSPACES   = NO|EXTRACT_ANON_NSPACES   = YES|' \
doxygen/doc_internal/Doxyfile.in

Same for examples, but does not work properly, so use the original .html files:

cd doxygen/examples
ls -1 *.cfg | sed -e 's|\([a-z-]*\).cfg|echo "XML_OUTPUT = xml/examples/\1/xml" >> \1.cfg|'
ls -1 *.cfg | sed -e 's|\([a-z-]*\).cfg|echo "GENERATE_XML = YES" >> \1.cfg|'
style="display: block; margin-left: 0; margin-right: auto;"

Prerequisites

On macOS, install the dependencies:

brew install bison cmake texlive
export PATH="${HOME}/.local/homebrew/hb/bin:${HOME}/.local/homebrew/hb/opt/bison/bin:${PATH}"

Build

cd web-doxygen.git

rm -rf build

mkdir build && cd build
cmake -Dbuild_doc=ON ../doxygen
make docs examples docs_internal

Patch XMLs

cd web-doxygen.git

sed -i.bak \
-e 's|\<center\>||' \
-e 's|\</center\>||' \
-e 's|src=\"doxygen_logo.svg\"|src=\"/web-doxygen/img/doxygen_logo.svg\"|' \
build/xml/indexpage.xml

sed -i.bak -e s'|href=\"index.html\"|href=\"/docs/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"install.html\"|href=\"/docs/pages/install/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"starting.html\"|href=\"/docs/pages/starting/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"docblocks.html\"|href=\"/docs/pages/docblocks/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"additional.html\"|href=\"/docs/pages/additional/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"markdown.html\"|href=\"/docs/pages/markdown/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"lists.html\"|href=\"/docs/pages/lists/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"grouping.html\"|href=\"/docs/pages/grouping/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"formulas.html\"|href=\"/docs/pages/formulas/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"tables.html\"|href=\"/docs/pages/tables/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"diagrams.html\"|href=\"/docs/pages/diagrams/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"preprocessing.html\"|href=\"/docs/pages/preprocessing/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"autolink.html\"|href=\"/docs/pages/autolink/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"output.html\"|href=\"/docs/pages/output/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"searching.html\"|href=\"/docs/pages/searching/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"extsearch.html\"|href=\"/docs/pages/extsearch/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"customize.html\"|href=\"/docs/pages/customize/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"custcmd.html\"|href=\"/docs/pages/custcmd/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"external.html\"|href=\"/docs/pages/external/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"faq.html\"|href=\"/docs/pages/faq/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"trouble.html\"|href=\"/docs/pages/trouble/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"features.html\"|href=\"/docs/pages/features/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"doxygen_usage.html\"|href=\"/docs/pages/doxygen-usage/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"doxywizard_usage.html\"|href=\"/docs/pages/doxywizard-usage/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"config.html\"|href=\"/docs/pages/config/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"commands.html\"|href=\"/docs/pages/commands/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"htmlcmds.html\"|href=\"/docs/pages/htmlcmds/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"xmlcmds.html\"|href=\"/docs/pages/xmlcmds/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"emojisup.html\"|href=\"/docs/pages/emojisup/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"langhowto.html\"|href=\"/docs/pages/langhowto/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"perlmod.html\"|href=\"/docs/pages/perlmod/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"arch.html\"|href=\"/docs/pages/arch/\"|' build/xml/*.xml
sed -i.bak -e s'|href=\"changelog.html\"|href=\"/docs/pages/changelog/\"|' build/xml/*.xml

sed -i.bak -e s'|href=\"commands.html\#|href=\"/docs/pages/commands/\#|' build/xml/*.xml
sed -i.bak -e s'|href=\"searching.html\#|href=\"/docs/pages/searching/\#|' build/xml/*.xml
sed -i.bak -e s'|url="searching.html"|url="/docs/pages/searching/"|' build/xml/*.xml
sed -i.bak -e s'|href=\"translator_report.txt\"|href=\"pathname:///translator_report.txt\"|' build/xml/*.xml

sed -i.bak \
-e s'|<htmlonly> \&lt;/p\&gt;\&lt;center\&gt;\&lt;p\&gt;</htmlonly>|<htmlonly> \&lt;center\&gt;</htmlonly>|g' \
-e s'|<htmlonly> \&lt;/p\&gt;\&lt;/center\&gt;\&lt;p\&gt;</htmlonly>|<htmlonly> \&lt;/center\&gt;</htmlonly>|g' \
build/xml/*.xml

find build/xml -name '*.xml' -print -exec sed -i.bak -e 's|href=\&quot;examples/|href=\&quot;pathname:///examples/|g' '{}' ';'

Copy examples

cd web-doxygen.git

cp -r build/html/examples website/static

Copy logo

cp build/html/doxygen_logo.svg website/static/img

Docusaurus

npx [email protected] website classic --typescript

cd website
npm install @docusaurus/faster

docusaurus.config.ts

  markdown: {
    format: 'detect'
  },

  // Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
  future: {
    v4: {
      removeLegacyPostBuildHeadAttribute: true
    },
    experimental_faster: true,
  },

  trailingSlash: true,

  plugins: [
    function disableExpensiveBundlerOptimizationPlugin() {
      return {
        name: "disable-expensive-bundler-optimizations",
        configureWebpack(_config, isServer) {
          return {
            optimization: {
              concatenateModules: false,
            },
          };
        },
      };
    },
  ],

package.json

  "scripts": {
    "start": "node --max-old-space-size=20480 --stack-size=2048 ./node_modules/.bin/docusaurus start",
    "build": "node --max-old-space-size=20480 --stack-size=2048 ./node_modules/.bin/docusaurus build",

    "convert-doxygen-manual": "node --max-old-space-size=4096 --stack-size=2048 ./node_modules/.bin/doxygen2docusaurus --id manual",
    "convert-doxygen-api": "node --max-old-space-size=4096 --stack-size=2048 ./node_modules/.bin/doxygen2docusaurus --id api"
  },

  "doxygen2docusaurus": {
    "manual": {
      "doxygenXmlInputFolderPath": "../build/xml",
      "apiFolderPath": "manual",
      "baseUrl": "/web-doxygen/",
      "apiBaseUrl": "",
      "sidebarCategoryLabel": "Manual",
      "menuDropdownLabel": "Manual",
      "mainPageTitle": "The Documentation Generator",
      "verbose": false,
      "debug": false
    },
    "api": {
      "doxygenXmlInputFolderPath": "../build/doxygen_docs/xml",
      "apiFolderPath": "api",
      "baseUrl": "/web-doxygen/",
      "apiBaseUrl": "api",
      "sidebarCategoryLabel": "Doxygen Internals",
      "menuDropdownLabel": "Internals",
      "mainPageTitle": "Doxygen Internals",
      "renderProgramListing": false,
      "renderProgramListingInline": true,
      "verbose": false,
      "debug": false
    }
  },

About

A test to convert the Doxygen web site to Docusaurus

Resources

License

Stars

Watchers

Forks