GithubHelp home page GithubHelp logo

Comments (2)

mosra avatar mosra commented on June 9, 2024

The most ideal way would of course be to support JS directly, and without Doxygen in the loop :) So, for example, using JSDoc to parse the JS code + comments and give the parsed output back in some JSON, which would then be processed to a template that actually matches JS features (instead of trying to fit it into the C++-oriented template). Given this wouldn't require undoing ugly Doxygen bugs, and assuming JSDoc gives out something already usable, I think it could be quite manageable. The Python doc generator is made from scratch as well, and the main complexity there was mostly about type annotations and lacking introspection/reflection capabilites, something I think you wouldn't run into with JSDoc.

What's already builtin is a feature allowing you to specify additional keywords with @m_keyword{} and @m_keywords{}, Poxy should support those commands directly without having to edit any Doxyfile. So, at the very least, you could add the JS symbols as keywords to the page, so searching for them would lead you to the page/file itself. But just the page/file, not an anchor, and there wouldn't be a way to distinguish functions from objects etc.

/**
@file util.js

@m_keywords{vue_mixins}

...
*/

Another option, and quite easy implementation-wise, could be to expose a config option with a list of tokens that get fed directly into the search data in state.search and processed in build_search_data(). The configuration in m.css can be a Python script so it'd be for example

SEARCH_EXTRA = [
   # name, url, type
   ('vue_mixins', 'util_8js.html#vue_mixins', 'CLASS'),
   ('vue_export_from_class', 'envue_8js.html#vue_export_from_class', 'FUNC'),
   ...
]

Given the config is scriptable, it shouldn't be too laborous, however it's still pretty much tied to the set of type IDs used for the Doxygen symbols (so no "module", for example), to various C++-isms, and is quite low-level compared to what a builtin JS generator could do. A minimal (untested) patch to allow this would be something like this:

diff --git a/documentation/doxygen.py b/documentation/doxygen.py
index 2d5a6f9a..ecc506fb 100755
--- a/documentation/doxygen.py
+++ b/documentation/doxygen.py
@@ -145,6 +147,7 @@ copy a link to the result using <span class="m-label m-dim">⌘</span>
 """,
     'SEARCH_BASE_URL': None,
     'SEARCH_EXTERNAL_URL': None,
+    'SEARCH_EXTRA': [],
 
     'SHOW_UNDOCUMENTED': False,
     'VERSION_LABELS': False
@@ -2501,8 +2504,18 @@ def build_search_data(state: State, merge_subtrees=True, add_lookahead_barriers=
     def strip_tags(text):
         return strip_tags_re.sub('', text)
 
+    search = state.search.copy()
+    for name, url, type in state.config['SEARCH_EXTRA']:
+        result = Empty()
+        result.flags = ResultFlag.from_type(ResultFlag(0), EntryType[type])
+        result.url = url
+        result.prefix = []
+        result.name = name
+        result.keywords = []
+        search += [result]
+
     symbol_count = 0
-    for result in state.search:
+    for result in search:
         # Decide on prefix joiner. Defines are among the :: ones as well,
         # because we need to add the function macros twice -- but they have no
         # prefix, so it's okay.

Would it make sense to be done this way? For Poxy AFAIK there's a TOML configuration file so this would have to be propagated through from there somehow, which might hinder the scriptability aspect. Or @marzer do you have a way to "pass through" a python script directly to a m.css conf.py?

from m.css.

marzer avatar marzer commented on June 9, 2024

Or @marzer do you have a way to "pass through" a python script directly to a m.css conf.py?

Not currently, but would be pretty easy to expose. There's been a few debugging situations where it would have been useful for me, too 😅

from m.css.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.