Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove DocBlocks from final output or build #43

Open
carnevlu opened this issue Sep 3, 2015 · 9 comments
Open

Remove DocBlocks from final output or build #43

carnevlu opened this issue Sep 3, 2015 · 9 comments

Comments

@carnevlu
Copy link

carnevlu commented Sep 3, 2015

hi,

there is a way to remove/filter DocBlock from the output?

Example, in case of a template, i wouldn't that the name of the template is available in the source code of each page that use it.

@fireproofsocks
Copy link
Member

Hmm.. the first comment (usually the DocBlock) should be stripped from the package when built.

@carnevlu
Copy link
Author

carnevlu commented Sep 3, 2015

Thx for your reply!

If I understand correctly, is correct that the DocBlock stay if the package is installed via repoman.

@fireproofsocks
Copy link
Member

Correct: installing via Repoman does not strip out DocBlocks. Repoman installs are intended more for dev scenarios, and Repoman uses the info in the DocBlocks, so it doesn't strip them.

@carnevlu
Copy link
Author

carnevlu commented Sep 4, 2015

Thx for the explication,

maybe will be useful to add a notice in the wiki/DocBlocks about this behaviour.

what do you think?

something like:

... @property_preprocess for a Snippet or @TemplateName for a Template. The most common attributes are shown below.

Notice that the dockblock are filtered only in the package's build process.
Otherwise the docblock stay as part of the code as comment.

@carnevlu
Copy link
Author

hi @fireproofsocks in fact the DocBlocks aren't striped out.

@carnevlu
Copy link
Author

can you help me to fix thix issues?

I'm searching on where this pre-process should be do...
maybe in https://github.com/craftsmancoding/repoman/blob/master/model/repoman/repoman.class.php ?

@fireproofsocks
Copy link
Member

It'd be somewhere in the parser sub classes...

@carnevlu
Copy link
Author

carnevlu commented Feb 4, 2016

Hi @fireproofsocks thx for your reply.

I tried to analyse the problem, in particular for the chunk (modchunk.php) and at line 29

$string = preg_replace('#(' . preg_quote($this->dox_start) . ')(.*)(' . preg_quote($this->dox_end) . ')#Uis', '', $string, 1);

If my interpretation is correct the "core" of the regex don't consider the return character in the DocBlock.

What do you think? can be this one the problem?
Maybe replacing (.*) with (.*[\n]*)+ will fix the problem??
I'll try that in the next week, at the moment I'm a little bit out of time :(

That is not the problem.
Tested from the terminal with debug 4 and... your code generate the great result (in the parser)... but in the build process (i don't know where) it lost that code and use these with DocBlock...

@fireproofsocks
Copy link
Member

Yeah, there should be a unit test for that case. This might be trickier to pinpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants