add configurable git clone URL
This commit is contained in:
@@ -19,6 +19,13 @@
|
|||||||
# This is accessible in all templates.
|
# This is accessible in all templates.
|
||||||
#site_description = ""
|
#site_description = ""
|
||||||
|
|
||||||
|
# URL where the repositories can be cloned from.
|
||||||
|
#
|
||||||
|
# Use the "%REPO%" variable to substitute the repository name.
|
||||||
|
#
|
||||||
|
# This can also be set per-repository.
|
||||||
|
#clone_url = "https://github.com/your_user/%REPO%"
|
||||||
|
|
||||||
# Which branch to use for generating history.
|
# Which branch to use for generating history.
|
||||||
#
|
#
|
||||||
# Itsy-Gitsy currently only supports traversing the history of a single branch,
|
# Itsy-Gitsy currently only supports traversing the history of a single branch,
|
||||||
@@ -509,6 +516,7 @@ generated_by = "Itsy-Gitsy"
|
|||||||
|
|
||||||
# Per-repository settings, same as the global versions described above:
|
# Per-repository settings, same as the global versions described above:
|
||||||
|
|
||||||
|
#clone_url = "https://github.com/your_user/%REPO%"
|
||||||
#branch = "master"
|
#branch = "master"
|
||||||
#render_markdown = false
|
#render_markdown = false
|
||||||
#syntax_highlighting = false
|
#syntax_highlighting = false
|
||||||
|
|||||||
+1
-1
@@ -319,7 +319,7 @@ impl GitsyGenerator {
|
|||||||
full_name: repo_desc.name.clone(),
|
full_name: repo_desc.name.clone(),
|
||||||
description: repo_desc.description.clone(),
|
description: repo_desc.description.clone(),
|
||||||
website: repo_desc.website.clone(),
|
website: repo_desc.website.clone(),
|
||||||
clone: None,
|
clone: repo_desc.clone_url.clone(),
|
||||||
attributes: repo_desc.attributes.clone().unwrap_or_default(),
|
attributes: repo_desc.attributes.clone().unwrap_or_default(),
|
||||||
};
|
};
|
||||||
let parsed_repo = parse_repo(&repo, &name, &repo_desc, metadata).expect("Failed to analyze repo HEAD.");
|
let parsed_repo = parse_repo(&repo, &name, &repo_desc, metadata).expect("Failed to analyze repo HEAD.");
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ pub struct GitsySettingsRepo {
|
|||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
|
pub clone_url: Option<String>,
|
||||||
pub website: Option<String>,
|
pub website: Option<String>,
|
||||||
pub branch: Option<String>,
|
pub branch: Option<String>,
|
||||||
pub asset_files: Option<Vec<String>>,
|
pub asset_files: Option<Vec<String>>,
|
||||||
@@ -271,6 +272,7 @@ pub struct GitsySettings {
|
|||||||
pub site_name: Option<String>,
|
pub site_name: Option<String>,
|
||||||
pub site_url: Option<String>,
|
pub site_url: Option<String>,
|
||||||
pub site_description: Option<String>,
|
pub site_description: Option<String>,
|
||||||
|
pub clone_url: Option<String>,
|
||||||
pub asset_files: Option<Vec<String>>,
|
pub asset_files: Option<Vec<String>>,
|
||||||
pub branch: Option<String>,
|
pub branch: Option<String>,
|
||||||
#[serde(rename(deserialize = "gitsy_templates"))]
|
#[serde(rename(deserialize = "gitsy_templates"))]
|
||||||
@@ -347,6 +349,12 @@ impl GitsySettings {
|
|||||||
if repo.name.is_none() {
|
if repo.name.is_none() {
|
||||||
repo.name = Some(k.clone());
|
repo.name = Some(k.clone());
|
||||||
}
|
}
|
||||||
|
if repo.clone_url.is_none() {
|
||||||
|
repo.clone_url = match settings.clone_url.as_ref() {
|
||||||
|
Some(url) => Some(url.replace("%REPO%", repo.name.as_deref().unwrap_or_default())),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
}
|
||||||
global_to_repo!(settings, repo, branch);
|
global_to_repo!(settings, repo, branch);
|
||||||
global_to_repo!(settings, repo, render_markdown);
|
global_to_repo!(settings, repo, render_markdown);
|
||||||
global_to_repo!(settings, repo, syntax_highlight);
|
global_to_repo!(settings, repo, syntax_highlight);
|
||||||
@@ -379,9 +387,14 @@ impl GitsySettings {
|
|||||||
for dir in read_dir(parent).expect("Repo directory not found.") {
|
for dir in read_dir(parent).expect("Repo directory not found.") {
|
||||||
let dir = dir.expect("Repo contains invalid entries");
|
let dir = dir.expect("Repo contains invalid entries");
|
||||||
let name: String = dir.file_name().to_string_lossy().to_string();
|
let name: String = dir.file_name().to_string_lossy().to_string();
|
||||||
|
let clone_url = match settings.clone_url.as_ref() {
|
||||||
|
Some(url) => Some(url.replace("%REPO%", &name)),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
repo_descriptions.insert(GitsySettingsRepo {
|
repo_descriptions.insert(GitsySettingsRepo {
|
||||||
path: dir.path().clone(),
|
path: dir.path().clone(),
|
||||||
name: Some(name),
|
name: Some(name),
|
||||||
|
clone_url,
|
||||||
branch: settings.branch.clone(),
|
branch: settings.branch.clone(),
|
||||||
render_markdown: settings.render_markdown.clone(),
|
render_markdown: settings.render_markdown.clone(),
|
||||||
syntax_highlight: settings.syntax_highlight.clone(),
|
syntax_highlight: settings.syntax_highlight.clone(),
|
||||||
@@ -413,9 +426,14 @@ impl GitsySettings {
|
|||||||
let name: String = dir.file_name()
|
let name: String = dir.file_name()
|
||||||
.expect(&format!("Invalid repository path: {}", dir.display()))
|
.expect(&format!("Invalid repository path: {}", dir.display()))
|
||||||
.to_string_lossy().to_string();
|
.to_string_lossy().to_string();
|
||||||
|
let clone_url = match settings.clone_url.as_ref() {
|
||||||
|
Some(url) => Some(url.replace("%REPO%", &name)),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
repo_descriptions.insert(GitsySettingsRepo {
|
repo_descriptions.insert(GitsySettingsRepo {
|
||||||
path: dir.clone(),
|
path: dir.clone(),
|
||||||
name: Some(name),
|
name: Some(name),
|
||||||
|
clone_url,
|
||||||
branch: settings.branch.clone(),
|
branch: settings.branch.clone(),
|
||||||
render_markdown: settings.render_markdown.clone(),
|
render_markdown: settings.render_markdown.clone(),
|
||||||
syntax_highlight: settings.syntax_highlight.clone(),
|
syntax_highlight: settings.syntax_highlight.clone(),
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
<div class="banner">
|
<div class="banner">
|
||||||
{% if name -%}
|
{% if name -%}
|
||||||
<div class="site-title">{{name | default(value="unnamed repository") }}</div>
|
<div class="site-title">{{name | default(value="unnamed repository") }}</div>
|
||||||
{% else -%}
|
|
||||||
<div class="site-title">{{site_name | default(value="Itsy-Gitsy") }}</div>
|
|
||||||
{% endif -%}
|
|
||||||
|
|
||||||
{% if name -%}
|
|
||||||
<div class="site-description">{{metadata.description | default(value="") }}</div>
|
<div class="site-description">{{metadata.description | default(value="") }}</div>
|
||||||
{% else -%}
|
{% else -%}
|
||||||
|
<div class="site-title">{{site_name | default(value="Itsy-Gitsy") }}</div>
|
||||||
<div class="site-description">{{site_description | default(value="A collection of Git repositories")}}</div>
|
<div class="site-description">{{site_description | default(value="A collection of Git repositories")}}</div>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+10
-3
@@ -218,9 +218,6 @@ div.summary-header {
|
|||||||
border-bottom: solid 1px var(--borderdark);
|
border-bottom: solid 1px var(--borderdark);
|
||||||
border-radius: 10px 10px 0 0;
|
border-radius: 10px 10px 0 0;
|
||||||
}
|
}
|
||||||
div.summary-header.commit {
|
|
||||||
margin-top: 0rem;
|
|
||||||
}
|
|
||||||
div.full-header {
|
div.full-header {
|
||||||
color: var(--offwhite);
|
color: var(--offwhite);
|
||||||
letter-spacing: 0.05em;
|
letter-spacing: 0.05em;
|
||||||
@@ -337,3 +334,13 @@ div.commit-page span.del {
|
|||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
table.clone-url {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
table.clone-url td.field {
|
||||||
|
font-weight: bold;
|
||||||
|
width: 8rem;
|
||||||
|
}
|
||||||
|
table.clone-url td.value {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,6 +3,21 @@
|
|||||||
{% block tab_summary_selected -%}selected{% endblock -%}
|
{% block tab_summary_selected -%}selected{% endblock -%}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<table class="clone-url">
|
||||||
|
<colgroup>
|
||||||
|
<col class="field" />
|
||||||
|
<col class="value" />
|
||||||
|
</colgroup>
|
||||||
|
<tr class="website">
|
||||||
|
<td class="field website">Website:</td>
|
||||||
|
<td class="value website">{{metadata.website | default(value="[none]")}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="clone">
|
||||||
|
<td class="field clone">Clone URL:</td>
|
||||||
|
<td class="value clone">{{metadata.clone | default(value="[none]")}}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
<div class="summary-header commit">Recent history</div>
|
<div class="summary-header commit">Recent history</div>
|
||||||
<table class="summary-table commits">
|
<table class="summary-table commits">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user