php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pmjones88 at gmail dot com
New email:
PHP Version: OS:

 

 [2010-04-24 17:55 UTC] pmjones88 at gmail dot com
Description:
------------
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.  




Patches

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

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-25 16:09 UTC] bjori@php.net
Automatic comment from SVN on behalf of bjori
Revision: http://svn.php.net/viewvc/?view=revision&revision=298508
Log: Fixed bug#51654 (Add --ext command line option to specify filename extension)
# Patch by Paul m Jones
 [2010-04-25 16:10 UTC] bjori@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: bjori
 [2010-04-25 16:10 UTC] bjori@php.net
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 PHP.net itself.

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

Changed it to use short-ternary.

Kudos!
 [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] bjori@php.net
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 http://solarphp.com/manual/ 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] bjori@php.net
Automatic comment from SVN on behalf of bjori
Revision: http://svn.php.net/viewvc/?view=revision&revision=298557
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: Thu Mar 28 21:01:27 2024 UTC