Skip to content

Conversation

katrinafyi
Copy link

implements --extract flag, fixes #39.

the implementation is rather unsatisfactory. it is done by "pretending" the code has generated the Python source as its output and then setting no_generate = True and delete_code = True.
semantically, this new option is a combination of a hypothetical "delete_text" and then no_generate.

happy to take major feedback and suggestions.

example cog:

preceding text
[[[cog
cog.out("chunk1")
]]]
[[[end]]]
centre text
[[[cog
cog.out("chunk2")
]]]
[[[end]]]
following text

example output:

# <cog a.cog:2>
import cog
cog.out("chunk1")

# <cog a.cog:7>
import cog
cog.out("chunk2")

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

Successfully merging this pull request may close these issues.

feature suggestion: extract Python code only
1 participant