Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://gitlab.inria.fr/abrenon/soprano
25 November 2025, 14:44:58 UTC
  • Code
  • Branches (5)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/improveSegmenter
    • refs/heads/linesClustering
    • refs/heads/main
    • refs/tags/0.2.0.0
    • refs/tags/0.2.0.1
    No releases to show
  • 5709fd9
  • /
  • test
  • /
  • Ordering.hs
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:2c77634fa5442c92969c5d16829efa68b38f10ae
origin badgedirectory badge
swh:1:dir:42774dca29f381fffb9f953e4dc56b91cdc708dc
origin badgerevision badge
swh:1:rev:3fc6efcf5444dee0c690d4d57aab06a50593ad8a
origin badgesnapshot badge
swh:1:snp:235f189b7a0afe1c603f91409dcaa1dea9b3b0eb

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 3fc6efcf5444dee0c690d4d57aab06a50593ad8a authored by Alice Brenon on 25 November 2025, 13:33:00 UTC
Switch license to GPLv3 (https://www.gnu.org/licenses/gpl.html)
Tip revision: 3fc6efc
Ordering.hs
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE FlexibleContexts #-}
module Ordering (
    testLayouts
  ) where

import Control.Monad ((>=>))
import Control.Monad.IO.Class (MonadIO(..))
import Data.Map as Map (Map, (!), fromList, insert)
import Distribution.TestSuite (Progress(..), Result(..), Test, testGroup)
import Log (fatal)
import Mock.Layout (array, column, row, sameStructure)
import Mock.Page (Page, TextBlock, pagesGeometry)
import Mock.Resource (TestStack, simpleTest)
import Text.Printf (printf)
import Text.XML.Light.ALTO.Block (defaultHorizontalBody, glueColumns)
import Text.XML.Light.ALTO.Geometry (Axis(..))
import Text.XML.Light.ALTO.Layout (Layout(..), arrange, tree)
import qualified Text.XML.Light.ALTO.Layout as Layout (array)

testGlueColumns :: Int -> Test
testGlueColumns n = simpleTest testName [] $ do
  actual <- fmap fst . Layout.array V <$> glueColumns a b
  Finished <$>
    if sameStructure actual (array V expected)
    then return Pass
    else
      liftIO $ putStr (tree actual) >> return (Fail "Wrong output layouts")
  where
    testName = printf "glue columns — #%d" n
    ((a, b), expected) = strips !! n

testLayout :: Eq a =>
  ([TextBlock] -> TestStack (Layout (Int, a))) -> (Map Page (Layout Int)) -> String -> Page -> Test
testLayout f expected description coord@(t, p) = simpleTest testName [] $
  ((fmap fst <$> f (pagesGeometry ! coord)) >>= checkStructure)
  where
    testName = printf "%s — t%d p%d" description t p
    checkStructure actual
      | sameStructure actual (expected ! coord) = return $ Finished Pass
      | otherwise = liftIO $ putStr (tree actual) >> return (Finished $ Fail "Bad layout")

testArrange :: Page -> Test
testArrange = testLayout arrange arranged "1st step arrange"

testHorizontallyRearranged :: Page -> Test
testHorizontallyRearranged =
  testLayout (arrange >=> reArrangeBody) horizontallyRearranged "2nd step 2 columns"
  where
    reArrangeBody (Simple _) = fatal "Bad Simple Layout"
    reArrangeBody a@(Array {layouts}) =
      let (peritexts, body) = splitAt 1 layouts in
      (\b -> a {layouts = peritexts ++ b}) <$> defaultHorizontalBody body

testLayouts :: Test
testLayouts = testGroup "layouts" [
        testGroup "arrange" $ testArrange <$> pages
      , testGroup "glue" $ testGlueColumns <$> [0..(length strips - 1)]
      , testGroup "horizontally re-arranged" $ testHorizontallyRearranged <$> pages
    ]
  where
    tome k = ((,) k <$>)
    pages =
        tome 1 [37, 39, 58, 60, 72, 74, 79, 82, 157, 231, 1248]
      ++ tome 7 [106]

strips :: [((Layout TextBlock, [Layout TextBlock]), [Layout Int])]
strips =
  let t1p74 = (pagesGeometry ! (1, 74))
      t1p39 = (pagesGeometry ! (1, 39)) in [
        ((Simple (t1p74 !! 4), [Layout.array H (Simple . (t1p74 !!) <$> [5, 6])])
          , [Simple 4, row [5, 6]])
      , ((Simple (t1p39 !! 2), [Layout.array H (Simple . (t1p39 !!) <$> [3, 7])])
                , [Simple 2, row [3, 7]])
    ]

arranged :: Map (Int, Int) (Layout Int)
arranged = Map.fromList [
      ((1, 37), array V [
            row [1, 0]
          , row [2, 3]
          , row [4, 5]
          , row [6, 7]
        ])
    , ((1, 39), array V [
            row [0, 1]
          , Simple 2
          , array H [array V [Simple 3, row [4..6]], Simple 7]
        ])
    , ((1, 58), array V [
            row [0, 1]
          , array H [column [2..6], column [7..11]]
        ])
    , ((1, 60), array V [
            Simple 0
          , array H [column [1..3], column [7,8]]
          , array H [column [4..6], Simple 9]
        ])
    , ((1, 72), array V [
            row [0, 1]
          , row [2, 4]
          , Simple 6
          , row [3, 5]
        ])
    , ((1, 74), array V [
            row [0, 1]
          , row [2, 3]
          , Simple 4
          , row [5, 6]
        ])
    , ((1, 79), array V [
            Simple 0
          , row [1, 2]
          , Simple 3
          , row [4, 5]
        ])
    , ((1, 82), array V [
            row [0, 1]
          , array H [column [2..4], Simple 5]
        ])
    , ((1, 157), array V [
            row [0, 1]
          , array H [column [2, 3], column [5..8]]
          , array H [Simple 4, column [9..11]]
        ])
    , ((1, 231), array V [
            row [0, 1]
          , array H [Simple 2, Simple 3, Simple 4, column [5,6]]
          , row [7, 8]
          , Simple 9
          , Simple 10
        ])
    , ((1, 1248), array V [
            row [6, 7]
          , row [8, 9]
          , Simple 0
          , Simple 1
          , row [2, 3]
          , Simple 4
          , Simple 5
        ])
    , ((7, 106), array V [
            row [0, 1]
          , array H [Simple 2, column [6, 7], column [3, 4]]
          , Simple 5
        ])
  ]

horizontallyRearranged :: Map (Int, Int) (Layout Int)
horizontallyRearranged =
    Map.insert (1, 60) (array V [
          Simple 0
        , array H [
                array V $ Simple <$> [1..6]
              , array V $ Simple <$> [7..9]
            ]
      ])
  . Map.insert (1, 157) (array V [
          row [0, 1]
        , array H [
                column [2..4]
              , column [5..11]
            ]
      ])
  . Map.insert (7, 106) (array V [
          row [0, 1]
        , array H [
                Simple 2
              , column [6,7]
              , column [3..5]
            ]
      ])
  $ arranged

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API