#11865 closed enhancement (fixed)
Workflow macro could read files from the repository
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.3.2 |
Component: | ticket system | Version: | |
Severity: | normal | Keywords: | workflow macro bitesized |
Cc: | Branch: | ||
Release Notes: |
Workflow macro can render files from the repository. |
||
API Changes: |
Added method |
||
Internal Changes: |
Description
The Image macro and several WikiProcessors on trac-hacks support reading a file from the repository: th:CodeExampleMacro, th:PlantUmlMacro.
Adding this capability to the Workflow macro and allowing ini files to be read from the repository would make the documentation on the TracWorkflow page could be made more maintainable.
Attachments (0)
Change History (19)
comment:1 by , 10 years ago
Summary: | Path option for WikiProcessors → Workflow macro could read files from the repository |
---|
comment:2 by , 10 years ago
Keywords: | bitesized added |
---|
comment:3 by , 10 years ago
comment:4 by , 9 years ago
Milestone: | next-dev-1.1.x → next-dev-1.3.x |
---|
Narrowing focus for milestone:1.2. Please move ticket to milestone:1.2 if you intend to fix it.
comment:5 by , 8 years ago
DONE Update WorkFlow/Examples to read ini
files from repository after this ticket is implemented.
comment:6 by , 8 years ago
Release Notes: | modified (diff) |
---|
comment:7 by , 8 years ago
API Changes: | modified (diff) |
---|---|
Milestone: | next-dev-1.3.x → 1.3.2 |
Owner: | set to |
Status: | new → assigned |
Proposed changes in [acb2ee10/rjollos.git], with the first two changes in the branch targeted for 1.2-stable (log:rjollos.git:t11865_workflow_macro.1).
comment:8 by , 8 years ago
Replying to Ryan J Ollos:
Adding this capability to the Workflow macro and allowing ini files to be read from the repository would make the documentation on the TracWorkflow page could be made more maintainable.
This actually won't work because the TracWorkflow page is distributed with Trac, however the workflow macro with file
argument can be used on the WorkFlow/Examples page.
comment:9 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:10 by , 8 years ago
After r15859, the following is included in the pot
file:
#: trac/wiki/tests/formatter.py:127 trac/wiki/tests/formatter.py:134 #, python-format msgid "The content: %(content)s" msgstr ""
Is it good to use the same workaround as in tests/config.py?
-
trac/wiki/tests/formatter.py
diff --git a/trac/wiki/tests/formatter.py b/trac/wiki/tests/formatter.py index 629d139fd..2c00309c3 100644
a b class TracErrorWithUnicodeMacro(WikiMacroBase): 123 123 class MacroErrorWithFragmentMacro(WikiMacroBase): 124 124 125 125 def expand_macro(self, formatter, name, content, args=None): 126 raise MacroError( tag_("The content: %(content)s",127 content=html.code(content)))126 raise MacroError((tag_)("The content: %(content)s", 127 content=html.code(content))) 128 128 129 129 130 130 class ProcessorErrorWithFragmentMacro(WikiMacroBase): 131 131 132 132 def expand_macro(self, formatter, name, content, args=None): 133 raise ProcessorError( tag_("The content: %(content)s",134 content=html.code(content)))133 raise ProcessorError((tag_)("The content: %(content)s", 134 content=html.code(content))) 135 135 136 136 137 137 class SampleResolver(Component):
Or is there a better way?
comment:11 by , 8 years ago
Another way, I think we could use tgettext_noop
instead of tag_
to prevent message extraction.
-
trac/wiki/tests/formatter.py
diff --git a/trac/wiki/tests/formatter.py b/trac/wiki/tests/formatter.py index 629d139fd..4a571c9a9 100644
a b import unittest 16 16 17 17 from trac.core import Component, TracError, implements 18 18 from trac.util.html import genshi, html 19 from trac.util.translation import t ag_19 from trac.util.translation import tgettext_noop 20 20 from trac.wiki.api import IWikiSyntaxProvider 21 21 from trac.wiki.formatter import MacroError, ProcessorError 22 22 from trac.wiki.macros import WikiMacroBase … … class TracErrorWithUnicodeMacro(WikiMacroBase): 123 123 class MacroErrorWithFragmentMacro(WikiMacroBase): 124 124 125 125 def expand_macro(self, formatter, name, content, args=None): 126 raise MacroError(t ag_("The content: %(content)s",127 content=html.code(content)))126 raise MacroError(tgettext_noop("The content: %(content)s", 127 content=html.code(content))) 128 128 129 129 130 130 class ProcessorErrorWithFragmentMacro(WikiMacroBase): 131 131 132 132 def expand_macro(self, formatter, name, content, args=None): 133 raise ProcessorError(t ag_("The content: %(content)s",134 content=html.code(content)))133 raise ProcessorError(tgettext_noop("The content: %(content)s", 134 content=html.code(content))) 135 135 136 136 137 137 class SampleResolver(Component):
follow-up: 13 comment:12 by , 8 years ago
That looks useful. I was thinking, there must be a way to ignore files/directories, so did some searching. The changes in log:rjollos.git:t11865_no_extract_message ([dbb43165/rjollos.git]) seem to fix the issue. I'm considering it would be good to push changes to 1.2-stable.
follow-up: 14 comment:13 by , 8 years ago
Replying to Ryan J Ollos:
That looks useful. I was thinking, there must be a way to ignore files/directories, so did some searching. The changes in log:rjollos.git:t11865_no_extract_message ([dbb43165/rjollos.git]) seem to fix the issue.
Ignoring **/tests/**
for extraction is good idea!
Also, I've added ignore = babel.messages.extract:extract_nothing
line to messages-js.cfg
for #12351. However, I noticed the line is not needed by your changes.
-
messages-js.cfg
diff --git a/messages-js.cfg b/messages-js.cfg index 233104561..55366b3fd 100644
a b 2 2 # trac/locale/messages-js.pot (see setup.cfg) 3 3 [extractors] 4 4 javascript_script = trac.dist:extract_javascript_script 5 ignore = babel.messages.extract:extract_nothing6 5 7 6 [ignore: **/htdocs/js/jquery.js] 8 7 [ignore: **/htdocs/js/jquery-ui.js]
I'm considering it would be good to push changes to 1.2-stable.
Agreed.
comment:14 by , 8 years ago
comment:17 by , 8 years ago
After [15888], extract_messages
command is failing….
$ make extract python setup.py extract_messages extract_messages_js extract_messages_tracini running extract_messages error: [Errno 2] No such file or directory: 'messages.cfg' make: *** [extract] Error 1
Added messages.cfg
file in [15897] using [cdd959a1/rjollos.git].
comment:19 by , 5 years ago
Reviewing code in IncludeMacro, RepositoryManager.read_file_by_path
would be more useful if it returned the content type for the file.
Some work has been done to implement the feature in log:rjollos.git:t11865-workflow-macro. More work is needed to mock out
RepositoryManager
and develop a thorough set of test cases.