1
0
mirror of https://github.com/php/phd.git synced 2026-03-23 22:52:05 +01:00

73 Commits

Author SHA1 Message Date
Máté Kocsis
e546e7b8d8 Fix rendering of attribute constants (#249)
$this->cchunk["fieldsynopsis"]["modifier"] was not set for atrributes due to the early return, but this value is needed in order to be able to decide if the fieldsynopsis refers to a constant or a property at d7f7004639/phpdotnet/phd/Package/Generic/XHTML.php (L1608)
2026-03-19 22:08:18 +01:00
Louis-Arnaud
8755a928aa Make <preface> not produce a new page by default (#242)
Preface elements are now rendered inline in the parent page instead of
being chunked into separate pages. Explicit annotations like
chunk:true or phd:chunk="true" can still force chunking.
2026-02-17 14:30:25 +00:00
Louis-Arnaud
d7f7004639 Support <packagesynopsis> and <package> rendering for namespaced classes/enums (GH-194) (#241)
Add rendering support for DocBook's <packagesynopsis> and <package>
elements so that namespaced PHP classes and enums can display a proper
`namespace X;` declaration above the class/enum synopsis.
2026-02-15 14:10:12 +00:00
haszi
e012bdf3c1 Fix GH-225 (#226)
* Closes GH-225 - cannot reload saved configuration
* Add test
* Prevent serializing and deserializing non-serializable properties
2026-02-05 22:25:12 +01:00
Louis-Arnaud
5f10df173f Fix <function> with <replaceable> not rendering correctly (#235)
When <function> contains <replaceable>, skip link/parentheses
processing in format_function_text() and output plain text instead.
Uses the role stack pattern already established by format_constant().

Fixes php/phd#171
2026-02-05 17:08:04 +00:00
Louis-Arnaud
61ad3e7cb0 Support MathML (mml:*) elements for XHTML rendering (#236)
Closes #172
2026-02-05 17:04:33 +00:00
lacatoire
65b6eaf04a Replace deprecated SplObjectStorage::detach() with offsetUnset() 2026-02-03 18:35:36 +00:00
Louis-Arnaud
c9154020cd Add linking support for enumidentifier elements (#234)
When <enumidentifier> contains a fully qualified name with :: separator
(e.g., RoundingMode::HalfAwayFromZero), the enum name is extracted and
used to generate a link to the corresponding enum documentation page.

Links are not generated in enumsynopsis context (where enumidentifier
defines the case) or when the enum is not found in the index.

Refs php/phd#180
2026-02-03 18:24:21 +00:00
AllenJB
264c65b187 Fix missing pages in search indexes (#212)
* Search indexes: Fix missing search entries

This handles duplicated ids - but requires changes on web-php to use new indexes
2025-11-04 06:19:18 +00:00
Anna Filina
a798ac50e0 Update tests to sync with PDF removal 2025-11-04 06:15:12 +00:00
Jakub Vrána
40bc3ea30a Fix link to true and false types (#197) 2025-04-15 12:16:45 +08:00
Saki Takamachi
3c00a1a753 Add support enum links (#188) 2025-02-06 12:22:18 +00:00
haszi
c22feecbd0 Add FQN normalization to constants 2025-01-05 23:49:14 +00:00
haszi
d7a81ebea6 Add FQN normalization to properties 2025-01-05 23:49:14 +00:00
haszi
ae255bca28 Fix Config property assignment 2025-01-05 23:49:14 +00:00
haszi
b7c5282c88 Fix FQN class and method linking
Closes GH-170
2025-01-05 23:49:14 +00:00
haszi
f1280799ef Fix property linking test 2024-12-29 23:40:46 +00:00
haszi
b80ae36dba Change property names to camel case 2024-12-29 19:58:10 +00:00
haszi
e66f34e029 Fix tests 2024-12-29 19:58:10 +00:00
haszi
7f4079e98d Add property linking (#183)
Co-authored-by: haszi <haszika80@gmail.com>
2024-12-29 16:42:51 +00:00
haszi
15284136ff Separate regular PhD output from error handling (#176)
- Move error handling code into a class and remove PhD message output handling from it.
- Introduce a new class to handle PhD message output.
- Make the implicit dependency on the output functionality of classes explicit.
- Update PEAR package.xml.
- Fix tests.
- Use proper variadic parameters
- Use class constants
- Use first-class callable syntax

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-11-10 17:57:05 +00:00
haszi
99c70b7aaf Add links to constants with replaceable tags (#175)
Add links to constants with replaceable tags by processing them when the constant tag is being closed.
Add a test.

Co-authored-by: haszi <haszika80@gmail.com>
2024-11-03 14:05:25 +00:00
haszi
543bb5bf25 Move constant definitions to a dedicated file 2024-10-21 14:36:48 +01:00
Jim Winstead
417b06655c Fix element map so changelog rows are handled correctly (#146) 2024-09-23 11:16:41 -07:00
haszi
75bf5fb8b2 Show actual default PhD settings (#150)
Co-authored-by: haszi <haszika80@gmail.com>
2024-09-11 13:46:58 +01:00
haszi
8ca0905687 Remove Config from Autoloader (#143)
Remove Config from Autoloader by replacing it with a static array and a setter method.
Update render.php and setup.php to pass package directories to Autoloader.
Add test.

Co-authored-by: haszi <haszika80@gmail.com>
2024-07-09 19:52:23 +01:00
haszi
e948f1040f Add config as a dependency of format (#142)
* Add Config as a dependency to Format and all it subclasses

* Inject Config into every Format subclass at instantiation

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-07-07 15:58:51 +01:00
haszi
d6dba1a2b8 Convert Config in tests
Instantiate a Config object in setup.php.
Use instantiated object in all tests with non-static methods.
2024-06-21 02:50:44 +01:00
haszi
d86ba83a31 Fix whitespace 2024-06-18 22:48:09 +02:00
haszi
0acdc4278e Add property and constant attribute rendering 2024-06-18 22:48:09 +02:00
haszi
25a18b956a Fix doc-en GH-3428 (#137)
Replace static example element counter with class properties in Index and generic XHTML.
Add tests.
Refactor TestRender so that it can render multiple formats.

Co-authored-by: haszi <haszika80@gmail.com>
2024-06-14 16:08:07 +01:00
haszi
472dd3c144 Add non-parameter attribute rendering
Enable rendering of attributes for classes, exceptions, interfaces, methods and functions.
2024-06-10 23:43:19 +02:00
haszi
e18fd3eee0 Add example indexing and rendering test (#136)
Co-authored-by: haszi <haszika80@gmail.com>
2024-06-05 00:13:00 +01:00
haszi
ef44b909f4 DocBook 5.2 class and exception markup migration (#134)
* Add rendering support for new class and exception markup

Add rendering support for new class and exception markup in the PHP package.
Add tests for the old and the new class and exception markup.

* Add indexing support for new class and exception markup

* Make PhD aware of the current class or exception name when using the new markup

When a reference element has the appropriate roles, store the name of the current class or exception. If this is not done, PhD will generate links to the class even from the class's own synopsis page.

* Fix code formatting differences in screen elements

* Add tests comparing old and new markup rendering output

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-06-04 00:29:06 +01:00
haszi
8625d102d5 Fix GH-3353 incorrect function tag linking (#123)
Closes https://github.com/php/doc-en/issues/3353.

When the list of `refentry`s (functions and methods) is retrieved from the indexing database the characters `_`, `::` and `->` in their names were replaced by `-` before storing them in the array `$ref` in `Format.php`. As this array is used to generate the links to and the index list of functions/methods, functions and methods with the same name after replacing the before mentioned characters (e.g. `finfo_buffer()`/`finfo::buffer()`, `finfo_file()`/`finfo::file()`, etc.) were overwriting each other's reference entries in memory (in the `$ref` array).

Fix this by not replacing the above listed characters.

Co-authored-by: haszi <haszika80@gmail.com>
2024-05-22 16:19:28 +01:00
haszi
fc84db4987 Move all database access to IndexRepository (#126)
Move all database access to IndexRepository.
Use the same database during the entire indexing-rendering process.
Add a simple smoke test for render.php.

Co-authored-by: haszi <haszika80@gmail.com>
2024-05-20 13:19:31 +01:00
haszi
dda2c63603 Add basic Attribute linking (#127)
This adds support for 'known' attributes on method and function parameters.
'Known' in this context means an attribute that has been declared in the documentation with an ID in the `class.attribute_name` format (all current predefined attributes are supported).

Current limitations are:
 - No support for namespaced attributes
 - No support for attributes on a return type

Co-authored-by: haszi <haszika80@gmail.com>
2024-05-20 12:33:50 +01:00
haszi
e7a6c0c9c4 Render elements in simplelist members correctly (#117)
Co-authored-by: haszi <haszika80@gmail.com>
2024-04-25 16:32:26 +01:00
haszi
150f7072d7 Add title color to h1 title elements (#116)
Co-authored-by: haszi <haszika80@gmail.com>
2024-04-22 13:22:10 +01:00
haszi
40e35fece0 Fix failing tests by using an in memory database 2024-04-16 11:23:53 +01:00
haszi
26bf0c610a Inject database dependency into constructor of Index
Add new IndexRepository class to handle all database access.
Inject IndexRepository as a dependency into the constructor of Index and use that instead of directly accessing the database.
Add basic indexing test.
Fix existing test that uses indexing to use IndexRepository.
2024-04-16 11:23:53 +01:00
haszi
e817ea8c42 Refactor Partial Reader
Inject all dependencies in the constructor.
Add parameter and return type hints.
Remove unused variables.
Add test.
2024-04-16 11:13:06 +01:00
haszi
5b52aac2fb Refactor Reader
Add method parameter and return types.
Make readNode method private.
Change equality to identity comparison for string.
Remove unnecessary comments and empty lines.
Add test.
2024-04-16 11:13:06 +01:00
haszi
e6e6847d7b Refactor Options Parser and default Options Handler (#110)
* Refactor Options Parser and default Options Handler

Refactor default Options Handler to accept dependencies through its constructor.
Refactor default Options Handler to return an array of options instead of directly setting options in Config and declare array return types.
Refactor method in Options Parser to return an array of options and declare its return type as array.
Inject all necessary dependencies in render.php.
Refactor two methods in default Options Handler by using match expressions.

* Minor refactor of files used in tests

Inlcude Config with require_once instead of require in Autloader.
Define __INSTALLDIR__ only if it is not defined yet in render.php.
Include Autoloader and functions.php with require_once instead of require.
Remove unnecessary __PHPDIR__ constant, correct path for __INSTALLDIR__ and use that constant in setup.php.

* Remove var_dump from Options Parser

* Fix inconsistent option flags in default Option Handler

* Add default Options Handler tests

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-03-17 18:29:43 +00:00
haszi
172da7553c Add links to namespaced non-class constants (#111)
Add links to namespaced non-class constants.
Add namespaced non-class constants to tests.

Co-authored-by: haszi <haszika80@gmail.com>
2024-03-17 18:24:50 +00:00
haszi
89216bc29a Add handler for caption tag (#109)
Co-authored-by: haszi <haszika80@gmail.com>
2024-03-17 18:15:40 +00:00
haszi
a22459f749 Trim leading and trailing underscores in constant IDs (#106)
Co-authored-by: haszi <haszika80@gmail.com>
2024-03-03 15:34:16 +00:00
haszi
262926d03f Fix GH-98 (#105)
Store IDs of non-chunked elements.
Closes #98.

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-02-27 15:41:14 +00:00
haszi
b703f50bdf Refactor test helpers and test files (#104)
* Add Format as an optional constructor dependency to TestRender

Add Format as an optional constructor dependency to TestRender.
Check format's methods conditionally.
Refactor tests to inject formats.

* Add Config as a constructor dependency to TestRender

Add Config as a constructor dependency to TestRender.
Refactor tests to inject Config.

* Add Index as an optional constructor dependency to TestRender

* TestRender to extend Render

* Config to allow calling instance methods

* Refactor test helpers and test directory structure

Refactor TestRender to use only constructor injected objects.
Rename test format helper classes to indicate which package they belong to.
Move TestRender and all format helper classes into the phpdotnet phd directory to enable autoloading.
Remove all unnecessary lines from setup.php.
Restructure test directory to follow the structure of the tested classes.

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-02-26 15:12:03 +00:00
haszi
2793dde1d2 Run tests on pull requests (#99)
* Run tests on push and pull requests

* Update test

Update test that had an <article> element missing its xml:id which the indexer expects to be present.

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-02-25 16:54:21 +00:00