craftsmancoding / repoman

Repoman allows for easy package development in MODX Revolution. Take back the simplicity!
30 stars 7 forks source link

Remove DocBlocks from final output or build #43

Open carnevlu opened 9 years ago

carnevlu commented 9 years ago

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 commented 9 years ago

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

carnevlu commented 9 years ago

Thx for your reply!

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

fireproofsocks commented 9 years ago

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 commented 9 years ago

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 commented 8 years ago

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

carnevlu commented 8 years ago

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 commented 8 years ago

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

carnevlu commented 8 years ago

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 commented 8 years ago

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