Skip to content

Commit

Permalink
Merge pull request #21 from tirix/no-hyp-links
Browse files Browse the repository at this point in the history
Remove links for hypotheses
  • Loading branch information
tirix authored Oct 30, 2023
2 parents 6f2c010 + a3b6e6c commit 1581065
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/statement.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</ul>
</nav>
<hr />
<h2>{{statement_type}} <span class="label">{{label}}</span></h2>
<h2>{{statement_type}} <a href="#" class="label {{type}}">{{label}}</a></h2>
<p><strong>Description:</strong> {{comment}}</p>

<section class="statement">
Expand All @@ -46,14 +46,14 @@
<tr>
<td class="col-step"></td>
<td class="col-hyp">{{#if @first}}{{#if @last}}Hypothesis{{else}}Hypotheses{{/if}}{{/if}}</td>
<td class="col-ref" ><a href="{{label}}" class="label">{{label}}</a></td>
<td class="col-ref"><span class="hyp label">{{label}}</span></td>
<td class="col-expr">{{expr}}</td>
</tr>
{{/each}}
<tr>
<td class="col-step"></td>
<td class="col-hyp">Assertion</td>
<td class="col-ref" ><span class="label">{{label}}</span></td>
<td class="col-ref" ><a href="#" class="label {{type}}">{{label}}</a></td>
<td class="col-expr">{{expr}}</td>
</tr>
</table>
Expand All @@ -76,7 +76,7 @@
<td class="col-hyp">
{{#each hyps }}<a class="step" href="#{{this}}">{{this}}</a>{{#if (not @last)}} {{/if}}{{/each}}
</td>
<td class="col-ref" ><a href="{{label}}" class="label">{{label}}</a></td>
<td class="col-ref" >{{#if link}}<a href="{{label}}" class="label {{type}}">{{label}}</a>{{else}}<span class="label {{type}}">{{label}}</span>{{/if}}</td>
<td class="col-expr"><a name="{{id}}"></a>{{expr}}</td>
</tr>
{{/each}}
Expand Down
16 changes: 16 additions & 0 deletions src/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ struct StepInfo {
hyps: Vec<String>,
label: String,
expr: String,
r#type: String,
link: bool,
}

#[derive(Serialize)]
Expand Down Expand Up @@ -250,6 +252,16 @@ impl Renderer {
]
}

fn stmt_type(stmt: StatementRef) -> String {
match stmt.statement_type() {
StatementType::Provable => "theorem".to_string(),
StatementType::Axiom => "axiom".to_string(),
StatementType::Essential => "hyp".to_string(),
StatementType::Floating => "float".to_string(),
_ => "other".to_string(),
}
}

pub(crate) fn render_comment(&self, comment: &str) -> String {
let comment = comment.replace("\n\n", "</p>\n<p>");
let comment = self.contrib_regex.replace_all(&comment, |caps: &Captures| {
Expand Down Expand Up @@ -426,6 +438,8 @@ impl Renderer {
id: ix.to_string(),
hyps: hyps.iter().map(usize::to_string).collect::<Vec<String>>(),
label: as_str(stmt.label()).to_string(),
r#type: Renderer::stmt_type(stmt),
link: stmt.is_assertion(),
expr: expression_renderer
.clone()
.render_expression(&proof_tree, cur, true)
Expand All @@ -450,6 +464,8 @@ impl Renderer {
id: cur.to_string(),
hyps: hyps.iter().map(usize::to_string).collect::<Vec<String>>(),
label: as_str(stmt.label()).to_string(),
r#type: Renderer::stmt_type(stmt),
link: stmt.is_assertion(),
expr: expression_renderer
.clone()
.render_expression(&proof_tree, cur, false)
Expand Down
2 changes: 1 addition & 1 deletion static/metamath.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ table {
background-color: #DEF;
}

.step {
.step, .hyp.label {
background-color: #EEE;
}

Expand Down

0 comments on commit 1581065

Please sign in to comment.