Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
webcache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
webcache
Commits
6a6e62fa
Commit
6a6e62fa
authored
Feb 14, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed multi-line regex.
parent
53fe3c91
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
importer.py
importer.py
+8
-3
No files found.
importer.py
View file @
6a6e62fa
...
...
@@ -38,13 +38,15 @@ def separate_imports(content):
imports
=
[]
filename
=
'[a-zA-Z0-9
\
._-]+
'
comma = re.compile('
*
,
*
(
?
:
\\\\\
r
?
\
n
*
)
?
')
comma = re.compile('
*
,
*
(
?
:
\\\\\
r
?
\
n
*
)
?
'
, re.M
)
file_list = '
%
s
(
?
:
%
s
%
s
?
)
*
' % (filename, comma.pattern, filename)
m = re.match('
^
import
(
%
s
)(
?
:(
?
:
\
r
?
\
n
)
+
(.
*
))
?$
' % file_list, content, re.M)
m = re.match('
^
import
(
%
s
)(
?
:(
?
:
\
r
?
\
n
)
+
((
?
:.
|
\
n
)
*
))
?$
' % file_list,
content, re.M)
if m:
imports = comma.split(m.group(1))
content = m.group(2)
print '
groups
:
', m.groups()
if not content:
content = ''
...
...
@@ -136,6 +138,9 @@ class Importer(Cache):
# Parse imports from file content
imports, content = separate_imports(raw)
if imports:
print 'imports:', imports
print 'content:', content
self.import_map.update({path: imports})
# Only add imported files that have not been loaded yet
...
...
@@ -159,7 +164,7 @@ class Importer(Cache):
#concat += self.concatenate(new_imports, path)
concat += content
self.loaded
+= path
self.loaded
.append(path)
return concat
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment