[wp-meta] [Making WordPress.org] #176: Source code should display on individual pages

Making WordPress.org noreply at wordpress.org
Fri May 16 18:33:35 UTC 2014


#176: Source code should display on individual pages
---------------------------+-------------------------------------
  Reporter:  samuelsidler  |      Owner:  Rarst
      Type:  enhancement   |     Status:  assigned
  Priority:  high          |  Component:  developer.wordpress.org
Resolution:                |   Keywords:  has-patch needs-testing
---------------------------+-------------------------------------

Comment (by coffee2code):

 Great work and I like how it looks and operates on the front-end.

 However, we need to be mindful of performance. We can't do full file, in-
 memory loading of source files on every request. Ideally the source code
 would be parsed and stored by the parser (maybe as postmeta or a special
 comment). On-the-fly isn't the way to go with this, especially without
 caching the results. Naturally since the parser doesn't currently do this,
 this general approach was necessary.

 Regarding [attachment:176.3.diff] and putting aside how the function
 source code is obtained, here are some things I noted:

 * If the full, un-syntax highlighted source is shown (JS disabled,
 SyntaxHightlighter not enabled, etc), the "Show complete source code" link
 appears. That link should be hidden by default and shown via JS since the
 non-JS view (rightly) shows the full source code anyhow.
 * For short functions, e.g. `__return_false()`, things don't act as
 desired:
   * The "Show complete source code" link appears even though the function
 is fully visible.
   * The source code div is given a height of 186px, which is more space
 than needed for some short functions. The height should ideally be shorter
 in such cases.
 * When the link is clicked, the full display of the function does not
 include the ending line (the function's closing brace). For short
 functions already fully shown, that line gets removed from the view.
 * Regarding the link text "Show complete source code":
   * Instead of "complete", I'd recommend "full" or "entire". Using
 "complete" has the connotation that what is being viewed currently is in-
 progress and unfinished.
   * The 'New in' widget at /reference uses "View all…". If we want
 to consider keeping the syntax for the two similar, maybe this string
 should be "View full source code…" or "View entire source
 code…".
 * With relative ease you can extend support to wp-parser-method as well.

 I have an idea to adapt `get_source_code()` to use stored data, and to
 prime the storage of that data. While the parser could do it (which we'll
 eventually file a ticket for) it can be made to work even if the parser
 doesn't help. I'll follow up shortly. Addressing the things I noted above
 in the meantime would be great though, just leave `get_source_code()` as-
 is and I'll adapt that.

--
Ticket URL: <https://meta.trac.wordpress.org/ticket/176#comment:11>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org


More information about the wp-meta mailing list