|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51654 Add --ext command line option to specify filename extension
Submitted: 2010-04-24 17:55 UTC Modified: 2010-04-25 23:12 UTC
From: pmjones88 at gmail dot com Assigned: bjori (profile)
Status: Closed Package: Doc Build problem
PHP Version: 5.3.2 OS: Mac OS X 10.6.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: pmjones88 at gmail dot com
New email:
PHP Version: OS:


 [2010-04-24 17:55 UTC] pmjones88 at gmail dot com
Patch Narrative

This patch allows the user to pass a `--ext` option at the command line to specify an alternative file extension. This mimics the XSL param `html.ext` available when using `xsltproc`.

The user can specify that no extension be used by passing with `--ext=false`, or the alternative extension to be used with `--ext=".foo"`.  (Note that the dot is part of the value.)  Not passing `--ext`, or passing `--ext=true`, results in using the default extension.

I have successfully built Chunked XHTML with this patch in place.

Patch Summary

- Changed all variations of `'.' . $this->ext` to `$this->ext`.

- Changed all variations of `'.' . $this->getExt()` to `$this->getExt()`.

- Added `--ext` and `-e` as options, with requisite functions in
  BuildOptionsParser and array element in Config.
- Changed all $this->setExt("ext") calls to use a ternary; it sets the
  alternative extension when `--ext` is specified, and sets the default
  package extension otherwise.  


phd-ext-ternary.patch (last revision 2010-04-25 20:22 UTC by pmjones88 at gmail dot com)
phd-ext.patch (last revision 2010-04-24 15:56 UTC by pmjones88 at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-25 16:09 UTC]
Automatic comment from SVN on behalf of bjori
Log: Fixed bug#51654 (Add --ext command line option to specify filename extension)
# Patch by Paul m Jones
 [2010-04-25 16:10 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: bjori
 [2010-04-25 16:10 UTC]
This bug has been fixed in SVN. Since the websites are not directly
updated from the SVN server, the fix might need some time to spread
across the globe to all mirror sites, including itself.

Thank you for the report, and for helping us make better.

Changed it to use short-ternary.

 [2010-04-25 22:21 UTC] pmjones88 at gmail dot com
Bjori -- thanks for applying the patch, I appreciate it.  We're almost there.

The problem with using the short-ternary is that null/false/empty-string has some significance.  You can't, for example, pass --ext=false for "no extension".

Please see the upcoming patch that makes such a thing possible (it has the expanded ternaries in it, it all).

Thanks again!
 [2010-04-25 23:08 UTC]
Is there really a usecase for not having a file extension at all?
I don't mind expanding it again, it just felt wrong...
 [2010-04-25 23:12 UTC] pmjones88 at gmail dot com
I believe there is at least one use case for it.  For example, I'm "no extension" for the xsltproc-generated narrative docs at and I'd like to keep the same format for the PHD docs as well.

I get what you mean on it looking ugly; if there's some way to pretty it up and retain the "no extension" behavior, do what you need to do.
 [2010-04-25 23:16 UTC]
Automatic comment from SVN on behalf of bjori
Log: Errr.. Fix my br0k3n edit of using ?:
Make --ext=false actually use no file extension
# See bug#51654 patch by pmjones
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 13 00:01:28 2024 UTC