Skip to content

Commit

Permalink
Removed mermaid links - github no longer renders them (#738)
Browse files Browse the repository at this point in the history
removed mermaid links - github no longer renders them
  • Loading branch information
therealryan authored Feb 26, 2024
1 parent 1929377 commit e87e07d
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 48 deletions.
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,27 @@ These tests produce a rich execution report, [for example](https://mastercard.gi
```mermaid
graph TB
subgraph com.mastercard.test.flow
api[<a href='https://github.com/Mastercard/flow/tree/main/api'>api</a>]
assert-core[<a href='https://github.com/Mastercard/flow/tree/main/assert/assert-core'>assert-core</a>]
assert-filter[<a href='https://github.com/Mastercard/flow/tree/main/assert/assert-filter'>assert-filter</a>]
assert-junit4[<a href='https://github.com/Mastercard/flow/tree/main/assert/assert-junit4'>assert-junit4</a>]
assert-junit5[<a href='https://github.com/Mastercard/flow/tree/main/assert/assert-junit5'>assert-junit5</a>]
builder[<a href='https://github.com/Mastercard/flow/tree/main/builder'>builder</a>]
coppice[<a href='https://github.com/Mastercard/flow/tree/main/validation/coppice'>coppice</a>]
duct[<a href='https://github.com/Mastercard/flow/tree/main/report/duct'>duct</a>]
message-core[<a href='https://github.com/Mastercard/flow/tree/main/message/message-core'>message-core</a>]
message-http[<a href='https://github.com/Mastercard/flow/tree/main/message/message-http'>message-http</a>]
message-json[<a href='https://github.com/Mastercard/flow/tree/main/message/message-json'>message-json</a>]
message-sql[<a href='https://github.com/Mastercard/flow/tree/main/message/message-sql'>message-sql</a>]
message-text[<a href='https://github.com/Mastercard/flow/tree/main/message/message-text'>message-text</a>]
message-web[<a href='https://github.com/Mastercard/flow/tree/main/message/message-web'>message-web</a>]
message-xml[<a href='https://github.com/Mastercard/flow/tree/main/message/message-xml'>message-xml</a>]
model[<a href='https://github.com/Mastercard/flow/tree/main/model'>model</a>]
report-core[<a href='https://github.com/Mastercard/flow/tree/main/report/report-core'>report-core</a>]
report-ng[<a href='https://github.com/Mastercard/flow/tree/main/report/report-ng'>report-ng</a>]
validation-core[<a href='https://github.com/Mastercard/flow/tree/main/validation/validation-core'>validation-core</a>]
validation-junit4[<a href='https://github.com/Mastercard/flow/tree/main/validation/validation-junit4'>validation-junit4</a>]
validation-junit5[<a href='https://github.com/Mastercard/flow/tree/main/validation/validation-junit5'>validation-junit5</a>]
api[api]
assert-core[assert-core]
assert-filter[assert-filter]
assert-junit4[assert-junit4]
assert-junit5[assert-junit5]
builder[builder]
coppice[coppice]
duct[duct]
message-core[message-core]
message-http[message-http]
message-json[message-json]
message-sql[message-sql]
message-text[message-text]
message-web[message-web]
message-xml[message-xml]
model[model]
report-core[report-core]
report-ng[report-ng]
validation-core[validation-core]
validation-junit4[validation-junit4]
validation-junit5[validation-junit5]
end
api --> message-core
api --> builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,30 @@ private static String diagram( String orientation, Predicate<Link> inclusion,
return mermaid.toString();
}

/**
* Pending https://github.com/orgs/community/discussions/106690
*/
private static boolean RENDER_LINKS = false;

private static final String moduleLink( Path root, PomData pom ) {
return String.format( "%s[<a href='https://github.com/Mastercard/flow/tree/main/%s'>%s</a>]",
pom.artifactId(),
root.relativize( pom.dirPath() ).toString().replace( '\\', '/' ),
pom.artifactId() );
if( RENDER_LINKS ) {
return String.format( "%s[<a href='https://github.com/Mastercard/flow/tree/main/%s'>%s</a>]",
pom.artifactId(),
root.relativize( pom.dirPath() ).toString().replace( '\\', '/' ),
pom.artifactId() );
}
return String.format( "%s[%s]", pom.artifactId(), pom.artifactId() );
}

private static final Set<String> extractModules( String mermaid ) {
Set<String> modules = new TreeSet<>();
Matcher m = Pattern.compile( "\\S+\\[<a href='\\S+'>\\S+</a>\\]" ).matcher( mermaid );
Matcher m;
if( RENDER_LINKS ) {
m = Pattern.compile( "\\S+\\[<a href='\\S+'>\\S+</a>\\]" ).matcher( mermaid );
}
else {
m = Pattern.compile( "\\S+\\[\\S+\\]" ).matcher( mermaid );
}
while( m.find() ) {
modules.add( m.group() );
}
Expand Down
44 changes: 22 additions & 22 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,36 @@ graph TD
```mermaid
graph LR
subgraph core
builder[<a href='https://github.com/Mastercard/flow/tree/main/builder'>builder</a>]
model[<a href='https://github.com/Mastercard/flow/tree/main/model'>model</a>]
builder[builder]
model[model]
end
subgraph message
message-http[<a href='https://github.com/Mastercard/flow/tree/main/message/message-http'>message-http</a>]
message-json[<a href='https://github.com/Mastercard/flow/tree/main/message/message-json'>message-json</a>]
message-sql[<a href='https://github.com/Mastercard/flow/tree/main/message/message-sql'>message-sql</a>]
message-text[<a href='https://github.com/Mastercard/flow/tree/main/message/message-text'>message-text</a>]
message-web[<a href='https://github.com/Mastercard/flow/tree/main/message/message-web'>message-web</a>]
message-http[message-http]
message-json[message-json]
message-sql[message-sql]
message-text[message-text]
message-web[message-web]
end
subgraph validation
validation-junit5[<a href='https://github.com/Mastercard/flow/tree/main/validation/validation-junit5'>validation-junit5</a>]
coppice[<a href='https://github.com/Mastercard/flow/tree/main/validation/coppice'>coppice</a>]
validation-junit5[validation-junit5]
coppice[coppice]
end
subgraph assert
assert-junit5[<a href='https://github.com/Mastercard/flow/tree/main/assert/assert-junit5'>assert-junit5</a>]
duct[<a href='https://github.com/Mastercard/flow/tree/main/report/duct'>duct</a>]
assert-junit5[assert-junit5]
duct[duct]
end
subgraph example
app-api[<a href='https://github.com/Mastercard/flow/tree/main/example/app-api'>app-api</a>]
app-assert[<a href='https://github.com/Mastercard/flow/tree/main/example/app-assert'>app-assert</a>]
app-core[<a href='https://github.com/Mastercard/flow/tree/main/example/app-core'>app-core</a>]
app-framework[<a href='https://github.com/Mastercard/flow/tree/main/example/app-framework'>app-framework</a>]
app-histogram[<a href='https://github.com/Mastercard/flow/tree/main/example/app-histogram'>app-histogram</a>]
app-itest[<a href='https://github.com/Mastercard/flow/tree/main/example/app-itest'>app-itest</a>]
app-model[<a href='https://github.com/Mastercard/flow/tree/main/example/app-model'>app-model</a>]
app-queue[<a href='https://github.com/Mastercard/flow/tree/main/example/app-queue'>app-queue</a>]
app-store[<a href='https://github.com/Mastercard/flow/tree/main/example/app-store'>app-store</a>]
app-ui[<a href='https://github.com/Mastercard/flow/tree/main/example/app-ui'>app-ui</a>]
app-web-ui[<a href='https://github.com/Mastercard/flow/tree/main/example/app-web-ui'>app-web-ui</a>]
app-api[app-api]
app-assert[app-assert]
app-core[app-core]
app-framework[app-framework]
app-histogram[app-histogram]
app-itest[app-itest]
app-model[app-model]
app-queue[app-queue]
app-store[app-store]
app-ui[app-ui]
app-web-ui[app-web-ui]
end
app-api --> app-web-ui
app-api --> app-ui
Expand Down

0 comments on commit e87e07d

Please sign in to comment.