From e940632c39abc511e7be4944caf0d62dd2fe6f15 Mon Sep 17 00:00:00 2001 From: Jendrik Seipp Date: Thu, 11 Jan 2024 22:01:15 +0100 Subject: [PATCH] [trivial] Itemize paper references again and revise autodoc setup. * Switch to newer txt2tags version and remove bundled copy. * Don't build planner in autodoc script. * Let CI test autodoc script (in dry-run mode). --- .github/workflows/autodoc.yml | 2 + .github/workflows/ubuntu.yml | 2 +- misc/autodoc/autodoc.py | 7 - misc/autodoc/external/__init__.py | 0 misc/autodoc/external/txt2tags.py | 6002 ----------------------------- misc/autodoc/markup.py | 5 +- misc/autodoc/requirements.txt | 1 + misc/tox.ini | 17 +- src/search/utils/markup.cc | 12 +- 9 files changed, 22 insertions(+), 6026 deletions(-) delete mode 100644 misc/autodoc/external/__init__.py delete mode 100644 misc/autodoc/external/txt2tags.py create mode 100644 misc/autodoc/requirements.txt diff --git a/.github/workflows/autodoc.yml b/.github/workflows/autodoc.yml index 87a135cabb..eef77cad07 100644 --- a/.github/workflows/autodoc.yml +++ b/.github/workflows/autodoc.yml @@ -25,7 +25,9 @@ jobs: - name: Run autodoc run: | + python3 build.py cd misc/autodoc + python3 -m pip install -r requirements.txt python3 autodoc.py ... diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 29c09220d2..a6a5d45ee4 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -169,7 +169,7 @@ jobs: - name: Run driver, translator and search tests run: | cd misc/ - tox -e driver,translator,search + tox -e driver,translator,search,autodoc - name: Run CPLEX tests if: ${{ env.CPLEX_URL != 0 }} diff --git a/misc/autodoc/autodoc.py b/misc/autodoc/autodoc.py index 0ad357e9c4..52fd96f488 100755 --- a/misc/autodoc/autodoc.py +++ b/misc/autodoc/autodoc.py @@ -3,7 +3,6 @@ import argparse import logging import os -from os.path import dirname, join import re import subprocess import sys @@ -120,10 +119,6 @@ def make_doc_link(m): return text -def build_planner(build): - subprocess.check_call([sys.executable, "build.py", build, "downward"], cwd=REPO_ROOT_DIR) - - def get_pages_from_planner(build): out = subprocess.check_output( ["./fast-downward.py", "--build", build, "--search", "--", "--help", "--txt2tags"], @@ -166,8 +161,6 @@ def add_page(title, text): if not args.dry_run and PASSWORD is None: logging.critical(f"{ENV_VAR_PASSWORD} not set.") sys.exit(1) - logging.info("building planner...") - build_planner(args.build) logging.info("getting new pages from planner...") new_doc_pages = get_pages_from_planner(args.build) if args.dry_run: diff --git a/misc/autodoc/external/__init__.py b/misc/autodoc/external/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/misc/autodoc/external/txt2tags.py b/misc/autodoc/external/txt2tags.py deleted file mode 100644 index 27aaf7516e..0000000000 --- a/misc/autodoc/external/txt2tags.py +++ /dev/null @@ -1,6002 +0,0 @@ -#!/usr/bin/env python3 -# txt2tags - generic text conversion tool -# http://txt2tags.org -# -# Copyright 2001-2010 Aurelio Jargas -# Copyright 2010-2019 Jendrik Seipp -# -# This file is based on txt2tags version 2.6. The changes compared to -# the original version are: -# -# * use spaces instead of tabs -# * support Python 3.6+ in addition to Python 2.7 -# * don't escape underscores in tagged and raw LaTeX text -# * don't use locale-dependent str.capitalize() -# * support SVG images -# -# License: http://www.gnu.org/licenses/gpl-2.0.txt -# Subversion: http://svn.txt2tags.org -# Bug tracker: http://bugs.txt2tags.org -# -######################################################################## -# -# BORING CODE EXPLANATION AHEAD -# -# Just read it if you wish to understand how the txt2tags code works. -# -######################################################################## -# -# The code that [1] parses the marked text is separated from the -# code that [2] insert the target tags. -# -# [1] made by: def convert() -# [2] made by: class BlockMaster -# -# The structures of the marked text are identified and its contents are -# extracted into a data holder (Python lists and dictionaries). -# -# When parsing the source file, the blocks (para, lists, quote, table) -# are opened with BlockMaster, right when found. Then its contents, -# which spans on several lines, are feeded into a special holder on the -# BlockMaster instance. Just when the block is closed, the target tags -# are inserted for the full block as a whole, in one pass. This way, we -# have a better control on blocks. Much better than the previous line by -# line approach. -# -# In other words, whenever inside a block, the parser *holds* the tag -# insertion process, waiting until the full block is read. That was -# needed primary to close paragraphs for the XHTML target, but -# proved to be a very good adding, improving many other processing. -# -# ------------------------------------------------------------------- -# -# These important classes are all documented: -# CommandLine, SourceDocument, ConfigMaster, ConfigLines. -# -# There is a RAW Config format and all kind of configuration is first -# converted to this format. Then a generic method parses it. -# -# These functions get information about the input file(s) and take -# care of the init processing: -# get_infiles_config(), process_source_file() and convert_this_files() -# -######################################################################## - -#XXX Python coding warning -# Avoid common mistakes: -# - do NOT use newlist=list instead newlist=list[:] -# - do NOT use newdic=dic instead newdic=dic.copy() -# - do NOT use dic[key] instead dic.get(key) -# - do NOT use del dic[key] without has_key() before - -#XXX Smart Image Align don't work if the image is a link -# Can't fix that because the image is expanded together with the -# link, at the linkbank filling moment. Only the image is passed -# to parse_images(), not the full line, so it is always 'middle'. - -#XXX Paragraph separation not valid inside Quote -# Quote will not have

inside, instead will close and open -# again the
. This really sux in CSS, when defining a -# different background color. Still don't know how to fix it. - -#XXX TODO (maybe) -# New mark or macro which expands to an anchor full title. -# It is necessary to parse the full document in this order: -# DONE 1st scan: HEAD: get all settings, including %!includeconf -# DONE 2nd scan: BODY: expand includes & apply %!preproc -# 3rd scan: BODY: read titles and compose TOC info -# 4th scan: BODY: full parsing, expanding [#anchor] 1st -# Steps 2 and 3 can be made together, with no tag adding. -# Two complete body scans will be *slow*, don't know if it worths. -# One solution may be add the titles as postproc rules - - -############################################################################## - -# User config (1=ON, 0=OFF) - -USE_I18N = 1 # use gettext for i18ned messages? (default is 1) -COLOR_DEBUG = 1 # show debug messages in colors? (default is 1) -BG_LIGHT = 0 # your terminal background color is light (default is 0) -HTML_LOWER = 0 # use lowercased HTML tags instead upper? (default is 0) - -############################################################################## - - -# These are all the core Python modules used by txt2tags (KISS!) -import re, os, sys, time, getopt - -# The CSV module is new in Python version 2.3 -try: - import csv -except ImportError: - csv = None - -# Program information -my_url = 'http://txt2tags.org' -my_name = 'txt2tags' -my_email = 'verde@aurelio.net' -my_version = '2.6' - -# i18n - just use if available -if USE_I18N: - try: - import gettext - # If your locale dir is different, change it here - cat = gettext.Catalog('txt2tags',localedir='/usr/share/locale/') - _ = cat.gettext - except: - _ = lambda x:x -else: - _ = lambda x:x - -# FLAGS : the conversion related flags , may be used in %!options -# OPTIONS : the conversion related options, may be used in %!options -# ACTIONS : the other behavior modifiers, valid on command line only -# MACROS : the valid macros with their default values for formatting -# SETTINGS: global miscellaneous settings, valid on RC file only -# NO_TARGET: actions that don't require a target specification -# NO_MULTI_INPUT: actions that don't accept more than one input file -# CONFIG_KEYWORDS: the valid %!key:val keywords -# -# FLAGS and OPTIONS are configs that affect the converted document. -# They usually have also a --no-